Skip to content

Latest commit

 

History

History

topological_sorter

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Topological sorter

Input: a directed graph

Enter an edge, eg.: A->B
a->b
Enter an edge, eg.: A->B
b->c
Enter an edge, eg.: A->B
j->a
Enter an edge, eg.: A->B
 # blank line to finish 

Output: an ordered list

Directed graph constructed.                                                                                            
Topologically sorted:  ['j', 'a', 'b', 'c']