IncidenceMatrix

IncidenceMatrix[g]
gives the vertex-edge incidence matrix of the graph g.

DetailsDetails

  • IncidenceMatrix returns a SparseArray object, which can be converted to an ordinary matrix using Normal.
  • The incidence matrix for a graph with vertices and edges is an matrix with entries given by:
  • 0 is not incident to
    1, , or
    -1
    2
    -2
  • 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].

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

The incidence matrix of an undirected graph:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//MatrixForm=

The incidence matrix of a directed graph:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//MatrixForm=
Introduced in 2010
(8.0)