Graphs-PartIII-Dorr

# Graphs-PartIII-Dorr - We define"strongly connected to mean...

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

We define “strongly connected” to mean that for every pair of vertices (u,v) in the component, there is a path from u to v and from v to u . In the following graph, what are the strongly connected components?

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

View Full Document
This is a GREEDY algorithm. //finds shortest path between start and all other vertices Initialize a predecessor array for vertices to all null Initialize a cost array which represents cost to start to all Set the cost of start to itself as 0 Q=all vertices in V while Q is not empty { u = remove the vertex which has the lowest cost from start for each vertex v which is adjacent to u { if (cost from start to v) > (cost from start to u + cost of u to v) then { update the cost from start to v mark u as the predecessor of v } } } } - The cost of the shortest path to any destination is known. - The path to this destination can be reverse engineered by starting at the destination, and going backwards based on the predecessor list until reaching the starting point

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

View Full Document
Let’s think about the while loop: It executes exactly |V| times. What are the costly things and how much do they cost?

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 01/13/2012 for the course CMSC 351 taught by Professor Staff during the Fall '11 term at University of Louisville.

### Page1 / 15

Graphs-PartIII-Dorr - We define"strongly connected to mean...

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

View Full Document
Ask a homework question - tutors are online