Skip to content

Files

Latest commit

addf920 · Jan 9, 2021

History

History

topological_sorter

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 9, 2021
Jan 9, 2021

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']