What is the probability of passing through a node in a directed graph
$begingroup$
Say I have a directed graph with no cycles like this one.

And say someone travels along it choosing a random edge to go down at every node. We know that the person walking starts from node 0 and is going to end up in node 8.
Is there a way to figure what the likelihood of this person going through a certain node is? For instance we know that they are going through node 3 2/3 of the time as the starting node only has 3 options and 2 of them goes through node 3.
But is there a way to know the likelihood of them going through a more inner node like 7? I thought maybe if we knew how many possible paths exists and how many of those go through node 7 we could divide them and get the answer. But now I don't think that'll work since not all paths are equally likely.
Any help would be appreciated. Thanks!
probability graph-theory directed-graphs
$endgroup$
add a comment |
$begingroup$
Say I have a directed graph with no cycles like this one.

And say someone travels along it choosing a random edge to go down at every node. We know that the person walking starts from node 0 and is going to end up in node 8.
Is there a way to figure what the likelihood of this person going through a certain node is? For instance we know that they are going through node 3 2/3 of the time as the starting node only has 3 options and 2 of them goes through node 3.
But is there a way to know the likelihood of them going through a more inner node like 7? I thought maybe if we knew how many possible paths exists and how many of those go through node 7 we could divide them and get the answer. But now I don't think that'll work since not all paths are equally likely.
Any help would be appreciated. Thanks!
probability graph-theory directed-graphs
$endgroup$
add a comment |
$begingroup$
Say I have a directed graph with no cycles like this one.

And say someone travels along it choosing a random edge to go down at every node. We know that the person walking starts from node 0 and is going to end up in node 8.
Is there a way to figure what the likelihood of this person going through a certain node is? For instance we know that they are going through node 3 2/3 of the time as the starting node only has 3 options and 2 of them goes through node 3.
But is there a way to know the likelihood of them going through a more inner node like 7? I thought maybe if we knew how many possible paths exists and how many of those go through node 7 we could divide them and get the answer. But now I don't think that'll work since not all paths are equally likely.
Any help would be appreciated. Thanks!
probability graph-theory directed-graphs
$endgroup$
Say I have a directed graph with no cycles like this one.

And say someone travels along it choosing a random edge to go down at every node. We know that the person walking starts from node 0 and is going to end up in node 8.
Is there a way to figure what the likelihood of this person going through a certain node is? For instance we know that they are going through node 3 2/3 of the time as the starting node only has 3 options and 2 of them goes through node 3.
But is there a way to know the likelihood of them going through a more inner node like 7? I thought maybe if we knew how many possible paths exists and how many of those go through node 7 we could divide them and get the answer. But now I don't think that'll work since not all paths are equally likely.
Any help would be appreciated. Thanks!
probability graph-theory directed-graphs
probability graph-theory directed-graphs
edited Dec 12 '18 at 17:58
saulspatz
14.8k21329
14.8k21329
asked Dec 12 '18 at 17:37
John SlaineJohn Slaine
32
32
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
$begingroup$
I thought maybe if we knew how many possible paths exists and how many of those go through node 7 we could divide them and get the answer. But now I don't think that'll work since not all paths are equally likely.
Funny, I went through the exact same thought process! Yes, I first thought of counting just the number of paths as well, but you're right, not all paths are equally likely. OK, so then just compute the probability of getting to a node by computing the probability of getting to any of its predecessors, and multiplying that by the probability of following the edge from that predecessor to the node in question. The image below shows the results (green means the probability of taking the edge, while red means the probability of getting to the node):

