SOLUTIONS

Mathematica
>
Mathematics and Algorithms
>
Graphs & Networks
>
Constructing Graphs
>
Graphs and Matrices
>
IncidenceMatrix
BUILTIN MATHEMATICA SYMBOL
IncidenceMatrix
IncidenceMatrix[g]
gives the vertexedge incidence matrix of the graph g.
DetailsDetails
 IncidenceMatrix returns a SparseArray object, which can be converted to an ordinary matrix using Normal.
 For an undirected graph, an entry of the incidence matrix is given by:

0 vertex is not incident to edge 1 vertex is incident to edge 2 vertex is incident to edge and a selfloop  For a directed graph, an entry of the incidence matrix is given by:

0 vertex is not incident to edge 1 vertex is incident to edge and is the head of 1 vertex is incident to edge and is the tail of 2 vertex is incident to edge and a selfloop  The vertices are assumed to be in the order given by VertexList[g] and the edges are assumed to be in the order given by EdgeList[g].
 The incidence matrix for a graph will have an × matrix, where is the number of vertices and is the number of edges, counting multiplicity.
New in 8
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »