construct incidence matrix
(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.
G ≔ CompleteGraph⁡4
G≔Graph 1: an undirected graph with 4 vertices and 6 edge(s)
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)
Download Help Document