V - the type parameter of the nodes in the graph data sourcepublic class IncSCCAlg<V> extends java.lang.Object implements IGraphObserver<V>, ITcDataSource<V>
| Modifier and Type | Field and Description |
|---|---|
IBiDirectionalGraphDataSource<V> |
gds |
UnionFind<V> |
sccs |
| Constructor and Description |
|---|
IncSCCAlg(IGraphDataSource<V> graphDataSource) |
| Modifier and Type | Method and Description |
|---|---|
void |
attachObserver(ITcObserver<V> to)
Attach a transitive closure relation observer.
|
boolean |
checkTcRelation(DRedTcRelation<V> tc) |
void |
detachObserver(ITcObserver<V> to)
Detach a transitive closure relation observer.
|
void |
dispose()
Call this method to properly dispose the data structures of a transitive closure algorithm.
|
void |
edgeDeleted(V source,
V target)
Used to notify when an edge is deleted from the graph.
|
void |
edgeInserted(V source,
V target)
Used to notify when an edge is inserted into the graph.
|
java.util.Set<V> |
getAllReachableSources(V target)
Returns all nodes from which the target node is reachable.
|
java.util.Set<V> |
getAllReachableTargets(V source)
Returns all nodes which are reachable from the source node.
|
IGraphPathFinder<V> |
getPathFinder()
The returned
IGraphPathFinder can be used to retrieve paths between nodes using transitive reachability. |
java.util.List<V> |
getReachabilityPath(V source,
V target)
Returns a reachability path between the given source and target elements, or null if no such transitive reachability is present in the graph.
|
java.util.Set<Tuple<V>> |
getTcRelation() |
boolean |
isIsolated(V node) |
boolean |
isReachable(V source,
V target)
Returns true if the target node is reachable from the source node.
|
void |
nodeDeleted(V n)
Used to notify when a node is deleted from the graph.
|
void |
nodeInserted(V n)
Used to notify when a node is inserted into the graph.
|
public IBiDirectionalGraphDataSource<V> gds
public IncSCCAlg(IGraphDataSource<V> graphDataSource)
public void edgeInserted(V source, V target)
IGraphObserveredgeInserted in interface IGraphObserver<V>source - the source of the edgetarget - the target of the edgepublic void edgeDeleted(V source, V target)
IGraphObserveredgeDeleted in interface IGraphObserver<V>source - the source of the edgetarget - the target of the edgepublic void nodeInserted(V n)
IGraphObservernodeInserted in interface IGraphObserver<V>n - the nodepublic void nodeDeleted(V n)
IGraphObservernodeDeleted in interface IGraphObserver<V>n - the nodepublic void attachObserver(ITcObserver<V> to)
ITcDataSourceattachObserver in interface ITcDataSource<V>to - the observer objectpublic void detachObserver(ITcObserver<V> to)
ITcDataSourcedetachObserver in interface ITcDataSource<V>to - the observer objectpublic java.util.Set<V> getAllReachableTargets(V source)
ITcDataSourcegetAllReachableTargets in interface ITcDataSource<V>source - the source nodepublic java.util.Set<V> getAllReachableSources(V target)
ITcDataSourcegetAllReachableSources in interface ITcDataSource<V>target - the target nodepublic boolean isReachable(V source, V target)
ITcDataSourceisReachable in interface ITcDataSource<V>source - the source nodetarget - the target nodepublic java.util.List<V> getReachabilityPath(V source, V target)
ITcDataSourceList contains the nodes along the path
(this means that there is an edge in the graph between two consecutive nodes), including the source and target nodes.
A self loop (one edge) is indicated with the source node being present two times in the returned List.
Note that the paths are not maintained incrementally and in worst case the complexity of the path construction is O(|V|+|E|)
(one depth-first graph traversal). There is no guarantee that the given path is the shortest one between the given two nodes.getReachabilityPath in interface ITcDataSource<V>source - the source nodetarget - the target nodepublic boolean checkTcRelation(DRedTcRelation<V> tc)
public void dispose()
ITcDataSourcedispose in interface ITcDataSource<V>public boolean isIsolated(V node)
public IGraphPathFinder<V> getPathFinder()
ITcDataSourceIGraphPathFinder can be used to retrieve paths between nodes using transitive reachability.getPathFinder in interface ITcDataSource<V>