GraphTheory
IncidenceMatrix
construct incidence matrix
Calling Sequence
Parameters
Description
Examples
IncidenceMatrix(G)
IncidenceMatrix(G, reverse)
G
-
graph
reverse
(literal) reverse the sign convention for digraphs
IncidenceMatrix(G) returns the incidence matrix of a graph G whose rows are indexed by the vertices and columns by the edges of G. The order of the edges is defined by Edges(G).
If G is undirected the entry i,j of this 0,1-matrix is 1 iff vertex i is incident to edge j.
If G is directed the entry i,j of this −1,0,1-matrix is 1 iff vertex i is the head of arc j and −1 iff vertex i is the tail of arc j.
If G is directed and reverse is specified, the entry i,j of this −1,0,1-matrix is −1 iff vertex i is the head of arc j and 1 iff vertex i is the tail of arc j.
with⁡GraphTheory:
G≔CompleteGraph⁡4
G≔Graph 1: an undirected graph with 4 vertices and 6 edge(s)
Edges⁡G
1,2,1,3,1,4,2,3,2,4,3,4
IncidenceMatrix⁡G
111000100110010101001011
DG≔Digraph⁡Trail⁡1,2,3,4,5,3,Trail⁡1,5,2,4,1
DG≔Graph 2: a directed graph with 5 vertices and 9 arc(s)
Edges⁡DG
1,2,1,5,2,3,2,4,3,4,4,1,4,5,5,2,5,3
IncidenceMatrix⁡DG
−1−1000100010−1−1000100010−1000100011−1−1000100001−1−1
IncidenceMatrix⁡DG,reverse
11000−1000−1011000−1000−101000−1000−1−111000−10000−111
See Also
AdjacencyMatrix
Degree
IncidentEdges
Neighbors
Trail
Download Help Document