Skip to main content
8 events
when toggle format what by license comment
May 10, 2017 at 16:09 comment added David G. Stork mich and @Szabolcs: OK. Now fixed.
May 10, 2017 at 16:04 history edited David G. Stork CC BY-SA 3.0
deleted 13 characters in body
May 10, 2017 at 15:59 comment added Szabolcs "Note that this code automatically and randomly selects one of the shortest paths," @David, it selects one of the shortest paths, but not randomly. Each time you run this code on the same graph and same starting and ending vertices, it returns the same shortest path. That is the problem the OP was referring to. Identifying multiple shortest paths between the same points in important in many applications, e.g. in betweenness calculations.
May 10, 2017 at 15:52 comment added David G. Stork @mich My code performs precisely what you seek. Please see addendum to solution.
May 10, 2017 at 15:50 history edited David G. Stork CC BY-SA 3.0
added 305 characters in body
May 10, 2017 at 7:31 comment added aellab Hi David, thank you for your help. Your answer almost achieves what I'm trying to do, but instead of "mynewpathsegment = FindShortestPath[g, myvertexes[[1]], myvertexes[[2]]]", I want to generate a list of all shortest paths from $v_i$ and $v_j$, then choose one shortest path among those, at random .Do you have any idea how I might accomplish that?
May 10, 2017 at 1:26 history edited David G. Stork CC BY-SA 3.0
added 142 characters in body
May 10, 2017 at 0:20 history answered David G. Stork CC BY-SA 3.0