Directed Versus Undirected Graphs


Undirected graph
(no arrows)

One of the key distinctions people make between graphs is whether they are directed or undirected. I'll admit, when I see the phrase "undirected graph," I sometimes get a mental image of a subway system map just sitting there aimlessly on the couch while its parents ask when it's going to take responsibility and do something with its life...


Directed graph
(note the arrows)

...but that's just me. Really, all we're saying is whether the edges in a graph are bidirectional or not.

Most, but not all, graphs I've seen have only one kind of edge. There are a few cases where you might want to use both—for example, a street map might have undirected edges for two-way streets and directed edges for one-way streets—but that's the only example I can think of off the top of my head.