Docsity

Graph Operations - Algorithms and Applications in Java - Lecture Slides, Slides of Computer Science

Partial preview of the text

Download Graph Operations - Algorithms and Applications in Java - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Graph Operations And

Representation

Sample Graph Problems

• Path problems.

• Connectedness problems.

• Spanning tree problems.

Another Path Between 1 and 8

Path length is 28.

Example Of No Path

No path between 2 and 9.

Example Of Not Connected

Connected Graph Example

Connected Component

• A maximal subgraph that is connected.

 Cannot add vertices and edges from original

graph and retain connectedness.

• A connected graph has exactly 1

component.

Not A Component

Communication Network Problems

• Is the network connected?

 Can we communicate between every pair of

cities?

• Find the components.

• Want to construct smallest number of

feasible links so that resulting network is

connected.

Cycles And Connectedness

Removal of an edge that is on a cycle does not affect

connectedness.

Tree

• Connected graph that has no cycles.

• n vertex connected graph with n-1 edges.

Spanning Tree

• Subgraph that includes all vertices of the

original graph.

• Subgraph is a tree.

 If original graph has n vertices, the spanning

tree has n vertices and n-1 edges.

A Spanning Tree

Spanning tree cost = 51.

Minimum Cost Spanning Tree

Spanning tree cost = 41.