Tries to insert an edge into the topological order.
Tries to insert an edge into the topological order. Throws an exception if the source or target vertex of the edge is not contained in the vertex list of this structure.
the edge to insert
Failure
if the edge would violate acyclicity, otherwise Success
of a tuple
that contains the new topology and possibly 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 should be
moved _before_ the reference
Adds a new vertex to the set of unconnected vertices.
Adds a new vertex to the set of unconnected vertices. Throws an exception if the vertex had been added before.
Tests if an edge can be added without producing a cycle.
Tests if an edge can be added without producing a cycle.
the edge to test
true
if the insertion is possible. Then calling addEdge
is guaranteed to be a Success
.
false
if the insertion would introduce a cycle. Then calling addEdge
is guaranteed to be a
Failure
For two connected 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 connected 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 unconnected.
allows lookup of edges via vertex keys
a set of edges between the vertices
Removes the edge from the topology.
Removes the edge from the topology. If the edge is not contained in the structure, returns the topology unmodified.
Removes a vertex and all associated edges.
Removes a vertex and all associated edges. If the vertex is not contained in the structure, returns the unmodified topology.
the number of unconnected vertices (the leading elements in vertices
)
the vertices in the structure
An online topological 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).
vertex type
edge type