Re: All pairs shortest paths
- To: mathgroup at smc.vnet.net
- Subject: [mg111283] Re: All pairs shortest paths
- From: Murta <rodrigomurtax at gmail.com>
- Date: Mon, 26 Jul 2010 06:37:36 -0400 (EDT)
- References: <i2eaij$q7d$1@smc.vnet.net>
Try the Graph Utilities Package. There are some commands that can help. GraphDistance[g,start,end] give the distance from vertex i to vertex j in the graph g GraphPath[g,start,end] find a shortest path between vertices start and end in graph g GraphDistanceMatrix[g] give a matrix in which the (i,j)\[Null]^th entry is the length of a shortest path in g between vertices i and j GraphDistanceMatrix[g,Parent] return a three-dimensional matrix in which the (1,i,j)\[Null]^th entry is the length of a shortest path from i to j and the (2,i,j)\[Null]^th entry is the predecessor of j in a shortest path from i to j. Regards Murta On Jul 24, 6:08 am, "Jon Harrop" <use... at ffconsultancy.com> wrote: > How do you obtain the all-pairs shortest paths of a graph in Mathematica? > i.e. the paths themselves and not just their lengths. > > -- > Dr Jon Harrop, Flying Frog Consultancy Ltd.http://www.ffconsultancy.com