The on-line documentation for FindShortestPathTree (part of the Combinatorica package) says:
"ShortestPathSpanningTree has been superseded by FindSpanningTree"
I don't understand how to use FindSpanningTree to construct the tree of shortest paths from a given vertex in a directed graph.
Consider the small exanple:
smallgraph =
Graph[{DirectedEdge[1, 2],
DirectedEdge[2, 3],
DirectedEdge[1, 4],
DirectedEdge[4, 3]},
EdgeWeight -> {1, 1, 2, 1},
VertexLabels -> "Name", EdgeLabels -> "EdgeWeight"]
The tree of shortest paths from vertex 1 in this graph is
Graph[{DirectedEdge[1, 2],
DirectedEdge[2, 3],
DirectedEdge[1, 4]},
EdgeWeight -> {1, 1, 2},
VertexLabels -> "Name", EdgeLabels -> "EdgeWeight"]
That's not what FindSpanningTree produces.
FindSpanningTree[{smallgraph,1},EdgeWeight -> {1, 1, 2, 1}]
yields
fstree =
Graph[{DirectedEdge[1, 2],
DirectedEdge[1, 4],
DirectedEdge[4, 3]},
EdgeWeight -> {1, 1, 2, 1},
VertexLabels -> "Name", EdgeLabels -> "EdgeWeight"]
How to use FindSpanningTree to construct a tree of shortest paths? Is ShortestPathSpanningTree truly superseded by FindSpanningTree?
FindSpanningTree
. The graph produces byFindSpanningTree[smallgraph]
has the same total weight as the one that you propose. $\endgroup$