CS 310 Unit 18 Topological Sort and Strongly Connected Components

# CS 310 Unit 18 Topological Sort and Strongly Connected Components

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

CS 310  Unit 18 Topological Sort  and Strongly Connected  Components Furman Haddix Ph.D. Assistant Professor Minnesota State University,  Mankato Spring 2008

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

View Full Document
Unit 18 Objectives Two Depth First Search Applications Topological sort Strongly connected components Text Chapter 22.4, 22.5
Topological Sort Idea of a topological sort is to produce an  ordered set from a partially ordered set, if  possible. The basic logic is provided by DFS. In  conclusion, listing the ordered set is based  on the finish times from the DFS in inverse  order.

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

View Full Document
Example Topological Sort Instead of creating a DFS forest create a linked list,  tim e 1 belt jacket shoes shoes shoes LIST belt
Example Topological Sort 0 pants 0 tie 0 jacket belt shirt 0 shorts shoes socks watch 0 0 0 0 0 1 0 0 0 0 0 0 0 0 tim e 2 shoes pants socks jacket belt shorts tie watch shirt tie belt jacket jacket pants shoes shoes shoes LIST belt

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

View Full Document
Example Topological Sort 0 pants 0 tie 0 jacket belt shirt 0 shorts shoes socks watch 2 0 0 0 0 1 0 0 0 0 0 0 0 0 tim e 3 shoes pants socks jacket belt shorts tie watch shirt tie belt jacket jacket pants shoes shoes shoes LIST belt
Example Topological Sort 0 pants 0 tie 0 jacket belt shirt 0 shorts shoes socks watch 2 0 0 0 0 1 0 0 0 0 3 0 0 0 tim e 4 shoes pants socks jacket belt shorts tie watch shirt tie belt jacket jacket pants shoes shoes shoes LIST belt

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

View Full Document
Example Topological Sort 0 pants 0 tie 0 jacket belt shirt 0 shorts shoes socks watch 2 4 0 0 0 1 0 0 0 0 3 0 0 0 tim e 5 shoes pants socks jacket belt shorts tie watch shirt tie belt jacket jacket pants shoes shoes shoes LIST jacket belt
Example Topological Sort 0 pants 0 tie 0 jacket belt shirt 0 shorts shoes socks watch 2 4 0 0 0 1 0 5 0 0 3 0 0 0 tim e 6 shoes pants socks jacket belt shorts tie watch shirt tie belt jacket jacket pants shoes shoes shoes LIST jacket tie belt

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

View Full Document
Example Topological Sort 0 pants 0 tie 0 jacket belt shirt 0 shorts shoes socks watch 2 4 0 0 0 1 6 5 0 0 3 0 0 0 tim e 7 shoes pants socks jacket belt shorts tie watch shirt tie belt jacket jacket pants shoes shoes shoes LIST belt jacket tie
Example Topological Sort 0 pants 0 tie 0 jacket belt shirt 0 shorts shoes socks watch 2 4 0 7 0 1 6 5 0 0 3 0 0 0 tim e 8 shoes pants socks jacket belt shorts tie watch shirt tie belt jacket jacket pants shoes shoes shoes LIST belt belt jacket tie

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

View Full Document
Example Topological Sort 0 pants 0 tie 0 jacket belt shirt 0 shorts shoes socks watch 2 4 0 7 8 1 6 5 0 0 3 0 0 0 tim e 9 shoes pants socks jacket belt shorts tie watch shirt tie belt jacket jacket pants shoes shoes shoes LIST belt shirt belt jacket tie
Example Topological Sort 0 pants 0 tie 0 jacket belt shirt 0 shorts shoes socks watch 2 4 0 7 8 1 6 5 0 9 3 0 0 0 tim e 10 shoes pants socks jacket belt shorts tie watch shirt tie belt jacket jacket pants shoes shoes shoes LIST belt shirt belt jacket tie

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

View Full Document
Example Topological Sort 0 pants 0 tie 0 jacket belt shirt 0 shorts shoes socks watch 2 4 0 7 8 1 6 5 0 10 3 0 0 0 tim e 11 shoes pants socks jacket belt shorts tie watch shirt tie belt jacket jacket pants shoes shoes shoes LIST belt shirt belt jacket tie watch
Example Topological Sort 11 pants 0 tie 0

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 06/09/2008 for the course CS 310 taught by Professor Furmanhaddix during the Spring '08 term at Minnesota State University, Mankato.

### Page1 / 73

CS 310 Unit 18 Topological Sort and Strongly Connected Components

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

View Full Document
Ask a homework question - tutors are online