Search⌘ K
AI Features

Graph Terminology II

Explore fundamental graph concepts such as cycles, reachability, and connectivity. Understand the difference between undirected and directed graphs, learn about strong and weak connectivity, and grasp how shortest paths determine distances between nodes.

We'll cover the following...

Cycles

A cycle is similar to a path, except that its first and last nodes are identical. In other words, a cycle is like a path that loops back into itself.

The following example graph shows the cycle acdaa \to c \to d \to a marked in blue.

g a a c c a->c b b a->b d d c->d d->a d->b
A cycle with three edges.

In an undirected graph, a single edge between nodes uu and vv consists of the two “half-edges” (u,v)(u, v) and (v,u)(v, u). However, the walk uvuu \to v \to u, forward and backward along the edge is not considered a cycle.

In general, in an undirected cycle, each undirected edge may only be traversed once. This also means that an undirected cycle needs to be at least of length three, while a directed cycle can be of length two.

g a a b b a->b b->a u u v v u->v
Left: A two node cycle in a directed graph. Right: a single undirected edge is not a cycle.

A graph that contains at least one cycle is called cyclic, and a graph that does not contain any cycle is called acyclic.

Reachability

If there is a path from node ...