Graphs

A list is a collection of nodes such that:

  1. each node has a unique predecessor (except the 1st node)
  2. each node has a unique successor (except the last node)

A tree has (1) but not (2); a graph has neither.

A Graph is a collection of nodes and edges.

Directed Graph: the edges have direction.

Undirected Graph: the edges are two way.

Weighted Graph: each edge has a weight.

        

Subgraph: a subset of nodes and a subset of edges involving those nodes.