Counting the directed paths in a particular directed graph
$begingroup$
I want to find out how many directed simple paths from $s$ to $t$ are in the following directed graph $G=(V,E)$.
$$begin{align}
V=&{s, v_1, v_2,ldots, v_n, t}, quad n=2k, k in mathbb{N} \
E=&{ (s, v_1), (s, v_2), \
&;(v_1,v_3), (v_1,v_4), (v_2,v_3),(v_2,v_4), \
&;(v_3,v_5), (v_3,v_6), (v_4,v_5), (v_4,v_6), \
&;ldots, \
&;(v_{n-5},v_{n-3}), (v_{n-5},v_{n-2}), (v_{n-4},v_{n-3}), (v_{n-4},v_{n-2}), \
&;(v_{n-3},v_{n-1}), (v_{n-3},v_{n}), (v_{n-2},v_{n-1}), (v_{n-2},v_{n}), \
&;(v_{n-1},t), (v_{n},t) }
end{align}$$
In my opinion, there are $n$ directed paths. Is that right?
combinatorics discrete-mathematics graph-theory directed-graphs
$endgroup$
|
show 11 more comments
$begingroup$
I want to find out how many directed simple paths from $s$ to $t$ are in the following directed graph $G=(V,E)$.
$$begin{align}
V=&{s, v_1, v_2,ldots, v_n, t}, quad n=2k, k in mathbb{N} \
E=&{ (s, v_1), (s, v_2), \
&;(v_1,v_3), (v_1,v_4), (v_2,v_3),(v_2,v_4), \
&;(v_3,v_5), (v_3,v_6), (v_4,v_5), (v_4,v_6), \
&;ldots, \
&;(v_{n-5},v_{n-3}), (v_{n-5},v_{n-2}), (v_{n-4},v_{n-3}), (v_{n-4},v_{n-2}), \
&;(v_{n-3},v_{n-1}), (v_{n-3},v_{n}), (v_{n-2},v_{n-1}), (v_{n-2},v_{n}), \
&;(v_{n-1},t), (v_{n},t) }
end{align}$$
In my opinion, there are $n$ directed paths. Is that right?
combinatorics discrete-mathematics graph-theory directed-graphs
$endgroup$
$begingroup$
According to our definition it must hold $ v_i ne v_j $for a path. Therefore the paths have to be simple paths. What do you mean by directed paths of length 0?
$endgroup$
– Leon1998
Dec 16 '18 at 9:32
$begingroup$
Ok then I get that. There are n vertices + s +t = n+2:). How do you get to 4n?
$endgroup$
– Leon1998
Dec 16 '18 at 9:42
1
$begingroup$
I forgot to mention. How many paths are from s to t. I am sorry:(
$endgroup$
– Leon1998
Dec 16 '18 at 9:44
1
$begingroup$
@Blue: Thank you very much:) It agrees on my understanding:) @ bof: I am sorry.
$endgroup$
– Leon1998
Dec 16 '18 at 9:49
1
$begingroup$
@Blue But the problem is more interesting if the graph is undirected. In that case I get $2^kF_{k+1}$ where the $F_n$ are Fibonacci numbers, $F_1=F_2=1$.
$endgroup$
– bof
Dec 16 '18 at 10:11
|
show 11 more comments
$begingroup$
I want to find out how many directed simple paths from $s$ to $t$ are in the following directed graph $G=(V,E)$.
$$begin{align}
V=&{s, v_1, v_2,ldots, v_n, t}, quad n=2k, k in mathbb{N} \
E=&{ (s, v_1), (s, v_2), \
&;(v_1,v_3), (v_1,v_4), (v_2,v_3),(v_2,v_4), \
&;(v_3,v_5), (v_3,v_6), (v_4,v_5), (v_4,v_6), \
&;ldots, \
&;(v_{n-5},v_{n-3}), (v_{n-5},v_{n-2}), (v_{n-4},v_{n-3}), (v_{n-4},v_{n-2}), \
&;(v_{n-3},v_{n-1}), (v_{n-3},v_{n}), (v_{n-2},v_{n-1}), (v_{n-2},v_{n}), \
&;(v_{n-1},t), (v_{n},t) }
end{align}$$
In my opinion, there are $n$ directed paths. Is that right?
combinatorics discrete-mathematics graph-theory directed-graphs
$endgroup$
I want to find out how many directed simple paths from $s$ to $t$ are in the following directed graph $G=(V,E)$.
$$begin{align}
V=&{s, v_1, v_2,ldots, v_n, t}, quad n=2k, k in mathbb{N} \
E=&{ (s, v_1), (s, v_2), \
&;(v_1,v_3), (v_1,v_4), (v_2,v_3),(v_2,v_4), \
&;(v_3,v_5), (v_3,v_6), (v_4,v_5), (v_4,v_6), \
&;ldots, \
&;(v_{n-5},v_{n-3}), (v_{n-5},v_{n-2}), (v_{n-4},v_{n-3}), (v_{n-4},v_{n-2}), \
&;(v_{n-3},v_{n-1}), (v_{n-3},v_{n}), (v_{n-2},v_{n-1}), (v_{n-2},v_{n}), \
&;(v_{n-1},t), (v_{n},t) }
end{align}$$
In my opinion, there are $n$ directed paths. Is that right?
combinatorics discrete-mathematics graph-theory directed-graphs
combinatorics discrete-mathematics graph-theory directed-graphs
edited Dec 17 '18 at 0:39
Batominovski
33k33293
33k33293
asked Dec 16 '18 at 8:59
Leon1998Leon1998
408
408
$begingroup$
According to our definition it must hold $ v_i ne v_j $for a path. Therefore the paths have to be simple paths. What do you mean by directed paths of length 0?
$endgroup$
– Leon1998
Dec 16 '18 at 9:32
$begingroup$
Ok then I get that. There are n vertices + s +t = n+2:). How do you get to 4n?
$endgroup$
– Leon1998
Dec 16 '18 at 9:42
1
$begingroup$
I forgot to mention. How many paths are from s to t. I am sorry:(
$endgroup$
– Leon1998
Dec 16 '18 at 9:44
1
$begingroup$
@Blue: Thank you very much:) It agrees on my understanding:) @ bof: I am sorry.
$endgroup$
– Leon1998
Dec 16 '18 at 9:49
1
$begingroup$
@Blue But the problem is more interesting if the graph is undirected. In that case I get $2^kF_{k+1}$ where the $F_n$ are Fibonacci numbers, $F_1=F_2=1$.
$endgroup$
– bof
Dec 16 '18 at 10:11
|
show 11 more comments
$begingroup$
According to our definition it must hold $ v_i ne v_j $for a path. Therefore the paths have to be simple paths. What do you mean by directed paths of length 0?
$endgroup$
– Leon1998
Dec 16 '18 at 9:32
$begingroup$
Ok then I get that. There are n vertices + s +t = n+2:). How do you get to 4n?
$endgroup$
– Leon1998
Dec 16 '18 at 9:42
1
$begingroup$
I forgot to mention. How many paths are from s to t. I am sorry:(
$endgroup$
– Leon1998
Dec 16 '18 at 9:44
1
$begingroup$
@Blue: Thank you very much:) It agrees on my understanding:) @ bof: I am sorry.
$endgroup$
– Leon1998
Dec 16 '18 at 9:49
1
$begingroup$
@Blue But the problem is more interesting if the graph is undirected. In that case I get $2^kF_{k+1}$ where the $F_n$ are Fibonacci numbers, $F_1=F_2=1$.
$endgroup$
– bof
Dec 16 '18 at 10:11
$begingroup$
According to our definition it must hold $ v_i ne v_j $for a path. Therefore the paths have to be simple paths. What do you mean by directed paths of length 0?
$endgroup$
– Leon1998
Dec 16 '18 at 9:32
$begingroup$
According to our definition it must hold $ v_i ne v_j $for a path. Therefore the paths have to be simple paths. What do you mean by directed paths of length 0?
$endgroup$
– Leon1998
Dec 16 '18 at 9:32
$begingroup$
Ok then I get that. There are n vertices + s +t = n+2:). How do you get to 4n?
$endgroup$
– Leon1998
Dec 16 '18 at 9:42
$begingroup$
Ok then I get that. There are n vertices + s +t = n+2:). How do you get to 4n?
$endgroup$
– Leon1998
Dec 16 '18 at 9:42
1
1
$begingroup$
I forgot to mention. How many paths are from s to t. I am sorry:(
$endgroup$
– Leon1998
Dec 16 '18 at 9:44
$begingroup$
I forgot to mention. How many paths are from s to t. I am sorry:(
$endgroup$
– Leon1998
Dec 16 '18 at 9:44
1
1
$begingroup$
@Blue: Thank you very much:) It agrees on my understanding:) @ bof: I am sorry.
$endgroup$
– Leon1998
Dec 16 '18 at 9:49
$begingroup$
@Blue: Thank you very much:) It agrees on my understanding:) @ bof: I am sorry.
$endgroup$
– Leon1998
Dec 16 '18 at 9:49
1
1
$begingroup$
@Blue But the problem is more interesting if the graph is undirected. In that case I get $2^kF_{k+1}$ where the $F_n$ are Fibonacci numbers, $F_1=F_2=1$.
$endgroup$
– bof
Dec 16 '18 at 10:11
$begingroup$
@Blue But the problem is more interesting if the graph is undirected. In that case I get $2^kF_{k+1}$ where the $F_n$ are Fibonacci numbers, $F_1=F_2=1$.
$endgroup$
– bof
Dec 16 '18 at 10:11
|
show 11 more comments
1 Answer
1
active
oldest
votes
$begingroup$
For each vertex of the graph, the level of the vertex is the length of the shortest directed path from $s$ to that vertex. So $s$ has level $0$, $v_{2l-1}$ & $v_{2l}$ have level $l$, and $t$ has level $k+1$. Note that each directed path from $s$ to $t$ much contain exactly one vertex from each level.
Let $s=u_0 to u_1 to u_2 toldots to u_k to u_{k+1}=t$ be a directed path. Note that $u_i$ has level $i$. For each $u_i$ ($0le i le k-1$), there are always two possible vertices of level $i+1$ and $(u_i,u_{i+1})$ is always a directed edge in $G$. Also there is only one choice after $u_k$. Therefore, the number of such paths is $2^k$.
I also thought about bof's proposition to consider un-directed paths. Here is a proof.
Note that for an un-directed path $s=u_0to u_1to u_2toldots to u_r to u_{r+1}=t$, there is at most one possible backward movement at each $u_i$ and if $u_{i+1}$ is obtained by a backward movement, $u_{i+1}$ must go to $u_{i+2}$ with a unique forward movement. Then, we cannot make another backward movement, so we have to perform another forward movement. Let's call such a backward-followed-by-forward-twice sequence a looping. Observe that two loopings cannot be done consecutively.
Observe also that if we are not at a vertex where a backward movement has just been performed, there are always two possible choices to move forward (unless you are at $v_{2k-1}$ or $v_{2k}$, where the only forward movement is to go to $t$). Therefore, our path can be represented by a binary sequence of length $k+1$, where $0$ is a forward movement and $1$ is a looping, such that the sequence starts with two $0$, and no two $1$ occur successively.
There are $F_{k+1}$ such binary sequences (since removing the two $0$ at the beginning, you are in the situation of this question). Here $F_k$ is the $k^text{th}$ Fibonacci number with $F_0=0$ and $F_1=1$. There are $k$ forward movements each having two choices (recalling that the final forward movement has only one possible choice). This gives you a factor $2^k$. Therefore, there are $2^kF_{k+1}$ un-directed paths from $s$ to $t$.
$endgroup$
$begingroup$
Thank you for your answer and your excellent proof:) Thank you very much:)
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
In the comments i had another question: Another question to this task would be: How much time does a computer need, who compares the length of $10^9$ different paths within a second, to find the shortest way for n=100. Would this be simply $frac{2^{100}}{10^9} $s?
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
@Leon1998 Another question? Then open a new question.
$endgroup$
– callculus
Dec 17 '18 at 0:51
$begingroup$
Now that question belongs to this subject. Otherwise it ist hard to understand.
$endgroup$
– Leon1998
Dec 17 '18 at 7:44
$begingroup$
Also, if $a_k$ is the number of paths from $s$ to $t$ in the undirected graph, then it satisfies the recurrence $a_k=2a_{k-1}+4a_{k-2}$ which we can solve directly, or else substitute $a_k=2^kb_k$, whereupon it is transformed into the Fibonacci recurrence $b_k=b_{k-1}+b_{k-2}$.
$endgroup$
– bof
Dec 17 '18 at 8:30
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%2f3042392%2fcounting-the-directed-paths-in-a-particular-directed-graph%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
For each vertex of the graph, the level of the vertex is the length of the shortest directed path from $s$ to that vertex. So $s$ has level $0$, $v_{2l-1}$ & $v_{2l}$ have level $l$, and $t$ has level $k+1$. Note that each directed path from $s$ to $t$ much contain exactly one vertex from each level.
Let $s=u_0 to u_1 to u_2 toldots to u_k to u_{k+1}=t$ be a directed path. Note that $u_i$ has level $i$. For each $u_i$ ($0le i le k-1$), there are always two possible vertices of level $i+1$ and $(u_i,u_{i+1})$ is always a directed edge in $G$. Also there is only one choice after $u_k$. Therefore, the number of such paths is $2^k$.
I also thought about bof's proposition to consider un-directed paths. Here is a proof.
Note that for an un-directed path $s=u_0to u_1to u_2toldots to u_r to u_{r+1}=t$, there is at most one possible backward movement at each $u_i$ and if $u_{i+1}$ is obtained by a backward movement, $u_{i+1}$ must go to $u_{i+2}$ with a unique forward movement. Then, we cannot make another backward movement, so we have to perform another forward movement. Let's call such a backward-followed-by-forward-twice sequence a looping. Observe that two loopings cannot be done consecutively.
Observe also that if we are not at a vertex where a backward movement has just been performed, there are always two possible choices to move forward (unless you are at $v_{2k-1}$ or $v_{2k}$, where the only forward movement is to go to $t$). Therefore, our path can be represented by a binary sequence of length $k+1$, where $0$ is a forward movement and $1$ is a looping, such that the sequence starts with two $0$, and no two $1$ occur successively.
There are $F_{k+1}$ such binary sequences (since removing the two $0$ at the beginning, you are in the situation of this question). Here $F_k$ is the $k^text{th}$ Fibonacci number with $F_0=0$ and $F_1=1$. There are $k$ forward movements each having two choices (recalling that the final forward movement has only one possible choice). This gives you a factor $2^k$. Therefore, there are $2^kF_{k+1}$ un-directed paths from $s$ to $t$.
$endgroup$
$begingroup$
Thank you for your answer and your excellent proof:) Thank you very much:)
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
In the comments i had another question: Another question to this task would be: How much time does a computer need, who compares the length of $10^9$ different paths within a second, to find the shortest way for n=100. Would this be simply $frac{2^{100}}{10^9} $s?
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
@Leon1998 Another question? Then open a new question.
$endgroup$
– callculus
Dec 17 '18 at 0:51
$begingroup$
Now that question belongs to this subject. Otherwise it ist hard to understand.
$endgroup$
– Leon1998
Dec 17 '18 at 7:44
$begingroup$
Also, if $a_k$ is the number of paths from $s$ to $t$ in the undirected graph, then it satisfies the recurrence $a_k=2a_{k-1}+4a_{k-2}$ which we can solve directly, or else substitute $a_k=2^kb_k$, whereupon it is transformed into the Fibonacci recurrence $b_k=b_{k-1}+b_{k-2}$.
$endgroup$
– bof
Dec 17 '18 at 8:30
add a comment |
$begingroup$
For each vertex of the graph, the level of the vertex is the length of the shortest directed path from $s$ to that vertex. So $s$ has level $0$, $v_{2l-1}$ & $v_{2l}$ have level $l$, and $t$ has level $k+1$. Note that each directed path from $s$ to $t$ much contain exactly one vertex from each level.
Let $s=u_0 to u_1 to u_2 toldots to u_k to u_{k+1}=t$ be a directed path. Note that $u_i$ has level $i$. For each $u_i$ ($0le i le k-1$), there are always two possible vertices of level $i+1$ and $(u_i,u_{i+1})$ is always a directed edge in $G$. Also there is only one choice after $u_k$. Therefore, the number of such paths is $2^k$.
I also thought about bof's proposition to consider un-directed paths. Here is a proof.
Note that for an un-directed path $s=u_0to u_1to u_2toldots to u_r to u_{r+1}=t$, there is at most one possible backward movement at each $u_i$ and if $u_{i+1}$ is obtained by a backward movement, $u_{i+1}$ must go to $u_{i+2}$ with a unique forward movement. Then, we cannot make another backward movement, so we have to perform another forward movement. Let's call such a backward-followed-by-forward-twice sequence a looping. Observe that two loopings cannot be done consecutively.
Observe also that if we are not at a vertex where a backward movement has just been performed, there are always two possible choices to move forward (unless you are at $v_{2k-1}$ or $v_{2k}$, where the only forward movement is to go to $t$). Therefore, our path can be represented by a binary sequence of length $k+1$, where $0$ is a forward movement and $1$ is a looping, such that the sequence starts with two $0$, and no two $1$ occur successively.
There are $F_{k+1}$ such binary sequences (since removing the two $0$ at the beginning, you are in the situation of this question). Here $F_k$ is the $k^text{th}$ Fibonacci number with $F_0=0$ and $F_1=1$. There are $k$ forward movements each having two choices (recalling that the final forward movement has only one possible choice). This gives you a factor $2^k$. Therefore, there are $2^kF_{k+1}$ un-directed paths from $s$ to $t$.
$endgroup$
$begingroup$
Thank you for your answer and your excellent proof:) Thank you very much:)
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
In the comments i had another question: Another question to this task would be: How much time does a computer need, who compares the length of $10^9$ different paths within a second, to find the shortest way for n=100. Would this be simply $frac{2^{100}}{10^9} $s?
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
@Leon1998 Another question? Then open a new question.
$endgroup$
– callculus
Dec 17 '18 at 0:51
$begingroup$
Now that question belongs to this subject. Otherwise it ist hard to understand.
$endgroup$
– Leon1998
Dec 17 '18 at 7:44
$begingroup$
Also, if $a_k$ is the number of paths from $s$ to $t$ in the undirected graph, then it satisfies the recurrence $a_k=2a_{k-1}+4a_{k-2}$ which we can solve directly, or else substitute $a_k=2^kb_k$, whereupon it is transformed into the Fibonacci recurrence $b_k=b_{k-1}+b_{k-2}$.
$endgroup$
– bof
Dec 17 '18 at 8:30
add a comment |
$begingroup$
For each vertex of the graph, the level of the vertex is the length of the shortest directed path from $s$ to that vertex. So $s$ has level $0$, $v_{2l-1}$ & $v_{2l}$ have level $l$, and $t$ has level $k+1$. Note that each directed path from $s$ to $t$ much contain exactly one vertex from each level.
Let $s=u_0 to u_1 to u_2 toldots to u_k to u_{k+1}=t$ be a directed path. Note that $u_i$ has level $i$. For each $u_i$ ($0le i le k-1$), there are always two possible vertices of level $i+1$ and $(u_i,u_{i+1})$ is always a directed edge in $G$. Also there is only one choice after $u_k$. Therefore, the number of such paths is $2^k$.
I also thought about bof's proposition to consider un-directed paths. Here is a proof.
Note that for an un-directed path $s=u_0to u_1to u_2toldots to u_r to u_{r+1}=t$, there is at most one possible backward movement at each $u_i$ and if $u_{i+1}$ is obtained by a backward movement, $u_{i+1}$ must go to $u_{i+2}$ with a unique forward movement. Then, we cannot make another backward movement, so we have to perform another forward movement. Let's call such a backward-followed-by-forward-twice sequence a looping. Observe that two loopings cannot be done consecutively.
Observe also that if we are not at a vertex where a backward movement has just been performed, there are always two possible choices to move forward (unless you are at $v_{2k-1}$ or $v_{2k}$, where the only forward movement is to go to $t$). Therefore, our path can be represented by a binary sequence of length $k+1$, where $0$ is a forward movement and $1$ is a looping, such that the sequence starts with two $0$, and no two $1$ occur successively.
There are $F_{k+1}$ such binary sequences (since removing the two $0$ at the beginning, you are in the situation of this question). Here $F_k$ is the $k^text{th}$ Fibonacci number with $F_0=0$ and $F_1=1$. There are $k$ forward movements each having two choices (recalling that the final forward movement has only one possible choice). This gives you a factor $2^k$. Therefore, there are $2^kF_{k+1}$ un-directed paths from $s$ to $t$.
$endgroup$
For each vertex of the graph, the level of the vertex is the length of the shortest directed path from $s$ to that vertex. So $s$ has level $0$, $v_{2l-1}$ & $v_{2l}$ have level $l$, and $t$ has level $k+1$. Note that each directed path from $s$ to $t$ much contain exactly one vertex from each level.
Let $s=u_0 to u_1 to u_2 toldots to u_k to u_{k+1}=t$ be a directed path. Note that $u_i$ has level $i$. For each $u_i$ ($0le i le k-1$), there are always two possible vertices of level $i+1$ and $(u_i,u_{i+1})$ is always a directed edge in $G$. Also there is only one choice after $u_k$. Therefore, the number of such paths is $2^k$.
I also thought about bof's proposition to consider un-directed paths. Here is a proof.
Note that for an un-directed path $s=u_0to u_1to u_2toldots to u_r to u_{r+1}=t$, there is at most one possible backward movement at each $u_i$ and if $u_{i+1}$ is obtained by a backward movement, $u_{i+1}$ must go to $u_{i+2}$ with a unique forward movement. Then, we cannot make another backward movement, so we have to perform another forward movement. Let's call such a backward-followed-by-forward-twice sequence a looping. Observe that two loopings cannot be done consecutively.
Observe also that if we are not at a vertex where a backward movement has just been performed, there are always two possible choices to move forward (unless you are at $v_{2k-1}$ or $v_{2k}$, where the only forward movement is to go to $t$). Therefore, our path can be represented by a binary sequence of length $k+1$, where $0$ is a forward movement and $1$ is a looping, such that the sequence starts with two $0$, and no two $1$ occur successively.
There are $F_{k+1}$ such binary sequences (since removing the two $0$ at the beginning, you are in the situation of this question). Here $F_k$ is the $k^text{th}$ Fibonacci number with $F_0=0$ and $F_1=1$. There are $k$ forward movements each having two choices (recalling that the final forward movement has only one possible choice). This gives you a factor $2^k$. Therefore, there are $2^kF_{k+1}$ un-directed paths from $s$ to $t$.
edited Dec 17 '18 at 0:45
Batominovski
33k33293
33k33293
answered Dec 16 '18 at 21:16
user614671
$begingroup$
Thank you for your answer and your excellent proof:) Thank you very much:)
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
In the comments i had another question: Another question to this task would be: How much time does a computer need, who compares the length of $10^9$ different paths within a second, to find the shortest way for n=100. Would this be simply $frac{2^{100}}{10^9} $s?
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
@Leon1998 Another question? Then open a new question.
$endgroup$
– callculus
Dec 17 '18 at 0:51
$begingroup$
Now that question belongs to this subject. Otherwise it ist hard to understand.
$endgroup$
– Leon1998
Dec 17 '18 at 7:44
$begingroup$
Also, if $a_k$ is the number of paths from $s$ to $t$ in the undirected graph, then it satisfies the recurrence $a_k=2a_{k-1}+4a_{k-2}$ which we can solve directly, or else substitute $a_k=2^kb_k$, whereupon it is transformed into the Fibonacci recurrence $b_k=b_{k-1}+b_{k-2}$.
$endgroup$
– bof
Dec 17 '18 at 8:30
add a comment |
$begingroup$
Thank you for your answer and your excellent proof:) Thank you very much:)
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
In the comments i had another question: Another question to this task would be: How much time does a computer need, who compares the length of $10^9$ different paths within a second, to find the shortest way for n=100. Would this be simply $frac{2^{100}}{10^9} $s?
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
@Leon1998 Another question? Then open a new question.
$endgroup$
– callculus
Dec 17 '18 at 0:51
$begingroup$
Now that question belongs to this subject. Otherwise it ist hard to understand.
$endgroup$
– Leon1998
Dec 17 '18 at 7:44
$begingroup$
Also, if $a_k$ is the number of paths from $s$ to $t$ in the undirected graph, then it satisfies the recurrence $a_k=2a_{k-1}+4a_{k-2}$ which we can solve directly, or else substitute $a_k=2^kb_k$, whereupon it is transformed into the Fibonacci recurrence $b_k=b_{k-1}+b_{k-2}$.
$endgroup$
– bof
Dec 17 '18 at 8:30
$begingroup$
Thank you for your answer and your excellent proof:) Thank you very much:)
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
Thank you for your answer and your excellent proof:) Thank you very much:)
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
In the comments i had another question: Another question to this task would be: How much time does a computer need, who compares the length of $10^9$ different paths within a second, to find the shortest way for n=100. Would this be simply $frac{2^{100}}{10^9} $s?
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
In the comments i had another question: Another question to this task would be: How much time does a computer need, who compares the length of $10^9$ different paths within a second, to find the shortest way for n=100. Would this be simply $frac{2^{100}}{10^9} $s?
$endgroup$
– Leon1998
Dec 16 '18 at 22:18
$begingroup$
@Leon1998 Another question? Then open a new question.
$endgroup$
– callculus
Dec 17 '18 at 0:51
$begingroup$
@Leon1998 Another question? Then open a new question.
$endgroup$
– callculus
Dec 17 '18 at 0:51
$begingroup$
Now that question belongs to this subject. Otherwise it ist hard to understand.
$endgroup$
– Leon1998
Dec 17 '18 at 7:44
$begingroup$
Now that question belongs to this subject. Otherwise it ist hard to understand.
$endgroup$
– Leon1998
Dec 17 '18 at 7:44
$begingroup$
Also, if $a_k$ is the number of paths from $s$ to $t$ in the undirected graph, then it satisfies the recurrence $a_k=2a_{k-1}+4a_{k-2}$ which we can solve directly, or else substitute $a_k=2^kb_k$, whereupon it is transformed into the Fibonacci recurrence $b_k=b_{k-1}+b_{k-2}$.
$endgroup$
– bof
Dec 17 '18 at 8:30
$begingroup$
Also, if $a_k$ is the number of paths from $s$ to $t$ in the undirected graph, then it satisfies the recurrence $a_k=2a_{k-1}+4a_{k-2}$ which we can solve directly, or else substitute $a_k=2^kb_k$, whereupon it is transformed into the Fibonacci recurrence $b_k=b_{k-1}+b_{k-2}$.
$endgroup$
– bof
Dec 17 '18 at 8:30
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%2f3042392%2fcounting-the-directed-paths-in-a-particular-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
$begingroup$
According to our definition it must hold $ v_i ne v_j $for a path. Therefore the paths have to be simple paths. What do you mean by directed paths of length 0?
$endgroup$
– Leon1998
Dec 16 '18 at 9:32
$begingroup$
Ok then I get that. There are n vertices + s +t = n+2:). How do you get to 4n?
$endgroup$
– Leon1998
Dec 16 '18 at 9:42
1
$begingroup$
I forgot to mention. How many paths are from s to t. I am sorry:(
$endgroup$
– Leon1998
Dec 16 '18 at 9:44
1
$begingroup$
@Blue: Thank you very much:) It agrees on my understanding:) @ bof: I am sorry.
$endgroup$
– Leon1998
Dec 16 '18 at 9:49
1
$begingroup$
@Blue But the problem is more interesting if the graph is undirected. In that case I get $2^kF_{k+1}$ where the $F_n$ are Fibonacci numbers, $F_1=F_2=1$.
$endgroup$
– bof
Dec 16 '18 at 10:11