# 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 pages 1–36. Sign up to view the full content.

Introduction to Graphs CS2110, Spring 2011 Cornell University

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

View Full Document
A graph is a data structure for representing relationships .
Each graph is a set of nodes connected by edges .

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

View Full Document
Nifty Cool Sharp Chilly Composed Abrupt Hostile Direct Slick Icy Synonym Graph

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

View Full Document

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

View Full Document

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

View Full Document
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.
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.

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

View Full Document
CAT SAT RAT RAN MAN MAT CAN

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

View Full Document
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).
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 .

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

View Full Document
Navigating a Graph A B D C E F
Navigating a Graph A B D C E F

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

View Full Document
Navigating a Graph A B D C E F A B D F
Navigating a Graph A B D C E F A C F

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

View Full Document
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 ).
The length of a path is the number of edges it contains.

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

View Full Document
Navigating a Graph A B D C E F
Navigating a Graph A B D C E F

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

View Full Document
A node v is reachable from node u if there is a path from u to v.
Navigating a Graph A B D C E F

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

View Full Document
Navigating a Graph A B D C E F
Navigating a Graph A B D C E F B D B

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

View Full Document
Navigating a Graph A B D C E F B D B D B
Navigating a Graph A B D C E F

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

View Full Document
Navigating a Graph A B D C E F A B D B D F
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
Ask a homework question - tutors are online