18-GraphsI - Introduction to Graphs CS2110 Spring 2011 Cornell University A graph is a data structure for representing relationships Each graph is

Info iconThis preview shows pages 1–36. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Graphs CS2110, Spring 2011 Cornell University
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A graph is a data structure for representing relationships .
Background image of page 2
Each graph is a set of nodes connected by edges .
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Nifty Cool Sharp Chilly Composed Abrupt Hostile Direct Slick Icy Synonym Graph
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Goals for Today Learn the formalisms behind graphs. Learn different representations for graphs. Learn about paths and cycles in graphs. See three ways of exploring a graph. Explore applications of graphs to real-world problems. Explore algorithms for drawing graphs.
Background image of page 10
Formalisms A (directed) graph is a pair G = (V, E) where V are the vertices (nodes) of the graph. E are the edges (arcs) of the graph. Each edge is a pair (u, v) of the start and end (or source and sink ) of the edge.
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 12
CAT SAT RAT RAN MAN MAT CAN
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Directed and Undirected Graphs A graph is directed if its edges specify which is the start and end node. Encodes asymmetric relationship. A graph is undirected if the edges don't distinguish between the start and end nodes. Encodes symmetric relationship. An undirected graph is a special case of a directed graph (just add edges both ways).
Background image of page 14
How Big is a Graph G = (V, E)? Two measures: Number of vertices: |V| (often denoted n ) Number of edges: |E| (often denoted m ) |E| can be at most O(|V| 2 ) A graph is called sparse if it has few edges. A graph with many edges is called dense .
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Navigating a Graph A B D C E F
Background image of page 16
Navigating a Graph A B D C E F
Background image of page 17

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Navigating a Graph A B D C E F A B D F
Background image of page 18
Navigating a Graph A B D C E F A C F
Background image of page 19

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A path from v 0 to v n is a list of edges (v 0 , v 1 ), (v 1 , v 2 ), …, (v n-1 , v n ).
Background image of page 20
The length of a path is the number of edges it contains.
Background image of page 21

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Navigating a Graph A B D C E F
Background image of page 22
Navigating a Graph A B D C E F
Background image of page 23

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A node v is reachable from node u if there is a path from u to v.
Background image of page 24
Navigating a Graph A B D C E F
Background image of page 25

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Navigating a Graph A B D C E F
Background image of page 26
Navigating a Graph A B D C E F B D B
Background image of page 27

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Navigating a Graph A B D C E F B D B D B
Background image of page 28
Navigating a Graph A B D C E F
Background image of page 29

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Navigating a Graph A B D C E F A B D B D F
Background image of page 30
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/05/2011 for the course CS 211 at Cornell University (Engineering School).

Page1 / 193

18-GraphsI - Introduction to Graphs CS2110 Spring 2011 Cornell University A graph is a data structure for representing relationships Each graph is

This preview shows document pages 1 - 36. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online