We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Graph Review

When an algorithm traverses a graph, it typically moves across the edges.

Common Use Cases

Use CaseVertexEdge
Social NetworksUserConnection
Road MapsLocationRoad
NetworksComputerCable
Game DevTilePath
AI DecisionStateAction

Properties

  • Graphs can have any number of vertices.

  • Unlike trees, graphs don't need a root (a single top vertex that every other vertex descends from).

  • An undirected graph can have up to n(n - 1)/2 edges for n vertices.

  • Vertices can exist without edges but may be disconnected (and thus kinda useless)

  • Typically graphs (with the exception of multigraphs) can only have a single edge between two vertices

  • Weighted graphs assign values (costs) to edges (we'll cover this in a future course)