Relationship between vertices and indices with GraphDistanceMatrix
- To: mathgroup at smc.vnet.net
- Subject: [mg111500] Relationship between vertices and indices with GraphDistanceMatrix
- From: "Jon Harrop" <usenet at ffconsultancy.com>
- Date: Tue, 3 Aug 2010 06:40:25 -0400 (EDT)
Given a graph represented as edges between vertices, such as the following: g = {"1" -> "2", "1" -> "10", "1" -> "11", "2" -> "3", "2" -> "18", "3" -> "4", "3" -> "12", "4" -> "5", "4" -> "19", "5" -> "6", "5" -> "13", "6" -> "7", "6" -> "20", "7" -> "8", "7" -> "14", "8" -> "9", "8" -> "16", "9" -> "10", "9" -> "15", "10" -> "17", "11" -> "15", "11" -> "12", "12" -> "13", "13" -> "14", "14" -> "15", "16" -> "20", "16" -> "17", "17" -> "18", "18" -> "19", "19" -> "20"} You can use GraphDistanceMatrix to compute the all-pairs shortest paths as a matrix. However, without knowledge of the mapping from vertex names to indices in the resulting matrix, the output is useless. So how are you supposed to use this function? -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com