Network::shortPathTo
--
shortest paths to one single node
finds the
shortest paths in the network Network::shortPathTo
(G, v)G
ending at node
v
.
Network::shortPathTo(G,v <, w> <, Length> <, Path>)
G |
- | network |
v, w |
- | nodes in the network |
Length |
- | include table of path lengths; default if Path not given |
a number, a table or a sequence of two tables
Network::shortPathTo
(G, v)
returns a
table with the length of shortest paths to v
from all
other nodes in the network with respect to the edge weight.Network::shortPathTo
(G, v, w)
gives the
length of a shortest path from w
to v
.>> V := [1,2,3,4,5]: Vw := [25,0,0,0,-25]: Ed := [[1,2], [1,3], [2,3], [2,4], [3,4], [3,5], [4,5]]: Ew := [7, 6, 5, 4, 2, 2, 1]: Ecap := [30, 20, 25, 10, 20, 25, 20]: N1 := Network(V,Ed,Eweight=Ew, Capacity=Ecap, Vweight=Vw):
>> Network::shortPathTo(N1, 5)
table( 5 = 0, 4 = 1, 3 = 2, 2 = 5, 1 = 8 )
>> Network::shortPathTo(N1, 5, Path)
table( 4 = [4, 5], 3 = [3, 5], 2 = [2, 4, 5], 1 = [1, 3, 5] )
Network::ShortPathTo