Lines Matching refs:TopologicalSorter
18 .. class:: TopologicalSorter(graph=None)
35 to the graph using the :meth:`~TopologicalSorter.add` method.
40 * Create an instance of the :class:`TopologicalSorter` with an optional
43 * Call :meth:`~TopologicalSorter.prepare` on the graph.
44 * While :meth:`~TopologicalSorter.is_active` is ``True``, iterate over
45 the nodes returned by :meth:`~TopologicalSorter.get_ready` and
46 process them. Call :meth:`~TopologicalSorter.done` on each node as it
51 :meth:`TopologicalSorter.static_order` can be used directly:
56 >>> ts = TopologicalSorter(graph)
63 topological_sorter = TopologicalSorter()
98 Raises :exc:`ValueError` if called after :meth:`~TopologicalSorter.prepare`.
104 :meth:`~TopologicalSorter.get_ready` can still be used to obtain as many
107 added using :meth:`~TopologicalSorter.add`.
114 :meth:`TopologicalSorter.get_ready` or the number of nodes marked
115 :meth:`TopologicalSorter.done` is less than the number that have been
116 returned by :meth:`TopologicalSorter.get_ready`.
118 The :meth:`~TopologicalSorter.__bool__` method of this class defers to
130 :meth:`~TopologicalSorter.prepare` previously.
134 Marks a set of nodes returned by :meth:`TopologicalSorter.get_ready` as
136 returned in the future by a call to :meth:`TopologicalSorter.get_ready`.
140 the graph by using :meth:`TopologicalSorter.add`, if called without
141 calling :meth:`~TopologicalSorter.prepare` or if node has not yet been
142 returned by :meth:`~TopologicalSorter.get_ready`.
148 processed by calling :meth:`TopologicalSorter.done`, further calls will
153 :meth:`~TopologicalSorter.prepare` previously.
158 does not require to call :meth:`TopologicalSorter.prepare` or
159 :meth:`TopologicalSorter.done`. This method is equivalent to::
173 >>> ts = TopologicalSorter()
179 >>> ts2 = TopologicalSorter()
187 :meth:`~TopologicalSorter.get_ready`) and the order between them is
202 Subclass of :exc:`ValueError` raised by :meth:`TopologicalSorter.prepare` if cycles exist