Graphs
A graph G = (V,E) is composed of V: set of vertices
E: set of edges connecting the vertices
An edge e = (u,v0 is a path of vertices that indicates that vertices u and v are connected
V = {A,B,C,D,E}
E = {(A,B), (A,C), (B,C), (C,E), (C,D), (E,D)}
Graphs are useful because many problems can be represented with graphs
 Communication network (internet)
 Transport network ( lab5 and google maps)
 Vertices > cities / locations
 Edges > roads / paths
 Event dependencies
A
D
C
E
B
R
R
R
R
H
H
H
H
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Once you represent a problem using graphs, there are already many algorithms that
can solve the problem
Problem > Graph > Algorithms > Solutions
Algorithms
 shortest path algorithms
 topological sort
 spanning tree
Undirected graphs: Graphs where edges do not have direction
Directed graphs: Graphs where edges have a direction
Data structures for graphs
 Edge list
 Adjacency list
 Adjacency matrix
Edge list:
It store the vertices and the edges as an edge list
Edge List: {(A,B), (A,C), (B,D), (C,D), (D,F), (D,E), (F,E)}
Adjacent List:
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 Staff
 Graph Theory, Dijkstra

Click to edit the document details