In which kinds of systems do graphs appear, and what are the vertices and edges in each?
Wherever things are linked: electronic circuits (components joined by wires), transport networks (junctions or airports joined by roads or flights), computer networks (hosts and routers joined by links, web pages joined by hyperlinks) and databases (entities joined by relationships in an entity-relationship diagram).
| System | Vertices | Edges | Directed? |
|---|---|---|---|
| Circuit board, integrated circuit | components, pins | conductor tracks, wires | no |
| Road network | junctions, towns | road sections | no, except one-way streets |
| Flight network | airports | routes, or individual flights | routes no, flights yes |
| Computer network (LAN, Internet) | hosts, switches, routers | cables and links | usually no |
| World Wide Web | pages | hyperlinks | yes |
| Entity-relationship diagram | entities | relationships | no |
| UML class diagram | classes | associations, inheritance and implementation arrows | yes |
| Objects of a running program | objects | references between objects | yes |
The last row is at work in every Java or Python program. The objects on the heap and the references between them form the object graph, and a garbage collector frees memory by searching it: starting from the references held by the running methods, it marks every object it can reach and deletes all objects it could not reach.
The point of seeing all of them as graphs is that the same algorithms then answer questions in every one of them: what is the shortest route, is everything still connected if one link fails, which parts form separate clusters, in which order can dependent tasks run.
Go deeper:
Graph theory: applications — graphs in computer science, linguistics, physics, chemistry, biology and the social sciences.