the vertices in the structure
a set of edges between the vertices
the number of unpositioned vertices (the leading elements in vertices
)
allows lookup of edges via vertex keys
Tries to insert an edge into the topological order.
Tries to insert an edge into the topological order. Throws an exception of the source or target vertex of the edge is not contained in the vertex list of this structure.
the edge to insert
None
if the edge would violate acyclicity, otherwise Some
tuple contains
the new topology, the reference vertex and the affected vertices which need to
be moved with respect to the reference to reflect the new ordering. In case
that the reference is the source vertex of the added edge, the affected vertices
should be moved _after_ the reference and keep their internal grouping order.
In case the reference is the target vertex, the affected vertices sequence is
guaranteed to consist only exactly one element -- the source vertex -- which
should be moved _before_ the reference
For two positioned vertices a
and b
, returns -1
if a
is before b
, or 1
if a
follows b
,
or 0
if both are equal.
For two positioned vertices a
and b
, returns -1
if a
is before b
, or 1
if a
follows b
,
or 0
if both are equal. Throws an exception if a
or b
is unpositioned.
a set of edges between the vertices
Removes a vertex and all associated edges.
the vertices in the structure
An online toplogical order maintenance structure. This is an immutable data structure with amortized costs. The edge adding operation returns a new copy of the modified structure along with a list of vertices which have been moved due to the insertion. The caller can then use that list to adjust any views (e.g. DSP processes).
the vertices in the structure
a set of edges between the vertices
the number of unpositioned vertices (the leading elements in
vertices
)allows lookup of edges via vertex keys