Skip to content

IncidenceMatrix ​

The vertex-by-edge incidence matrix of a Graph.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageIncidenceMatrix!
IncidenceMatrix(g)row = vertex (in VertexList order), column = edge (in EdgeList order). An undirected edge puts 1 in both its endpoints' rows; a directed edge puts -1 at its source and 1 at its target.
Typed signatures
TypePackageApplies
(value) -> list<list<integer>>combinatoricsalways

Domain: Collections

Details
  • Returned as a plain matrix (a list of lists), same convention as AdjacencyMatrix.

Examples

Basic #

One undirected edge, one directed edge

live ↗
InIncidenceMatrix(Graph([1,2,3],[UndirectedEdge(1,2),DirectedEdge(2,3)]))\mathrm{IncidenceMatrix}(\mathrm{Graph}(\bigl\lbrack1, 2, 3\bigr\rbrack, \bigl\lbrack\mathrm{UndirectedEdge}(1, 2), \mathrm{DirectedEdge}(2, 3)\bigr\rbrack))Out[[1,0],[1,−1],[0,1]]\bigl\lbrack\bigl\lbrack1, 0\bigr\rbrack, \bigl\lbrack1, -1\bigr\rbrack, \bigl\lbrack0, 1\bigr\rbrack\bigr\rbrack
About
Examples1
Checked againstWolfram Language 1 differ
CrosswalkWolfram Language

See also: AdjacencyMatrix, EdgeList