Graphs
Graphs  Network
Example 1  Web graph
•
Each vertex is a web page
•
Each edge is one or more links from a page to another
Directed graph
 all edges have direction
•
e.g. street map, prereq graph (on Rutgers CS website)
Neighbors of a vertex
•
y is a neighbor of x if
edge, y is adjacent to x
o
neighbor = adjacent
•
(x) > (y)
o
x is not
a neighbor of y, not adjacent to y
Path
from x to y is sequence of edges without repetition
•
p1 > p2 (simple edge is a path)
•
p4 > p6 > p4 is a path, actually a
cycle
o
cycle is a path with the same start and end points
o
p3 > p5 > p6 > p3 = (p3, p5, p6, p3)
indegree
 number of edges into a vertex
•
for p6, indegree = 2
outdegree
 number of edges out of p6
•
for p6, indegree = 2
Degree
 int + out = 4
Facebook graph is
undirected
•
‘symmetric’ relationship
o
e.g. friendship on facebook
•
(p1, p3) in an undirected graph:
o
p1 is adjacent to p3, and vice versa
Directed  ALL edges have direction
Undirected  NO edge has direction
Cliques  group within a graph
Can have weights at the edges  edge “weight”
•
e.g. distance in a street graph
•
e.g. molecules bonds
o
undirected, weights would be bond strength
(double bond, triple bond)
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentIn summary
•
directed, no weights
•
undirected, no weights
•
directed, weighted
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '07
 Sesh
 Graph Theory, Data Structures, undirected graph, Graph input size

Click to edit the document details