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 talk about undirected graphs, I sometimes get a mental image of a subway system map just sitting there aimlessly on the couch while its parents just sigh and 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 downtown—but that's the only example I can think of off the top of my head.