3.5.3 · D2Graphs

Visual walkthrough — Incidence matrix

1,924 words9 min readBack to topic

We build everything from zero. If a word or symbol shows up, it gets a picture first.


Step 1 — Start with dots and lines (nothing else)

WHAT. A graph is a collection of dots and lines that join two dots. The dots are called vertices (one of them is a vertex). The lines are called edges. That is the whole object — there are no numbers yet.

WHY. A computer cannot store a picture. It stores numbers in a grid. So our real goal is: turn this drawing into a rectangle of numbers without losing any information about who-connects-to-whom. Before we can encode a thing we must name its parts, so we name them here.

PICTURE. Three vertices labelled and three edges labelled . Look at the amber labels on the edges — each edge is a thing with a name, exactly like each vertex is.

Figure — Incidence matrix

Step 2 — Ask ONE question per (dot, line) pair

WHAT. We invent a grid. Down the left side we write the vertices (rows). Across the top we write the edges (columns). For every box in this grid we ask one yes/no question:

“Does this vertex touch this edge?” (Is this dot one of the two ends of this line?)

WHY. Notice the question relates a vertex to an edge — two different kinds of thing. That is the key design choice. The adjacency matrix relates vertex-to-vertex; here we relate vertex-to-edge. Because we ask the question once per (vertex, edge) pair, the grid must have one row per vertex and one column per edge.

PICTURE. The empty register: rows are vertices, columns are edges, every cell is a waiting question mark. The cyan arrow shows the single question we drop into each box.

Figure — Incidence matrix

Step 3 — Fill one column by looking at one edge

WHAT. Take a single column, say the column of edge . Edge joins vertices and . So in that column we write a in row and a in row , and everywhere else.

WHY. A line has exactly two ends. The two ends are the only vertices that "touch" this edge. Every other vertex answers "no" . This is why a column can never have three 's: an edge simply cannot have three ends.

PICTURE. Edge glowing amber, with two cyan arrows shooting up into the cells and , each dropping a .

Figure — Incidence matrix

Step 4 — Repeat for every column: the full undirected matrix

WHAT. Do Step 3 for and too. Each edge fills its own column with exactly two 's.

WHY. The grid is finished the moment every edge (column) has answered. No memorisation happened — we just scanned each line and marked its two ends.

PICTURE. The completed triangle matrix, with each column colour-linked back to its edge in the graph so you can trace where every came from.

Figure — Incidence matrix

The matrix we just grew:

  • Column has 's in rows → edge joins vertices . ✔
  • Column has 's in rows → edge joins vertices . ✔
  • Column has 's in rows → edge joins vertices . ✔

Step 5 — Read the rows: degree appears for free

WHAT. Add up the numbers along a single row. Row is . That total equals the degree of vertex — the number of edges sticking out of it.

WHY. A row has a in the column of every edge that touches that vertex. So counting the 's in a row is literally counting the edges at that vertex. Counting edges at a vertex is the definition of degree (Degree of a vertex).

PICTURE. Row highlighted; two amber arrows point at its two 's and merge into the label .

Figure — Incidence matrix

Step 6 — Count the marks two ways: the Handshake Lemma

WHAT. Count all the 's in the whole matrix in two different ways.

  • By columns: every column has exactly marks, and there are columns → marks.
  • By rows: each row sums to , so the grand total is .

Both count the same marks, so they must be equal:

WHY. This is the Handshake Lemma, and the incidence matrix proves it just by counting the same dots two ways. No cleverness — the grid does the work.

PICTURE. The matrix with a cyan bracket under it labelled "count by columns " and an amber bracket beside it labelled "count by rows ", both pointing at the same field of 's.

Figure — Incidence matrix

Step 7 — Add direction: signs are born

WHAT. Now give every edge an arrow (a direction). The end the arrow leaves is the tail; the end it enters is the head. We change the rule: put in the tail's row and in the head's row.

WHY. With plain 's we cannot tell from — direction is lost. The minus sign records "the arrow left here"; the plus sign records "the arrow arrived here." Now the number's sign carries the direction.

PICTURE. Edge drawn as an arrow from to ; a red drops into cell (tail) and a cyan into cell (head).

Figure — Incidence matrix

Directed triangle ():

Every column now sums to : each edge has one (tail) and one (head) that cancel. That vanishing sum is exactly what makes the Graph Laplacian work. In symbols , where is the column of all-ones.


Step 8 — The degenerate case: a self-loop

WHAT. A self-loop is an edge that starts and ends at the same vertex (an edge ). In the undirected matrix its column holds a single in that vertex's row.

WHY. A loop touches vertex with both of its ends. Each end contributes to the touch-count, so together they contribute . This keeps the "row sum = degree" rule honest: a loop adds to a vertex's degree, so it must add in the matrix. (For directed graphs the tail and head land in the same cell and cancel to , which is why loops are treated separately — they carry no orientation information.)

PICTURE. A single vertex with a lasso-shaped loop; both ends of the lasso point back into cell , stacking to a .

Figure — Incidence matrix

The one-picture summary

Everything above, compressed: a graph on the left, the register in the middle, and the two readings (columns give edges & ; rows give degree) fanning out on the right — undirected on top, directed (with signs) on the bottom.

Figure — Incidence matrix
Recall Feynman retelling — the whole walk in plain words

I drew some dots and some lines. I made a grid: names down the side, lines across the top. For each box I asked one dumb question — "is this dot an end of this line?" — and wrote for yes, for no. Because a line always has exactly two ends, every column got exactly two 's. When I added up a row I was secretly counting the lines at that dot — that's its degree. Counting all the 's by columns gave ; counting them by rows gave the sum of degrees; same marks, so — the Handshake Lemma, for free. Then I put arrows on the lines and swapped one for (where the arrow leaves) so direction wasn't lost; now every column cancels to , which is the seed of the Laplacian. The only oddball is a line from a dot to itself — it touches that dot twice, so it writes a . That grid of numbers is the incidence matrix, and I never memorised a formula — I just watched it grow.


Connections

  • Incidence matrix — the parent note (rules & worked examples).
  • 3.5.03 Incidence matrix (Hinglish) — same ideas in Hinglish.
  • Adjacency matrix — the vertex-to-vertex alternative.
  • Graph Laplacian, built from Step 7's signed matrix.
  • Degree of a vertex — the row sum of Step 5.
  • Handshake Lemma — the two-way count of Step 6.
  • Sparse graph representations — how huge matrices are stored compactly.