15 082 and 6 855j
Download
1 / 11

15.082 and 6.855J - PowerPoint PPT Presentation


  • 94 Views
  • Uploaded on

15.082 and 6.855J. Topological Ordering. Preliminary to Topological Sorting. LEMMA. If each node has at least one arc going out, then the first inadmissible arc of a depth first search determines a directed cycle.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' 15.082 and 6.855J' - yeo-sexton


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
15 082 and 6 855j

15.082 and 6.855J

Topological Ordering


Preliminary to topological sorting
Preliminary to Topological Sorting

  • LEMMA. If each node has at least one arc going out, then the first inadmissible arc of a depth first search determines a directed cycle.

  • COROLLARY 1. If G has no directed cycle, then there is a node in G with no arcs going. And there is at least one node in G with no arcs coming in.

  • COROLLARY 2. If G has no directed cycle, then one can relabel the nodes so that for each arc (i,j), i < j.

3

1

4

6

7


Initialization

1

2

3

4

5

6

7

8

Node

Indegree

2

2

3

2

1

1

0

2

7

0

next

LIST

Initialization

6

1

“Next” will be the label of nodes in the topological order.

Determine the indegree of each node

LIST is the set of nodes with indegree of 0.

5

8

3

2

7

4


Select a node from list

LIST

Select a node from LIST

6

1

next := next +1order(i) := next;

update indegrees

update LIST

Select a node from LIST and delete it.

5

8

3

2

7

7

4

1

0

1

next

1

2

3

4

5

6

7

8

Node

Indegree

2

2

3

1

2

0

1

1

0

2

7

5


Select a node from list1

LIST

Select a node from LIST

6

1

next := next +1order(i) := next;

update indegrees

update LIST

Select a node from LIST and delete it.

2

5

5

8

3

2

7

7

4

1

2

0

1

next

1

2

3

4

5

6

7

8

Node

Indegree

2

2

1

3

0

1

2

0

1

1

0

0

2

4

5

7

6


Select a node from list2

LIST

Select a node from LIST

3

6

6

1

next := next +1order(i) := next;

update indegrees

update LIST

Select a node from LIST and delete it.

2

5

5

8

3

2

7

7

4

1

3

1

2

0

next

1

2

3

4

5

6

7

8

Node

Indegree

1

2

2

1

0

3

2

1

0

0

1

0

1

0

2

4

7

5

6

2


Select a node from list3

LIST

Select a node from LIST

3

6

6

1

next := next +1order(i) := next;

update indegrees

update LIST

Select a node from LIST and delete it.

2

5

5

2

2

8

3

4

7

7

4

1

4

1

3

2

0

next

1

2

3

4

5

6

7

8

Node

Indegree

0

1

2

1

0

2

3

0

1

2

1

0

1

0

0

2

4

5

7

2

6

1


Select a node from list4

LIST

Select a node from LIST

5

3

6

6

1

1

next := next +1order(i) := next;

update indegrees

update LIST

Select a node from LIST and delete it.

2

5

5

2

2

8

3

4

7

7

4

1

1

2

5

0

4

3

next

1

2

3

4

5

6

7

8

Node

Indegree

2

1

0

2

0

1

2

3

2

1

0

0

1

0

1

0

2

1

4

7

5

1

2

6


Select a node from list5

LIST

Select a node from LIST

5

3

6

6

1

1

next := next +1order(i) := next;

update indegrees

update LIST

Select a node from LIST and delete it.

2

5

5

2

2

8

3

4

7

7

4

4

1

6

1

0

2

4

5

3

6

next

1

2

3

4

5

6

7

8

Node

Indegree

1

0

2

0

1

2

3

2

1

2

0

1

0

1

1

0

0

1

0

2

6

4

1

2

5

7

8


Select a node from list6

LIST

Select a node from LIST

5

3

6

6

1

1

next := next +1order(i) := next;

update indegrees

update LIST

Select a node from LIST and delete it.

7

2

5

5

2

2

8

8

3

4

7

7

4

4

1

6

1

4

5

6

2

3

7

0

next

1

2

3

4

5

6

7

8

Node

Indegree

2

1

0

0

1

2

0

3

2

1

0

1

2

0

1

0

1

0

2

1

0

8

3


Select a node from list7

LIST

Select a node from LIST

5

3

6

6

1

1

next := next +1order(i) := next;

update indegrees

update LIST

Select a node from LIST and delete it.

7

8

2

5

5

2

2

8

8

3

3

4

7

7

4

4

1

6

4

1

6

7

8

5

3

2

0

next

List is empty.

The algorithm terminates with a topological order of the nodes

1

2

3

4

5

6

7

8

Node

Indegree

2

0

1

0

1

2

0

2

3

1

2

0

1

0

1

0

1

0

2

0

1

3


ad