Lecture 09-Graph-Part 1
Lecture 09-Graph-Part 1
Part 1
This chapter covers the following topics
Graph terminology: vertex, edge, adjacent, incident,
degree, cycle, path, connected component, spanning tree
Types of graphs: undirected, directed, weighted
Graph representations: adjacency matrix, array adjacency
lists, linked adjacency lists
Graph search methods: breath-first, depth-first search
Algorithms:
– to find a path in a graph
– to find the connected components of an undirected graph
– to find a spanning tree of a connected undirected graph
Graphs
G = (V,E)
V is the vertex set.
Vertices are also called nodes and points.
E is the edge set.
Each edge connects two vertices.
Edges are also called arcs and lines.
Vertices i and j are adjacent vertices iff (i, j) is an edge in
the graph
The edge (i, j) is incident on the vertices i and j
Graphs
Undirected edge has no orientation (no arrow head)
Directed edge has an orientation (has an arrow head)
Undirected graph – all edges are undirected
Directed graph – all edges are directed
u v u v
undirected edge directed edge
Undirected Graph
Directed Graph (Digraph)
Directed Graph
It is useful to have a slightly refined notion of adjacency
and incidence
Directed edge (i, j) is incident to vertex j and incident from
vertex i
Vertex i is adjacent to vertex j, and vertex j is adjacent from
vertex i
In Figure 16.1, which graphs are undirected and which
graphs are directed?
Applications – Communication Network
vertex = router
edge = communication link
Applications - Driving Distance/Time Map
vertex = city
edge weight = driving distance/time
Applications - Street Map