GraphTraversal

# GraphTraversal - CMSC 132: Object-Oriented Programming II...

This preview shows pages 1–10. Sign up to view the full content.

1 CMSC 132: Object-Oriented Programming II Department of Computer Science University of Maryland, College Park

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

View Full Document
2 Graph Data Structures Many-to-many relationship between elements Each element has multiple predecessors Each element has multiple successors
3 Graph Definitions Node Element of graph State List of adjacent/neighbor/successor nodes Edge Connection between two nodes State Endpoints of edge A

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

View Full Document
4 Graph Definitions Directed graph Directed edges Undirected graph Undirected edges
5 Graph Definitions Weighted graph Weight (cost) associated with each edge

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

View Full Document
6 Graph Definitions Path Sequence of nodes n 1 , n 2 , … n k Edge exists between each pair of nodes n i , n i+1 Example A, B, C is a path A, E, D is not a path
7 Graph Definitions Cycle Path that ends back at starting node Example A, E, A A, B, C, D, E, A Simple path No cycles in path Acyclic graph No cycles in graph

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

View Full Document
8 Graph Definitions Reachable Path exists between nodes Connected graph Every node is reachable from some node in graph Unconnected graphs
Graph Operations Traversal (search) Visit each node in graph exactly once

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.

## This note was uploaded on 12/04/2011 for the course CMSC 132 taught by Professor Padua-perez during the Spring '08 term at Maryland.

### Page1 / 24

GraphTraversal - CMSC 132: Object-Oriented Programming II...

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

View Full Document
Ask a homework question - tutors are online