Graphs-PartIII-Dorr - We define "strongly...

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

View Full Document Right Arrow Icon
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?
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Let’s think about the while loop: It executes exactly |V| times. What are the costly things and how much do they cost?
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

Graphs-PartIII-Dorr - We define "strongly...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online