Attaching Labels to Edges

Just as we can label the nodes in a graph, we can also attach information to the edges. This might include:

  • Names—for example, "12th Avenue".
  • Numbers (also called "weights")—like distances or speeds.
  • Types—to denote relationships, like "friend" or "coworker" or "parent of".
  • Direction—in the previous example, relationships like "friend" and "coworker" are bidirectional, but "parent of" only goes one way (unless, possibly, you're a character in a Robert A. Heinlein novel).

A social network. Quick, someone give me $50 million in venture capital!

In fact, that last point about directionality is so important that it deserves its own page.