Modifier and Type | Method | Description |
---|---|---|
static <V extends Vertex<V,E>,E extends Edge<V,E>> |
hasDeadEnds(Graph<V,E> stateModel,
V startVertex,
Set<V> endVertices) |
public static <V extends Vertex<V,E>,E extends Edge<V,E>> boolean hasDeadEnds(Graph<V,E> stateModel, V startVertex, Set<V> endVertices) throws IllegalArgumentException
Pair
s in the Edge
s are
interpreted with first and second Vertex
as start and target
state. The dead ends are checked against a set of end states which are
provided.
For graph with these end states it is checked that from all vertices of
the Graph
an end state can be reached. If there is at least one
state from which it is not possible, the graph has a dead end.
Beware: The check is done recursively (but in linear time). So, for large
models the stack needs to be large enough.V
- is the Vertex
implementation to be used.E
- is the Edge
implementation to be used.stateModel
- is the model to be checked. If the model has no end states, a
IllegalArgumentException
is thrown.startVertex
- is the Vertex
to start the dead end search.endVertices
- is a Set
of Vertex
which define which vertices
are to be treated as final states.true
is returned of dead ends exist.
false
is returned otherwise.IllegalArgumentException
- is thrown in case the model has no end states and cannot be
checked for end states (because there are only dead ends).Copyright © 2014–2018 PureSol Technologies. All rights reserved.