Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7564
| From | Szabolcs <szhorvat@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Is this a bug in the Adjacency Matrix function? Using 8.9.4.0 |
| Date | 2012-01-04 10:06 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <je18bv$3d8$1@smc.vnet.net> (permalink) |
| References | <jdulgc$jr3$1@smc.vnet.net> |
On Tuesday, 3 January 2012 11:32:44 UTC+1, 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?
Writing an adjacency matrix assumes an ordering of vertices. In Mathematica this is not a simple lexicographic ordering, but the ordering is the same as that returned by VertexList.
The correct code to show the adjacency matrix is
MatrixForm[AdjacencyMatrix[testgraph],
TableHeadings -> {VertexList[testgraph], VertexList[testgraph]}]
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
Is this a bug in the Adjacency Matrix function? Using 8.9.4.0 Richard Palmer <rhpalmer@gmail.com> - 2012-01-03 10:32 +0000 Re: Is this a bug in the Adjacency Matrix function? Using 8.9.4.0 Szabolcs <szhorvat@gmail.com> - 2012-01-04 10:06 +0000
csiph-web