A
Almost every question you can ask of a network is secretly a movement question. Can this message reach that server? How many handshakes separate two strangers? Is there a tour of the city that crosses every bridge exactly once? Each is answered by tracing routes across edges. So we need precise words for the different kinds of route — because "a route" turns out to mean four subtly different things.
Imagine walking through a network of friendships: each step takes you from one person to a friend of theirs. Depending on the rules you impose on that stroll, it gets a different name.
Every path is a trail, and every trail is a walk — the words get stricter as you go down the
list. The length of any of these is simply the number of edges you
step across (not the number of vertices). A path visiting five vertices, for instance,
Below is a little friendship graph. Step through to trace the route
Compare that with the walk
A cycle is what you get when a path bites its own tail. Trace
Here is a fact worth memorising, because it is the single most confused count in graph theory: a
path on
Now the payoff. A graph is connected if there is a path between every pair of vertices — you can get from anywhere to anywhere by walking along edges. If some pair has no route between them, the graph is disconnected, and it falls apart into connected components: the separate islands, each connected inside itself but with no edges bridging to the others.
The graph above has two connected components. You can walk freely within the left triangle, and freely within the right cluster, but no walk — of any length, however winding — crosses the gap between them. A connected graph is exactly a graph with one component.
Once you can move, you can measure. The distance between two vertices is the length of
the shortest path connecting them — the fewest edges you must cross to get from one to the
other. A vertex is at distance
The famous claim of "six degrees of separation" says that any two people on the planet are joined by a chain of at most six acquaintances. In our language: build the giant graph whose vertices are all humans and whose edges are "knows personally", and the distance between almost any two vertices is surprisingly small — around six. Huge networks with a few long-range links have startlingly short paths; mathematicians call these small-world graphs.
Mathematicians play their own version. Your Erdős number is your distance, in the
"co-authored a paper with" graph, to the wildly prolific Paul Erdős. Erdős himself is
The classic slip is treating walk, trail and path as synonyms. They are not — they are a ladder of increasing strictness. A walk may repeat anything. A trail bans repeated edges. A path bans repeated vertices. Keep the test in mind: repeated a street? Then it is at most a walk. Repeated a place (but no street)? A trail, not a path.
The other trap: connected does not mean complete. "Connected" only asks that some path links each pair of vertices — a single long chain of vertices is connected even though most pairs are not directly joined. "Complete" is the far stronger demand that every pair share a direct edge. Every complete graph is connected, but the reverse is wildly false.
Suppose a message is relayed along the route
But this walk does prove something useful: since a walk exists from