Solution:
First, for each vertex, record the count of the minimal length paths.
Initialize this count to 1 for the start vertex. Second, when a new
shortest path to vertex w is found, which passes through vertex
v, the count for w should be set equal to the count for v.
Third, if a new, but equal length path to vertex w is found, which
passes through vertex v, the count for v should be added to the
count for w. These are the only changes necessary.
Solution:
count
. Initialize count
to 0
for the start vertex.
w.count = v.count+1
.
v.count < w.count-1
. Set w.count = v.count+1
.
Solution:
Here are the six different possibilities:
6, 5, 4, 2, 7, 3, 1
6, 5, 4, 7, 2, 3, 1
6, 5, 4, 7, 3, 2, 1
6, 5, 7, 3, 4, 2, 1
6, 5, 7, 4, 3, 2, 1
6, 5, 7, 4, 2, 3, 1
Solution:
Any directed acyclic graph where there is a single path joining all the
vertices. There may be more edges, as long as they don't form a
cycle. Thus, it is not enough to say that the graph is a chain of edges.