Conditional Probability for Network Science My network has 100 nodes and 196 edges. Each node has an attribute of "smoker" or "non-smoker". There are 5 smokers and 95 non-smokers.
I want to know the probability of being a smoker given that you are connected to a smoker.
16 nodes in the network are connected to a smoker.
2 nodes are connected to a smoker AND are a smoker themselves.
I want to set up a conditional probability P(A|B) where:
A = node is a smoker
B = node has a neighbor who is a smoker
P(A) = 5/100
P(B) = 16/100
P(A∧B) = 2/100
So P(A|B) = .02/.16 = .125
Is this the right way to do this?
I'm a little uncertain about using the number of nodes as the denominator for my probabilities. Might edges make sense too? Particularly for P(B)--the sum of degrees of smoker nodes divided by total edges. In this case 18/196.
Also, if I loop through the network and look at all neighbors, there are 392 (196*2). My graph is not directed, but might this number be relevant too. Thinking of each neighbor-neighbor relationship as a ball in a bowl. In the context of probability, is source->target identical to target->source if the graph is not directed? Or should I be considering each neighbor for each node's perspective?
Visualization below: Blue nodes are smokers


Find the people who are connected to smokers.
Of those people, how many are smokers?
Done.
The fact that there is a graph could lead one to believe that fancy graph analysis is necessary, and you could do something with how many connections one has to smokers or second-degree connections (connected to no smokers, but connected to a non-smoker who has a smoker connection), but I do believe it is this simple to solve the stated problem.
