3.5.1 · D1Graphs

Foundations — Graph definitions — directed, undirected, weighted, unweighted, simple, multigraph

1,821 words8 min readBack to topic

This page assumes nothing. Before you touch the parent note, we build every symbol it uses — one at a time, each anchored to a picture — so that when you meet , , or , no symbol is a stranger.


Symbol 0 — A "set" and how we write it

Everything in graphs is built from sets, so we start there.

The picture: think of a shopping bag with three fruits in it. It doesn't matter which fruit you put in first, and you can't have "the same apple twice" — it's just in the bag or not.

Why the topic needs it: a graph is a pair of sets — one bag of dots, one bag of lines. Everything else is decoration on top of these two bags.


Symbol 1 — Vertices, and the dot picture

The picture — three dots, nothing joining them yet:

Figure — Graph definitions — directed, undirected, weighted, unweighted, simple, multigraph

Look at the figure: three lavender dots labelled , , . The bag holding them is written . That's all a vertex is — a labelled point.

Why the topic needs it: vertices are the things being connected. Friends, cities, web pages — whatever your real problem is, each "thing" becomes one dot.


Symbol 2 — The size bars and the letter

The picture: just count the dots. In the figure above, , so .

Why the topic needs it: almost every formula ("max edges", "how slow is this algorithm?") is written in terms of , so we need a name for "how many dots."


Symbol 3 — A pair, ordered vs unordered

This is the single most important distinction on the whole page, so we build it slowly.

The picture — a plain line vs an arrow:

Figure — Graph definitions — directed, undirected, weighted, unweighted, simple, multigraph

On the left, a plain mint line between and : no head, so you can't tell "which direction" — that is the unordered pair . On the right, a coral arrow from to : the head marks a direction, so and are genuinely different pictures.

Why the topic needs it: an edge is a pair of vertices. Whether it's ordered or unordered is precisely what makes a graph directed or undirected.


Symbol 4 — Edges, and the set ; the letter

The picture — take the three dots and actually connect two of them:

Figure — Graph definitions — directed, undirected, weighted, unweighted, simple, multigraph

Here we drew one line between and . So (a bag holding a single unordered pair), and .

Why the topic needs it: edges are the relationships. Without them you just have loose dots; the whole point of a graph is which dots are connected.


Symbol 5 — The graph itself,

Now we can read the master notation.

The picture: the whole drawing (all dots + all lines) is . The two bags and together describe it completely.

Why the topic needs it: this is the definition the parent note opens with. Everything after it — directed, weighted, simple — is just a rule about what's allowed to live inside .


Symbol 6 — Weight, the function

The picture: imagine each line has a little tag pinned to it, like "\4001$).

Why the topic needs it: "how many hops?" ignores weight; "cheapest route?" needs it. The weight is what separates a BFS problem from a Dijkstra problem.


Symbol 7 — Degree, and the sum symbol

The picture — stand on one dot and count the lines leaving it:

Figure — Graph definitions — directed, undirected, weighted, unweighted, simple, multigraph

In this figure, (two lines leave ), , , . Notice each line got counted once at each of its two ends.

Why the topic needs it: the Handshaking Lemma (see Handshaking lemma and degree sequences) says this total is always twice the number of edges — because every edge, having two ends, is counted twice. In our figure , and indeed . ✓


Symbol 8 — " choose ", the notation

Why that formula, step by step:

The picture: every possible unordered pair of distinct dots is one possible line. Counting them = counting the most lines a simple undirected graph can have.

Why the topic needs it: this is exactly the "maximum edges" formula, and it's the size of the complete graph $K_n$.


How these foundations feed the topic

set braces and order

ordered pair vs unordered pair

vertex set V and n

edge set E and m

graph G equals V and E

directed vs undirected

weight w on an edge

degree of a vertex

summation and handshake sum equals 2m

n choose 2 max edges

Graph definitions topic


Where these lead next

Once the symbols above feel automatic, the natural next stops are: storing a graph in memory via Graph representations — adjacency list vs matrix, walking it hop-by-hop with BFS — breadth first search, finding cheapest paths with Dijkstra's algorithm, ordering dependencies with Topological sort, and the special "no-cycle" graphs called Trees as special graphs.


Equipment checklist

Test yourself — each line reveals the answer.

I can write a set of three items using braces
— a collection, no order, no repeats.
and mean
the number of vertices (dots) in the graph.
The difference between and
braces = unordered (same as ); round brackets = ordered (a from then a to, so ).
An edge is
a line joining a pair of vertices; the set of all edges is , and .
Reading aloud
"the graph made of vertex-set and edge-set ."
means
the weight (number/cost) carried by the edge between and .
means
how many edge-ends touch vertex (a self-loop counts ).
means
add over every vertex in ; it always equals .
equals
— the number of unordered pairs of distinct vertices.