Just as an example: the probability of going through node $7$ is the probability of going through either of nodes 4, 5, or 6, respectively multiplied by the probability of taking the edge from that node to node $7$. Thus:
$$P(7) = P(4)cdot frac{1}{3}+P(5)cdot frac{1}{2}+P(6)cdot frac{1}{2} = frac{2}{9}cdot frac{1}{3}+frac{8}{27}cdot frac{1}{2}+frac{19}{27}cdot frac{1}{2}=bbox[yellow]{frac{31}{54}}$$
Also, just for a sanity check, let's make sure the probability of getting to node $8$ is $1$:
$$P(8)=P(4)cdot frac{1}{3}+P(6)cdot frac{1}{2}+P(7)cdot 1 =frac{2}{9}cdot frac{1}{3}+frac{19}{27}cdot frac{1}{2}+frac{31}{54}cdot 1 = frac{4+19+31}{54} = 1$$ Yay!
$endgroup$
$begingroup$
Thanks! That made it really clear. How would I calculate the probability of the person walking on either node 7 or 5?
$endgroup$
– John Slaine
Dec 12 '18 at 19:18
$begingroup$
@JohnSlaine You have $P(5 cup 7) = P(5) + P(7) - P(5 cap 7)$. You know $P(5)$ and $P(7)$, and $P(5 cap 7) = P(5) cdot P(7|5)=frac{8}{27} cdot frac{1}{2}$. So plug that all in
$endgroup$
– Bram28
Dec 12 '18 at 20:06
1
$begingroup$
So P(5∪7) would be 13/18 that way. But shouldn't the answer be same as 1-(the probability that the path didn't go through 5 or 7)? There are only a few paths that do that, 4 to 8 and 2 to 6 to 8. The probability of those paths is $$ 2/9 *1/3 + 5/9*1/2 $$ which is 19/54 and 1-19/54 is 35/54 and not 13/18
$endgroup$
– John Slaine
Dec 13 '18 at 9:45
$begingroup$
@JohnSlaine Hmm, that's strange indeed .... oh! I see: instead of going directly from $5$ to $7$ you can also go from $5$ to $7$ via node $6$. Ok, the probability of that is $frac{8}{27}cdot frac{1}{2}cdotfrac{1}{2}=frac{4}{54}$, and so $P(5cap 7)=frac{8}{54}+frac{4}{54}=frac{12}{54}$, meaning that $P(5cup7)=frac{8}{27}+frac{31}{54}-frac{12}{54}=frac{35}{54}$. Phew! Hey, good catch!!!
$endgroup$
– Bram28
Dec 13 '18 at 12:55
add a comment |
$begingroup$
Let $p_k$ be the probability that the path passes through node $k$ so that $p_0=1.$ We see that $p_1=frac13$ since the only way to get to node $1$ is directly from node $0$. What about node $3?$ Well there's a $frac13$ chance of getting there from node $0$, but if we get to node $1$ we certainly get to node $3$ so $$p_3=frac13cdot p_0+1cdot p_1=frac23$$
Continuing in this manner, you can compute $p_k$ for every node in the graph.
$endgroup$
add a comment |
$begingroup$
I will use a 3 nodes example
Make transition matrix of the probabilities to walk from one node to another node:
$T = begin{bmatrix}
P_{0rightarrow 0} & P_{1rightarrow 0} & P_{2rightarrow 0} \
P_{0rightarrow 1} & P_{1rightarrow 1} & P_{2rightarrow 1} \
P_{0rightarrow 2} & P_{1rightarrow 2} & P_{2rightarrow 2}
end{bmatrix}$
Define the probability of the person starting at node 0, 1, and 2 at the beginning as:
$vec{x}^{(0)} = begin{bmatrix} P_{0} \ P_{1} \ P_{2} end{bmatrix}$
Let $vec{x}^{(n + 1)} = Tx^{(n)}$
The probability that the person visited node 2 is:
$sum_{n = 0}^{n = infty} vec{x}^{(n)}_{2}$
where $vec{x}^{(n)}_{2}$ denotes the 2nd element of vector x, counting from the 0th element.
Since the person can only walk from left to right and can't stop at a node, just stop the algorithm when all elements of $x^{(n)}$ are zero.
$endgroup$
add a comment |
$begingroup$
IN GENERAL, you could solve the problem like this:
Let $chi$ be a stochastic vector in $mathbb{R}^V_{geq 0}$ (all coordinates nonengative and they sum to 1), and let us suppose that you start at node $i$ with probability $chi_i$.
Then from the digraph you have a transition matrix $A$. Now let $S$ be the subset of nodes ($S$ could be a single node of course) which you want to measure the probability that you land on some $v in S$ at some point.
Then let $chi_1$ be the vector $Achi$ and let $chi'_1$ be the vector $chi_1$ except the $v$-th coordinate of $chi'_1$ is set to 0 for all $v in S$. And for each $j$, let $chi_j$ be the vector $Achi'_{j-1}$, and let $chi'_j$ be the vector $chi_j$ except the $v$-th coordinate of $chi'_j$ is set to 0, for all $vin S$.
Then the probability that a node lands on $v$ at some point is $sum_{j=1}^{infty} sum_{v in S} chi_j(v)$.
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3036994%2fwhat-is-the-probability-of-passing-through-a-node-in-a-directed-graph%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
I thought maybe if we knew how many possible paths exists and how many of those go through node 7 we could divide them and get the answer. But now I don't think that'll work since not all paths are equally likely.
Funny, I went through the exact same thought process! Yes, I first thought of counting just the number of paths as well, but you're right, not all paths are equally likely. OK, so then just compute the probability of getting to a node by computing the probability of getting to any of its predecessors, and multiplying that by the probability of following the edge from that predecessor to the node in question. The image below shows the results (green means the probability of taking the edge, while red means the probability of getting to the node):

