Understanding Incidence and Adjacency Matrices for Directed and Weighted Graphs
This article explains how to construct incidence and adjacency matrices for both undirected and directed graphs, covering unweighted and weighted cases, and clarifies the matrix entries that indicate edge connections, directionality, and edge weights.
1 Incidence Matrix
For an undirected graph G, the incidence matrix B is defined such that B[i][j] = 1 if vertex i is incident to edge j, otherwise 0.
For a directed graph G, the incidence matrix B is defined as B[i][j] = 1 if vertex i is the tail (starting point) of edge j, B[i][j] = -1 if vertex i is the head (ending point) of edge j, and 0 otherwise.
2 Adjacency Matrix
For an undirected unweighted graph G with n vertices, the adjacency matrix A is an n×n matrix where A[i][j] = 1 if vertices i and j are adjacent, otherwise 0.
For a directed unweighted graph, the adjacency matrix A is defined such that A[i][j] = 1 if there is an edge from vertex i to vertex j, otherwise 0.
For an undirected weighted graph, the adjacency matrix A contains the edge weight w(i,j) at A[i][j] when an edge exists; if no edge exists, the entry can be 0 or a special value (e.g., ∞) depending on the algorithm.
The adjacency matrix for a directed weighted graph is defined analogously, with A[i][j] equal to the weight of the edge from i to j, and 0 or a sentinel value when no such edge exists.
Reference
Python数学实验与建模 / 司守奎, 孙玺菁, 科学出版社
Model Perspective
Insights, knowledge, and enjoyment from a mathematical modeling researcher and educator. Hosted by Haihua Wang, a modeling instructor and author of "Clever Use of Chat for Mathematical Modeling", "Modeling: The Mathematics of Thinking", "Mathematical Modeling Practice: A Hands‑On Guide to Competitions", and co‑author of "Mathematical Modeling: Teaching Design and Cases".
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.