BUILT-IN MATHEMATICA SYMBOL

# IncidenceMatrix

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.
• 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 self-loop
• 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 self-loop
• 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.

## ExamplesExamplesopen allclose all

### Basic Examples (2)Basic Examples (2)

The incidence matrix of an undirected graph:

 Out[1]=
 Out[2]//MatrixForm=

The incidence matrix of a directed graph:

 Out[1]=
 Out[2]//MatrixForm=