public class EdgeBasedTarjanSCC extends Object
The algorithm is of course very similar to the node-based version and it might be possible to reuse some code between the two, but especially the version with an explicit stack needs different 'state' information and loops require some special treatment as well.
TarjanSCC
Modifier and Type | Class and Description |
---|---|
static class |
EdgeBasedTarjanSCC.ConnectedComponents |
static interface |
EdgeBasedTarjanSCC.EdgeTransitionFilter |
Modifier and Type | Method and Description |
---|---|
static int |
createEdgeKey(EdgeIteratorState edgeState,
boolean reverse) |
static EdgeBasedTarjanSCC.ConnectedComponents |
findComponents(Graph graph,
EdgeBasedTarjanSCC.EdgeTransitionFilter edgeTransitionFilter,
boolean excludeSingleEdgeComponents)
Runs Tarjan's algorithm using an explicit stack.
|
static EdgeBasedTarjanSCC.ConnectedComponents |
findComponentsForStartEdges(Graph graph,
EdgeBasedTarjanSCC.EdgeTransitionFilter edgeTransitionFilter,
com.carrotsearch.hppc.IntContainer edges)
Like
findComponents(Graph, EdgeTransitionFilter, boolean) , but the search only starts at the
given edges. |
static EdgeBasedTarjanSCC.ConnectedComponents |
findComponentsRecursive(Graph graph,
EdgeBasedTarjanSCC.EdgeTransitionFilter edgeTransitionFilter,
boolean excludeSingleEdgeComponents)
Runs Tarjan's algorithm in a recursive way.
|
public static EdgeBasedTarjanSCC.ConnectedComponents findComponents(Graph graph, EdgeBasedTarjanSCC.EdgeTransitionFilter edgeTransitionFilter, boolean excludeSingleEdgeComponents)
edgeTransitionFilter
- Only edge transitions accepted by this filter will be considered when we explore the graph.
If a turn is not accepted the corresponding path will be ignored (edges that are only connected
by a path with such a turn will not be considered to belong to the same component)excludeSingleEdgeComponents
- if set to true components that only contain a single edge will not be
returned when calling findComponents(com.graphhopper.storage.Graph, com.graphhopper.routing.subnetwork.EdgeBasedTarjanSCC.EdgeTransitionFilter, boolean)
or findComponentsRecursive()
,
which can be useful to save some memory.public static EdgeBasedTarjanSCC.ConnectedComponents findComponentsForStartEdges(Graph graph, EdgeBasedTarjanSCC.EdgeTransitionFilter edgeTransitionFilter, com.carrotsearch.hppc.IntContainer edges)
findComponents(Graph, EdgeTransitionFilter, boolean)
, but the search only starts at the
given edges. This does not mean the search cannot expand to other edges, but this can be controlled by the
edgeTransitionFilter. This method does not return single edge components (the excludeSingleEdgeComponents option is
set to true).public static EdgeBasedTarjanSCC.ConnectedComponents findComponentsRecursive(Graph graph, EdgeBasedTarjanSCC.EdgeTransitionFilter edgeTransitionFilter, boolean excludeSingleEdgeComponents)
findComponents()
) should be
preferred. However, this recursive implementation is easier to understand.public static int createEdgeKey(EdgeIteratorState edgeState, boolean reverse)
Copyright © 2012–2022. All rights reserved.