public class TarjanSCC extends Object
This class offers two ways to run the algorithm: Either using (function call) recursion findComponentsRecursive()
or recursion using an explicit stack findComponents()
. The first one is easier to implement and understand
and the second one allows running the algorithm also on large graphs without having to deal with JVM stack size
limits.
Tarjan's algorithm is explained for example here: - http://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm - http://www.timl.id.au/?p=327 - http://homepages.ecs.vuw.ac.nz/~djp/files/P05.pdf
Modifier and Type | Class and Description |
---|---|
static class |
TarjanSCC.ConnectedComponents |
Constructor and Description |
---|
TarjanSCC(Graph graph,
BooleanEncodedValue accessEnc,
boolean excludeSingleNodeComponents) |
Modifier and Type | Method and Description |
---|---|
TarjanSCC.ConnectedComponents |
findComponents()
Runs Tarjan's algorithm using an explicit stack.
|
TarjanSCC.ConnectedComponents |
findComponentsRecursive()
Runs Tarjan's algorithm in a recursive way.
|
void |
setAdditionalEdgeFilter(EdgeFilter additionalFilter)
Allows adding an additional edge filter to exclude edges while searching for connected components.
|
public TarjanSCC(Graph graph, BooleanEncodedValue accessEnc, boolean excludeSingleNodeComponents)
excludeSingleNodeComponents
- if set to false components that only contain a single node will not be
returned when calling findComponents()
or findComponentsRecursive()
,
which can be useful to save some memory.public void setAdditionalEdgeFilter(EdgeFilter additionalFilter)
public TarjanSCC.ConnectedComponents findComponentsRecursive()
findComponents()
) should be
preferred. However, this recursive implementation is easier to understand.public TarjanSCC.ConnectedComponents findComponents()
Copyright © 2012–2020. All rights reserved.