11.07.2015 Views

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

11GraphsGraphs provide the ultim<strong>at</strong>e in d<strong>at</strong>a structure flexibility. Graphs can model bothreal-world systems <strong>and</strong> abstract problems, so they are used in hundreds of applic<strong>at</strong>ions.Here is a small sampling of the range of problems th<strong>at</strong> graphs are routinelyapplied to.1. Modeling connectivity in computer <strong>and</strong> communic<strong>at</strong>ions networks.2. Representing a map as a set of loc<strong>at</strong>ions with distances between loc<strong>at</strong>ions;used to compute shortest routes between loc<strong>at</strong>ions.3. Modeling flow capacities in transport<strong>at</strong>ion networks.4. Finding a p<strong>at</strong>h from a starting condition to a goal condition; for example, inartificial intelligence problem solving.5. Modeling computer algorithms, showing transitions from one program st<strong>at</strong>eto another.6. Finding an acceptable order for finishing subtasks in a complex activity, suchas constructing large buildings.7. Modeling rel<strong>at</strong>ionships such as family trees, business or military organiz<strong>at</strong>ions,<strong>and</strong> scientific taxonomies.We begin in Section 11.1 with some basic graph terminology <strong>and</strong> then definetwo fundamental represent<strong>at</strong>ions for graphs, the adjacency m<strong>at</strong>rix <strong>and</strong> adjacencylist. Section 11.2 presents a graph ADT <strong>and</strong> simple implement<strong>at</strong>ions based on theadjacency m<strong>at</strong>rix <strong>and</strong> adjacency list. Section 11.3 presents the two most commonlyused graph traversal algorithms, called depth-first <strong>and</strong> breadth-first search, withapplic<strong>at</strong>ion to topological sorting. Section 11.4 presents algorithms for solvingsome problems rel<strong>at</strong>ed to finding shortest routes in a graph. Finally, Section 11.5presents algorithms for finding the minimum-cost spanning tree, useful for determininglowest-cost connectivity in a network. Besides being useful <strong>and</strong> interestingin their own right, these algorithms illustr<strong>at</strong>e the use of some d<strong>at</strong>a structures presentedin earlier chapters.371

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!