from graphlib import TopologicalSorter
graph = {1 : {6},2: {3}, 3: {1}, 4: {0, 1}, 5: {0, 2}}
t=TopologicalSorter(graph)
t.prepare( )
resulttuple=t.get_ready( )
print(resulttuple)
(6, 0)
from graphlib import TopologicalSorter
graph = {1 : {6},2: {3}, 3: {1}, 4: {0, 1}, 5: {0, 2}}
t=TopologicalSorter(graph)
r=t.get_ready( )
print(r)
Traceback (most recent call last):
File "C:\Users\findm\AppData\Local\Programs\Python\Python39\graphlib.py", line 9, in <module>
r=t.get_ready( )
File "C:\Users\findm\AppData\Local\Programs\Python\Python39\lib\graphlib.py", line 117, in get_ready
raise ValueError("prepare() must be called first")
ValueError: prepare() must be called first
Comments