Re: Is this a bug in the Adjacency Matrix function? Using 8.9.4.0
- To: mathgroup at smc.vnet.net
- Subject: [mg123981] Re: Is this a bug in the Adjacency Matrix function? Using 8.9.4.0
- From: Heike Gramberg <heike.gramberg at gmail.com>
- Date: Wed, 4 Jan 2012 04:59:41 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201201031029.FAA20259@smc.vnet.net>
VertexList[testgraph] returns {1, 3, 2, 4, 5, 6, 7}, so the second row and column in the adjacency list corresponds to the vertex with label 3, and vice versa. If you want to make sure that the vertices are in the right order, you could do something like testgraph = Graph[ Range[7], #[[1]] \[DirectedEdge] #[[2]] & /@ {{1, 3}, {2, 3}, {3, 4}, {3, 5}, {4, 6}, {4, 7}, {5, 7}, {6, 7}}, VertexLabels -> "Name", ImagePadding -> 10] Heike On 3 Jan 2012, at 11:29, Richard Palmer wrote: > testgraph=Graph[#[[1]]\[DirectedEdge]#[[2]]&/@{{1,3},{2,3},{3,4},{3,5},{4,6},{4,7},{5,7},{6,7}}, > VertexLabels->"Name", > ImagePadding->10] > > > MatrixForm[AdjacencyMatrix[testgraph], > TableHeadings -> {Range[7], Range[7]}] > > > The Adjacency Matrix appears to be incorrect, e.g. 1 is not adjacent to 2. > What am I missing?
- References:
- Is this a bug in the Adjacency Matrix function? Using 8.9.4.0
- From: Richard Palmer <rhpalmer@gmail.com>
- Is this a bug in the Adjacency Matrix function? Using 8.9.4.0