Just as an example: the probability of going through node $7$ is the probability of going through either of nodes 4, 5, or 6, respectively multiplied by the probability of taking the edge from that node to node $7$. Thus:
$$P(7) = P(4)cdot frac{1}{3}+P(5)cdot frac{1}{2}+P(6)cdot frac{1}{2} = frac{2}{9}cdot frac{1}{3}+frac{8}{27}cdot frac{1}{2}+frac{19}{27}cdot frac{1}{2}=bbox[yellow]{frac{31}{54}}$$
Also, just for a sanity check, let's make sure the probability of getting to node $8$ is $1$:
$$P(8)=P(4)cdot frac{1}{3}+P(6)cdot frac{1}{2}+P(7)cdot 1 =frac{2}{9}cdot frac{1}{3}+frac{19}{27}cdot frac{1}{2}+frac{31}{54}cdot 1 = frac{4+19+31}{54} = 1$$ Yay!
$endgroup$
$begingroup$
Thanks! That made it really clear. How would I calculate the probability of the person walking on either node 7 or 5?
$endgroup$
– John Slaine
Dec 12 '18 at 19:18
$begingroup$
@JohnSlaine You have $P(5 cup 7) = P(5) + P(7) - P(5 cap 7)$. You know $P(5)$ and $P(7)$, and $P(5 cap 7) = P(5) cdot P(7|5)=frac{8}{27} cdot frac{1}{2}$. So plug that all in
$endgroup$
– Bram28
Dec 12 '18 at 20:06
1
$begingroup$
So P(5∪7) would be 13/18 that way. But shouldn't the answer be same as 1-(the probability that the path didn't go through 5 or 7)? There are only a few paths that do that, 4 to 8 and 2 to 6 to 8. The probability of those paths is $$ 2/9 *1/3 + 5/9*1/2 $$ which is 19/54 and 1-19/54 is 35/54 and not 13/18
$endgroup$
– John Slaine
Dec 13 '18 at 9:45
$begingroup$
@JohnSlaine Hmm, that's strange indeed .... oh! I see: instead of going directly from $5$ to $7$ you can also go from $5$ to $7$ via node $6$. Ok, the probability of that is $frac{8}{27}cdot frac{1}{2}cdotfrac{1}{2}=frac{4}{54}$, and so $P(5cap 7)=frac{8}{54}+frac{4}{54}=frac{12}{54}$, meaning that $P(5cup7)=frac{8}{27}+frac{31}{54}-frac{12}{54}=frac{35}{54}$. Phew! Hey, good catch!!!
$endgroup$
– Bram28
Dec 13 '18 at 12:55
add a comment |
$begingroup$
I thought maybe if we knew how many possible paths exists and how many of those go through node 7 we could divide them and get the answer. But now I don't think that'll work since not all paths are equally likely.
Funny, I went through the exact same thought process! Yes, I first thought of counting just the number of paths as well, but you're right, not all paths are equally likely. OK, so then just compute the probability of getting to a node by computing the probability of getting to any of its predecessors, and multiplying that by the probability of following the edge from that predecessor to the node in question. The image below shows the results (green means the probability of taking the edge, while red means the probability of getting to the node):

