¨ o G = (V, E) vertices V edges E Directed graphs

E (u, v) u, v ∈

V example.eps, height = 3.5cm Undirectedgraph :isasetofunorderedpairsofvertices{}where∈ V_{g}raph.eps, height = 4cm

{u, v} incident u v {}

path u v < u = v_{0}, v_{1}, v_{2}, ⋯, v_{k} = v > (v_{i}, v_{i+1}) ∈

E {v_{i}, v_{i+1}} ∈

E v u length

k cy-

cle u = v u = 1 v = 5 < u = 1, 4, 2, 5 = v > strongly connected strongly connected components {{}{}{}}

K_{1} K_{2} K_{3} K_{5} K_{5}

V S∪ T = V {a, b} a ∈ S b ∈ T S T K_{mn} V = S∪ T |S| = m |T | = n K_{3,3}

K_{5} K_{3,3}

G = (V, E)

|V |× |V |

A ij

i j v_{i} v_{j}

ij

A V E O(|V |^{2})

G A× A A× A× A v w v |V |

O(|V |+

|E|) v w v w w v O(min{(v), (w)}) v w

shortest path s

procedure BFS(v)
Input: A simple connected undirected graph G=(V,E) and the start vertex v
       represented as adjacency lists.
Output : A BFS tree T, where each vertex u knows its parent p(u).
Variables: Q: Queue of vertices, maintained in the FIFO order
           x, y: vertex.
Begin