This preview shows pages 1–2. Sign up to view the full content.
Graphs
1.
Map coloring
a.
Color the map using as few colors as possible
b.
Create a graph with a node for each country and an edge between neighboring
countries
c.
Graph coloring: given, assign a color to each node such that
c.i.
No adjacent nodes have the same color
c.ii.
The minimum number of colors is used
d.
Scheduling exams
A bunch of exams is scheduled, use as few time slots as possible. If a student is
taking two exams, cannot schedule at the same time.
This is a graph coloring problem.
Node
exam
Edge between the nodes
same student is taking both exams
Color graph with as few colors as possible
Color
time slot
2.
Graphs; formally
a.
A graph G = (V,E) has vertices (nodes) V, edges E
Ex: map example
V = {1,2,3,4,5,6,7}
Edge x – y means “x is a neighbor of y” – symmetric relationship. So this is an
undirected graph.
Edges: {1,2} {1,3} {2,4} etc.
b.
Directed graphs
Eg. The web
Node
URL
Edge
from a URL to a URL is points to
(x,y) “x points to y”
3.
Storing graphs on a computer
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '08
 staff
 Algorithms

Click to edit the document details