Just as an example: the probability of going through node $7$ is the probability of going through either of nodes 4, 5, or 6, respectively multiplied by the probability of taking the edge from that node to node $7$. Thus:
$$P(7) = P(4)cdot frac{1}{3}+P(5)cdot frac{1}{2}+P(6)cdot frac{1}{2} = frac{2}{9}cdot frac{1}{3}+frac{8}{27}cdot frac{1}{2}+frac{19}{27}cdot frac{1}{2}=bbox[yellow]{frac{31}{54}}$$
Also, just for a sanity check, let's make sure the probability of getting to node $8$ is $1$:
$$P(8)=P(4)cdot frac{1}{3}+P(6)cdot frac{1}{2}+P(7)cdot 1 =frac{2}{9}cdot frac{1}{3}+frac{19}{27}cdot frac{1}{2}+frac{31}{54}cdot 1 = frac{4+19+31}{54} = 1$$ Yay!
$endgroup$
$begingroup$
Thanks! That made it really clear. How would I calculate the probability of the person walking on either node 7 or 5?
$endgroup$
– John Slaine
Dec 12 '18 at 19:18
$begingroup$
@JohnSlaine You have $P(5 cup 7) = P(5) + P(7) - P(5 cap 7)$. You know $P(5)$ and $P(7)$, and $P(5 cap 7) = P(5) cdot P(7|5)=frac{8}{27} cdot frac{1}{2}$. So plug that all in
$endgroup$
– Bram28
Dec 12 '18 at 20:06
1
$begingroup$
So P(5∪7) would be 13/18 that way. But shouldn't the answer be same as 1-(the probability that the path didn't go through 5 or 7)? There are only a few paths that do that, 4 to 8 and 2 to 6 to 8. The probability of those paths is $$ 2/9 *1/3 + 5/9*1/2 $$ which is 19/54 and 1-19/54 is 35/54 and not 13/18
$endgroup$
– John Slaine
Dec 13 '18 at 9:45
$begingroup$
@JohnSlaine Hmm, that's strange indeed .... oh! I see: instead of going directly from $5$ to $7$ you can also go from $5$ to $7$ via node $6$. Ok, the probability of that is $frac{8}{27}cdot frac{1}{2}cdotfrac{1}{2}=frac{4}{54}$, and so $P(5cap 7)=frac{8}{54}+frac{4}{54}=frac{12}{54}$, meaning that $P(5cup7)=frac{8}{27}+frac{31}{54}-frac{12}{54}=frac{35}{54}$. Phew! Hey, good catch!!!
$endgroup$
– Bram28
Dec 13 '18 at 12:55
add a comment |
$begingroup$
I thought maybe if we knew how many possible paths exists and how many of those go through node 7 we could divide them and get the answer. But now I don't think that'll work since not all paths are equally likely.
Funny, I went through the exact same thought process! Yes, I first thought of counting just the number of paths as well, but you're right, not all paths are equally likely. OK, so then just compute the probability of getting to a node by computing the probability of getting to any of its predecessors, and multiplying that by the probability of following the edge from that predecessor to the node in question. The image below shows the results (green means the probability of taking the edge, while red means the probability of getting to the node):

Just as an example: the probability of going through node $7$ is the probability of going through either of nodes 4, 5, or 6, respectively multiplied by the probability of taking the edge from that node to node $7$. Thus:
$$P(7) = P(4)cdot frac{1}{3}+P(5)cdot frac{1}{2}+P(6)cdot frac{1}{2} = frac{2}{9}cdot frac{1}{3}+frac{8}{27}cdot frac{1}{2}+frac{19}{27}cdot frac{1}{2}=bbox[yellow]{frac{31}{54}}$$
Also, just for a sanity check, let's make sure the probability of getting to node $8$ is $1$:
$$P(8)=P(4)cdot frac{1}{3}+P(6)cdot frac{1}{2}+P(7)cdot 1 =frac{2}{9}cdot frac{1}{3}+frac{19}{27}cdot frac{1}{2}+frac{31}{54}cdot 1 = frac{4+19+31}{54} = 1$$ Yay!
$endgroup$
I thought maybe if we knew how many possible paths exists and how many of those go through node 7 we could divide them and get the answer. But now I don't think that'll work since not all paths are equally likely.
Funny, I went through the exact same thought process! Yes, I first thought of counting just the number of paths as well, but you're right, not all paths are equally likely. OK, so then just compute the probability of getting to a node by computing the probability of getting to any of its predecessors, and multiplying that by the probability of following the edge from that predecessor to the node in question. The image below shows the results (green means the probability of taking the edge, while red means the probability of getting to the node):

