Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Build graph from incidency matrix' topicStudent Support Forum > General > Archives > "Build graph from incidency matrix"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Peter Pein
11/01/12 4:51pm

Hi Anton,

with
a = {{0, 1, 1, 0, 0, 0, 1, 0, 0},
{1, 0, 1, 0, 1, 0, 0, 1, 0},
{1, 1, 0, 0, 0, 1, 0, 0, 1},
{0, 0, 0, 0, 0, 1, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0, 1, 0},
{0, 0, 1, 1, 1, 0, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 1, 1},
{0, 1, 0, 0, 1, 0, 1, 0, 1},
{0, 0, 1, 0, 0, 1, 1, 1, 0}};

you do not have an incidence matrix, because

Plus @@@ Transpose[a]
{3, 4, 4, 1, 3, 4, 3, 4, 4}

shows us there would be edges with three or more vertices attached to them.

I guess, you've got an adjacency matrix:

GraphPlot[g = AdjacencyGraph[Range@Length@a, a],
VertexLabeling -> True]

gives a well defined graph and the incidence matrix has got two ones per column as it should have(try: Plus @@@ Transpose[IncidenceMatrix[g]]).

hth,
Peter

URL: ,

Subject (listing for 'Build graph from incidency matrix')
Author Date Posted
Build graph from incidency matrix Anton 10/26/12 09:46am
Re: Build graph from incidency matrix Peter Pein 11/01/12 4:51pm
Re: Build graph from incidency matrix Anton 11/08/12 05:18am
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic