0% found this document useful (0 votes)
61 views1 page

Topological Sorting

A topological sort takes a directed acyclic graph and produces a linear ordering of its vertices such that if the graph contains an edge from vertex v to vertex w, then v comes before w in the ordering. The algorithm performs a depth-first search on the graph to compute finish times for each vertex, then returns the vertices in decreasing order of finish time as the result of the topological sort.

Uploaded by

Sumiran Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views1 page

Topological Sorting

A topological sort takes a directed acyclic graph and produces a linear ordering of its vertices such that if the graph contains an edge from vertex v to vertex w, then v comes before w in the ordering. The algorithm performs a depth-first search on the graph to compute finish times for each vertex, then returns the vertices in decreasing order of finish time as the result of the topological sort.

Uploaded by

Sumiran Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Topological Sorting

A topological sort takes a directed acyclic graph and produces a linear ordering of all its vertices such that if the graph
G contains an edge (v, w) then the vertex v comes before vertex w in the ordering.

The algorithm is as follows:

i. Call DFS (G) for a graph G. Compute finish times for each one of the vertices.
ii. Store the vertices in a list in the decreasing order of their finish times.
iii. Return the ordered list as the result of the topological sort.
1/12 2/11
3/4

A B C

D E F
Topological Sorting: A, B, D, E, F, C

5/10 6/9 7/8

Heat
Pan
1/12 13/14

¾ cup
milk

2/11 3/8
15/16
Pour ¼
1 cup cup
1 egg
mix

17/18 4/7

Turn
1 when
tablespo bubbly
on oil

5/6
Heat
Syrup End/Eat
9/10

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy