DiGraph Definitions Adjacency Matrix Adjacency List Directed Graphs DiGraph Definitions Adjacency Matrix Adjacency List 4/15/2019 CS 303 – Directed Graphs Lecture 19
Directed Graphs (DiGraph) G = (V, E) V = {v} vertices/nodes/points E = {e} (directed) edges/arcs/lines Labels Arcs/vertices may have an associated label Arc ordered pair of Vertices - (v,w) – vw From v To w w Adjacent To v v w tail head 4/15/2019 CS 303 – Directed Graphs Lecture 19
Graph Definitions Path v1, v2, ..., vn v1 v2, v2 v3, ... vn-1 vn From v1 Passes through v2, ..., vn-1 Ends at vn Length = n-1 (count the arcs, not the vertices) Simple Path all vi (except perhaps v1 and vn) are DISTINCT Cycle (v1, ..., vn) – Length >= 1 1 2 3 4 3243 = cycle 4/15/2019 CS 303 – Directed Graphs Lecture 19
Graph Operations T/F (i j) in E? (i.e., MEMBER((i,j),E)) {v} Adjacent(i) Quicky Implementation – any implementation of SET 4/15/2019 CS 303 – Directed Graphs Lecture 19
Adjacency Matrix Representation 4/15/2019 CS 303 – Directed Graphs Lecture 19