V - the type parameter of the nodes in the graph data sourcepublic class DRedAlg<V> extends java.lang.Object implements IGraphObserver<V>, ITcDataSource<V>
| Constructor and Description |
|---|
DRedAlg(IGraphDataSource<V> gds)
Constructs a new DRED algorithm and initializes the transitive closure relation with the given graph data source.
|
DRedAlg(IGraphDataSource<V> gds,
DRedTcRelation<V> tc)
Constructs a new DRED algorithm and initializes the transitive closure relation with the given relation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attachObserver(ITcObserver<V> to)
Attach a transitive closure relation observer.
|
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. |
DRedTcRelation<V> |
getTcRelation() |
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.
|
protected void |
notifyTcObservers(java.util.Set<Tuple<V>> tuples,
int dir) |
void |
setTcRelation(DRedTcRelation<V> tc) |
public DRedAlg(IGraphDataSource<V> gds)
gds - the graph data source instancepublic DRedAlg(IGraphDataSource<V> gds, DRedTcRelation<V> tc)
gds - the graph data source instancetc - the transitive closure instancepublic 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 DRedTcRelation<V> getTcRelation()
public void setTcRelation(DRedTcRelation<V> tc)
public boolean isReachable(V source, V target)
ITcDataSourceisReachable in interface ITcDataSource<V>source - the source nodetarget - the target 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 void dispose()
ITcDataSourcedispose in interface ITcDataSource<V>public IGraphPathFinder<V> getPathFinder()
ITcDataSourceIGraphPathFinder can be used to retrieve paths between nodes using transitive reachability.getPathFinder in interface ITcDataSource<V>