Just as an example: the probability of going through node $7$ is the probability of going through either of nodes 4, 5, or 6, respectively multiplied by the probability of taking the edge from that node to node $7$. Thus:
$$P(7) = P(4)cdot frac{1}{3}+P(5)cdot frac{1}{2}+P(6)cdot frac{1}{2} = frac{2}{9}cdot frac{1}{3}+frac{8}{27}cdot frac{1}{2}+frac{19}{27}cdot frac{1}{2}=bbox[yellow]{frac{31}{54}}$$
Also, just for a sanity check, let's make sure the probability of getting to node $8$ is $1$:
$$P(8)=P(4)cdot frac{1}{3}+P(6)cdot frac{1}{2}+P(7)cdot 1 =frac{2}{9}cdot frac{1}{3}+frac{19}{27}cdot frac{1}{2}+frac{31}{54}cdot 1 = frac{4+19+31}{54} = 1$$ Yay!
edited Dec 12 '18 at 18:22
answered Dec 12 '18 at 17:47
Bram28Bram28
61.9k44793
61.9k44793
$begingroup$
Thanks! That made it really clear. How would I calculate the probability of the person walking on either node 7 or 5?
$endgroup$
– John Slaine
Dec 12 '18 at 19:18
$begingroup$
@JohnSlaine You have $P(5 cup 7) = P(5) + P(7) - P(5 cap 7)$. You know $P(5)$ and $P(7)$, and $P(5 cap 7) = P(5) cdot P(7|5)=frac{8}{27} cdot frac{1}{2}$. So plug that all in
$endgroup$
– Bram28
Dec 12 '18 at 20:06
1
$begingroup$
So P(5∪7) would be 13/18 that way. But shouldn't the answer be same as 1-(the probability that the path didn't go through 5 or 7)? There are only a few paths that do that, 4 to 8 and 2 to 6 to 8. The probability of those paths is $$ 2/9 *1/3 + 5/9*1/2 $$ which is 19/54 and 1-19/54 is 35/54 and not 13/18
$endgroup$
– John Slaine
Dec 13 '18 at 9:45
$begingroup$
@JohnSlaine Hmm, that's strange indeed .... oh! I see: instead of going directly from $5$ to $7$ you can also go from $5$ to $7$ via node $6$. Ok, the probability of that is $frac{8}{27}cdot frac{1}{2}cdotfrac{1}{2}=frac{4}{54}$, and so $P(5cap 7)=frac{8}{54}+frac{4}{54}=frac{12}{54}$, meaning that $P(5cup7)=frac{8}{27}+frac{31}{54}-frac{12}{54}=frac{35}{54}$. Phew! Hey, good catch!!!
$endgroup$
– Bram28
Dec 13 '18 at 12:55
add a comment |
$begingroup$
Thanks! That made it really clear. How would I calculate the probability of the person walking on either node 7 or 5?
$endgroup$
– John Slaine
Dec 12 '18 at 19:18
$begingroup$
@JohnSlaine You have $P(5 cup 7) = P(5) + P(7) - P(5 cap 7)$. You know $P(5)$ and $P(7)$, and $P(5 cap 7) = P(5) cdot P(7|5)=frac{8}{27} cdot frac{1}{2}$. So plug that all in
$endgroup$
– Bram28
Dec 12 '18 at 20:06
1
$begingroup$
So P(5∪7) would be 13/18 that way. But shouldn't the answer be same as 1-(the probability that the path didn't go through 5 or 7)? There are only a few paths that do that, 4 to 8 and 2 to 6 to 8. The probability of those paths is $$ 2/9 *1/3 + 5/9*1/2 $$ which is 19/54 and 1-19/54 is 35/54 and not 13/18
$endgroup$
– John Slaine
Dec 13 '18 at 9:45
$begingroup$
@JohnSlaine Hmm, that's strange indeed .... oh! I see: instead of going directly from $5$ to $7$ you can also go from $5$ to $7$ via node $6$. Ok, the probability of that is $frac{8}{27}cdot frac{1}{2}cdotfrac{1}{2}=frac{4}{54}$, and so $P(5cap 7)=frac{8}{54}+frac{4}{54}=frac{12}{54}$, meaning that $P(5cup7)=frac{8}{27}+frac{31}{54}-frac{12}{54}=frac{35}{54}$. Phew! Hey, good catch!!!
$endgroup$
– Bram28
Dec 13 '18 at 12:55
$begingroup$
Thanks! That made it really clear. How would I calculate the probability of the person walking on either node 7 or 5?
$endgroup$
– John Slaine
Dec 12 '18 at 19:18
$begingroup$
Thanks! That made it really clear. How would I calculate the probability of the person walking on either node 7 or 5?
$endgroup$
– John Slaine
Dec 12 '18 at 19:18
$begingroup$
@JohnSlaine You have $P(5 cup 7) = P(5) + P(7) - P(5 cap 7)$. You know $P(5)$ and $P(7)$, and $P(5 cap 7) = P(5) cdot P(7|5)=frac{8}{27} cdot frac{1}{2}$. So plug that all in
$endgroup$
– Bram28
Dec 12 '18 at 20:06
$begingroup$
@JohnSlaine You have $P(5 cup 7) = P(5) + P(7) - P(5 cap 7)$. You know $P(5)$ and $P(7)$, and $P(5 cap 7) = P(5) cdot P(7|5)=frac{8}{27} cdot frac{1}{2}$. So plug that all in
$endgroup$
– Bram28
Dec 12 '18 at 20:06
1
1
$begingroup$
So P(5∪7) would be 13/18 that way. But shouldn't the answer be same as 1-(the probability that the path didn't go through 5 or 7)? There are only a few paths that do that, 4 to 8 and 2 to 6 to 8. The probability of those paths is $$ 2/9 *1/3 + 5/9*1/2 $$ which is 19/54 and 1-19/54 is 35/54 and not 13/18
$endgroup$
– John Slaine
Dec 13 '18 at 9:45
$begingroup$
So P(5∪7) would be 13/18 that way. But shouldn't the answer be same as 1-(the probability that the path didn't go through 5 or 7)? There are only a few paths that do that, 4 to 8 and 2 to 6 to 8. The probability of those paths is $$ 2/9 *1/3 + 5/9*1/2 $$ which is 19/54 and 1-19/54 is 35/54 and not 13/18
$endgroup$
– John Slaine
Dec 13 '18 at 9:45
$begingroup$
@JohnSlaine Hmm, that's strange indeed .... oh! I see: instead of going directly from $5$ to $7$ you can also go from $5$ to $7$ via node $6$. Ok, the probability of that is $frac{8}{27}cdot frac{1}{2}cdotfrac{1}{2}=frac{4}{54}$, and so $P(5cap 7)=frac{8}{54}+frac{4}{54}=frac{12}{54}$, meaning that $P(5cup7)=frac{8}{27}+frac{31}{54}-frac{12}{54}=frac{35}{54}$. Phew! Hey, good catch!!!
$endgroup$
– Bram28
Dec 13 '18 at 12:55
$begingroup$
@JohnSlaine Hmm, that's strange indeed .... oh! I see: instead of going directly from $5$ to $7$ you can also go from $5$ to $7$ via node $6$. Ok, the probability of that is $frac{8}{27}cdot frac{1}{2}cdotfrac{1}{2}=frac{4}{54}$, and so $P(5cap 7)=frac{8}{54}+frac{4}{54}=frac{12}{54}$, meaning that $P(5cup7)=frac{8}{27}+frac{31}{54}-frac{12}{54}=frac{35}{54}$. Phew! Hey, good catch!!!
$endgroup$
– Bram28
Dec 13 '18 at 12:55
add a comment |
$begingroup$
Let $p_k$ be the probability that the path passes through node $k$ so that $p_0=1.$ We see that $p_1=frac13$ since the only way to get to node $1$ is directly from node $0$. What about node $3?$ Well there's a $frac13$ chance of getting there from node $0$, but if we get to node $1$ we certainly get to node $3$ so $$p_3=frac13cdot p_0+1cdot p_1=frac23$$
Continuing in this manner, you can compute $p_k$ for every node in the graph.
$endgroup$
add a comment |
$begingroup$
Let $p_k$ be the probability that the path passes through node $k$ so that $p_0=1.$ We see that $p_1=frac13$ since the only way to get to node $1$ is directly from node $0$. What about node $3?$ Well there's a $frac13$ chance of getting there from node $0$, but if we get to node $1$ we certainly get to node $3$ so $$p_3=frac13cdot p_0+1cdot p_1=frac23$$
Continuing in this manner, you can compute $p_k$ for every node in the graph.
$endgroup$
add a comment |
$begingroup$
Let $p_k$ be the probability that the path passes through node $k$ so that $p_0=1.$ We see that $p_1=frac13$ since the only way to get to node $1$ is directly from node $0$. What about node $3?$ Well there's a $frac13$ chance of getting there from node $0$, but if we get to node $1$ we certainly get to node $3$ so $$p_3=frac13cdot p_0+1cdot p_1=frac23$$
Continuing in this manner, you can compute $p_k$ for every node in the graph.
$endgroup$
Let $p_k$ be the probability that the path passes through node $k$ so that $p_0=1.$ We see that $p_1=frac13$ since the only way to get to node $1$ is directly from node $0$. What about node $3?$ Well there's a $frac13$ chance of getting there from node $0$, but if we get to node $1$ we certainly get to node $3$ so $$p_3=frac13cdot p_0+1cdot p_1=frac23$$
Continuing in this manner, you can compute $p_k$ for every node in the graph.
answered Dec 12 '18 at 18:07
saulspatzsaulspatz
14.8k21329
14.8k21329
add a comment |
add a comment |
$begingroup$
I will use a 3 nodes example
Make transition matrix of the probabilities to walk from one node to another node:
$T = begin{bmatrix}
P_{0rightarrow 0} & P_{1rightarrow 0} & P_{2rightarrow 0} \
P_{0rightarrow 1} & P_{1rightarrow 1} & P_{2rightarrow 1} \
P_{0rightarrow 2} & P_{1rightarrow 2} & P_{2rightarrow 2}
end{bmatrix}$
Define the probability of the person starting at node 0, 1, and 2 at the beginning as:
$vec{x}^{(0)} = begin{bmatrix} P_{0} \ P_{1} \ P_{2} end{bmatrix}$
Let $vec{x}^{(n + 1)} = Tx^{(n)}$
The probability that the person visited node 2 is:
$sum_{n = 0}^{n = infty} vec{x}^{(n)}_{2}$
where $vec{x}^{(n)}_{2}$ denotes the 2nd element of vector x, counting from the 0th element.
Since the person can only walk from left to right and can't stop at a node, just stop the algorithm when all elements of $x^{(n)}$ are zero.
$endgroup$
add a comment |
$begingroup$
I will use a 3 nodes example
Make transition matrix of the probabilities to walk from one node to another node:
$T = begin{bmatrix}
P_{0rightarrow 0} & P_{1rightarrow 0} & P_{2rightarrow 0} \
P_{0rightarrow 1} & P_{1rightarrow 1} & P_{2rightarrow 1} \
P_{0rightarrow 2} & P_{1rightarrow 2} & P_{2rightarrow 2}
end{bmatrix}$
Define the probability of the person starting at node 0, 1, and 2 at the beginning as:
$vec{x}^{(0)} = begin{bmatrix} P_{0} \ P_{1} \ P_{2} end{bmatrix}$
Let $vec{x}^{(n + 1)} = Tx^{(n)}$
The probability that the person visited node 2 is:
$sum_{n = 0}^{n = infty} vec{x}^{(n)}_{2}$
where $vec{x}^{(n)}_{2}$ denotes the 2nd element of vector x, counting from the 0th element.
Since the person can only walk from left to right and can't stop at a node, just stop the algorithm when all elements of $x^{(n)}$ are zero.
$endgroup$
add a comment |
$begingroup$
I will use a 3 nodes example
Make transition matrix of the probabilities to walk from one node to another node:
$T = begin{bmatrix}
P_{0rightarrow 0} & P_{1rightarrow 0} & P_{2rightarrow 0} \
P_{0rightarrow 1} & P_{1rightarrow 1} & P_{2rightarrow 1} \
P_{0rightarrow 2} & P_{1rightarrow 2} & P_{2rightarrow 2}
end{bmatrix}$
Define the probability of the person starting at node 0, 1, and 2 at the beginning as:
$vec{x}^{(0)} = begin{bmatrix} P_{0} \ P_{1} \ P_{2} end{bmatrix}$
Let $vec{x}^{(n + 1)} = Tx^{(n)}$
The probability that the person visited node 2 is:
$sum_{n = 0}^{n = infty} vec{x}^{(n)}_{2}$
where $vec{x}^{(n)}_{2}$ denotes the 2nd element of vector x, counting from the 0th element.
Since the person can only walk from left to right and can't stop at a node, just stop the algorithm when all elements of $x^{(n)}$ are zero.
$endgroup$
I will use a 3 nodes example
Make transition matrix of the probabilities to walk from one node to another node:
$T = begin{bmatrix}
P_{0rightarrow 0} & P_{1rightarrow 0} & P_{2rightarrow 0} \
P_{0rightarrow 1} & P_{1rightarrow 1} & P_{2rightarrow 1} \
P_{0rightarrow 2} & P_{1rightarrow 2} & P_{2rightarrow 2}
end{bmatrix}$
Define the probability of the person starting at node 0, 1, and 2 at the beginning as:
$vec{x}^{(0)} = begin{bmatrix} P_{0} \ P_{1} \ P_{2} end{bmatrix}$
Let $vec{x}^{(n + 1)} = Tx^{(n)}$
The probability that the person visited node 2 is:
$sum_{n = 0}^{n = infty} vec{x}^{(n)}_{2}$
where $vec{x}^{(n)}_{2}$ denotes the 2nd element of vector x, counting from the 0th element.
Since the person can only walk from left to right and can't stop at a node, just stop the algorithm when all elements of $x^{(n)}$ are zero.
answered Dec 12 '18 at 18:08
R zuR zu
33910
33910
add a comment |
add a comment |
$begingroup$
IN GENERAL, you could solve the problem like this:
Let $chi$ be a stochastic vector in $mathbb{R}^V_{geq 0}$ (all coordinates nonengative and they sum to 1), and let us suppose that you start at node $i$ with probability $chi_i$.
Then from the digraph you have a transition matrix $A$. Now let $S$ be the subset of nodes ($S$ could be a single node of course) which you want to measure the probability that you land on some $v in S$ at some point.
Then let $chi_1$ be the vector $Achi$ and let $chi'_1$ be the vector $chi_1$ except the $v$-th coordinate of $chi'_1$ is set to 0 for all $v in S$. And for each $j$, let $chi_j$ be the vector $Achi'_{j-1}$, and let $chi'_j$ be the vector $chi_j$ except the $v$-th coordinate of $chi'_j$ is set to 0, for all $vin S$.
Then the probability that a node lands on $v$ at some point is $sum_{j=1}^{infty} sum_{v in S} chi_j(v)$.
$endgroup$
add a comment |
$begingroup$
IN GENERAL, you could solve the problem like this:
Let $chi$ be a stochastic vector in $mathbb{R}^V_{geq 0}$ (all coordinates nonengative and they sum to 1), and let us suppose that you start at node $i$ with probability $chi_i$.
Then from the digraph you have a transition matrix $A$. Now let $S$ be the subset of nodes ($S$ could be a single node of course) which you want to measure the probability that you land on some $v in S$ at some point.
Then let $chi_1$ be the vector $Achi$ and let $chi'_1$ be the vector $chi_1$ except the $v$-th coordinate of $chi'_1$ is set to 0 for all $v in S$. And for each $j$, let $chi_j$ be the vector $Achi'_{j-1}$, and let $chi'_j$ be the vector $chi_j$ except the $v$-th coordinate of $chi'_j$ is set to 0, for all $vin S$.
Then the probability that a node lands on $v$ at some point is $sum_{j=1}^{infty} sum_{v in S} chi_j(v)$.
$endgroup$
add a comment |
$begingroup$
IN GENERAL, you could solve the problem like this:
Let $chi$ be a stochastic vector in $mathbb{R}^V_{geq 0}$ (all coordinates nonengative and they sum to 1), and let us suppose that you start at node $i$ with probability $chi_i$.
Then from the digraph you have a transition matrix $A$. Now let $S$ be the subset of nodes ($S$ could be a single node of course) which you want to measure the probability that you land on some $v in S$ at some point.
Then let $chi_1$ be the vector $Achi$ and let $chi'_1$ be the vector $chi_1$ except the $v$-th coordinate of $chi'_1$ is set to 0 for all $v in S$. And for each $j$, let $chi_j$ be the vector $Achi'_{j-1}$, and let $chi'_j$ be the vector $chi_j$ except the $v$-th coordinate of $chi'_j$ is set to 0, for all $vin S$.
Then the probability that a node lands on $v$ at some point is $sum_{j=1}^{infty} sum_{v in S} chi_j(v)$.
$endgroup$
IN GENERAL, you could solve the problem like this:
Let $chi$ be a stochastic vector in $mathbb{R}^V_{geq 0}$ (all coordinates nonengative and they sum to 1), and let us suppose that you start at node $i$ with probability $chi_i$.
Then from the digraph you have a transition matrix $A$. Now let $S$ be the subset of nodes ($S$ could be a single node of course) which you want to measure the probability that you land on some $v in S$ at some point.
Then let $chi_1$ be the vector $Achi$ and let $chi'_1$ be the vector $chi_1$ except the $v$-th coordinate of $chi'_1$ is set to 0 for all $v in S$. And for each $j$, let $chi_j$ be the vector $Achi'_{j-1}$, and let $chi'_j$ be the vector $chi_j$ except the $v$-th coordinate of $chi'_j$ is set to 0, for all $vin S$.
Then the probability that a node lands on $v$ at some point is $sum_{j=1}^{infty} sum_{v in S} chi_j(v)$.
edited Dec 12 '18 at 18:25
answered Dec 12 '18 at 18:18
MikeMike
3,835412
3,835412
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3036994%2fwhat-is-the-probability-of-passing-through-a-node-in-a-directed-graph%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown