Class IncSCCAlg<V>
java.lang.Object
tools.refinery.interpreter.rete.itc.alg.incscc.IncSCCAlg<V>
- Type Parameters:
V- the type parameter of the nodes in the graph data source
- All Implemented Interfaces:
IGraphObserver<V>,ITcDataSource<V>
Incremental SCC maintenance + counting algorithm.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidattachObserver(ITcObserver<V> to) Attach a transitive closure relation observer.booleanvoiddetachObserver(ITcObserver<V> to) Detach a transitive closure relation observer.voiddispose()Call this method to properly dispose the data structures of a transitive closure algorithm.voidedgeDeleted(V source, V target) Used to notify when an edge is deleted from the graph.voidedgeInserted(V source, V target) Used to notify when an edge is inserted into the graph.getAllReachableSources(V target) Returns all nodes from which the target node is reachable.getAllReachableTargets(V source) Returns all nodes which are reachable from the source node.The returnedIGraphPathFindercan be used to retrieve paths between nodes using transitive reachability.getReachabilityPath(V source, V target) The graph of SCCs; each SCC is represented by its representative node (seegetRepresentative(Object))getRepresentative(V node) Returns the node that is selected as the representative of the SCC containing the argument.booleanhasIncomingEdges(V root) Returns true if the SCC represented by the given root node has incoming edges in the reduced graph, false otherwise (if this SCC is a source in the reduced graph).booleanhasOutgoingEdges(V root) Returns true if the SCC represented by the given root node has outgoing edges in the reduced graph, false otherwise (if this SCC is a sink in the reduced graph).booleanisIsolated(V node) booleanisReachable(V source, V target) Returns true if the target node is reachable from the source node.voidnodeDeleted(V n) Used to notify when a node is deleted from the graph.voidnodeInserted(V n) Used to notify when a node is inserted into the graph.protected voidCall this method to notify the observers of the transitive closure relation.
-
Field Details
-
sccs
-
gds
-
-
Constructor Details
-
IncSCCAlg
-
-
Method Details
-
edgeInserted
Description copied from interface:IGraphObserverUsed to notify when an edge is inserted into the graph.- Specified by:
edgeInsertedin interfaceIGraphObserver<V>- Parameters:
source- the source of the edgetarget- the target of the edge
-
edgeDeleted
Description copied from interface:IGraphObserverUsed to notify when an edge is deleted from the graph.- Specified by:
edgeDeletedin interfaceIGraphObserver<V>- Parameters:
source- the source of the edgetarget- the target of the edge
-
nodeInserted
Description copied from interface:IGraphObserverUsed to notify when a node is inserted into the graph.- Specified by:
nodeInsertedin interfaceIGraphObserver<V>- Parameters:
n- the node
-
nodeDeleted
Description copied from interface:IGraphObserverUsed to notify when a node is deleted from the graph.- Specified by:
nodeDeletedin interfaceIGraphObserver<V>- Parameters:
n- the node
-
attachObserver
Description copied from interface:ITcDataSourceAttach a transitive closure relation observer.- Specified by:
attachObserverin interfaceITcDataSource<V>- Parameters:
to- the observer object
-
detachObserver
Description copied from interface:ITcDataSourceDetach a transitive closure relation observer.- Specified by:
detachObserverin interfaceITcDataSource<V>- Parameters:
to- the observer object
-
getAllReachableTargets
Description copied from interface:ITcDataSourceReturns all nodes which are reachable from the source node.- Specified by:
getAllReachableTargetsin interfaceITcDataSource<V>- Parameters:
source- the source node- Returns:
- the set of target nodes
-
getAllReachableSources
Description copied from interface:ITcDataSourceReturns all nodes from which the target node is reachable.- Specified by:
getAllReachableSourcesin interfaceITcDataSource<V>- Parameters:
target- the target node- Returns:
- the set of source nodes
-
isReachable
Description copied from interface:ITcDataSourceReturns true if the target node is reachable from the source node.- Specified by:
isReachablein interfaceITcDataSource<V>- Parameters:
source- the source nodetarget- the target node- Returns:
- true if target is reachable from source, false otherwise
-
getReachabilityPath
-
checkTcRelation
-
hasIncomingEdges
Returns true if the SCC represented by the given root node has incoming edges in the reduced graph, false otherwise (if this SCC is a source in the reduced graph).- Parameters:
root- the root node of an SCC- Returns:
- true if it has incoming edges, false otherwise
- Since:
- 1.6
-
hasOutgoingEdges
Returns true if the SCC represented by the given root node has outgoing edges in the reduced graph, false otherwise (if this SCC is a sink in the reduced graph).- Parameters:
root- the root node of an SCC- Returns:
- true if it has outgoing edges, false otherwise
- Since:
- 1.6
-
dispose
public void dispose()Description copied from interface:ITcDataSourceCall this method to properly dispose the data structures of a transitive closure algorithm.- Specified by:
disposein interfaceITcDataSource<V>
-
notifyTcObservers
Call this method to notify the observers of the transitive closure relation. The tuples used in the notification will be the Descartes product of the two sets given.- Parameters:
sources- the source nodestargets- the target nodesdirection-
-
getRepresentative
Returns the node that is selected as the representative of the SCC containing the argument.- Since:
- 1.6
-
getTcRelation
-
isIsolated
-
getPathFinder
Description copied from interface:ITcDataSourceThe returnedIGraphPathFindercan be used to retrieve paths between nodes using transitive reachability.- Specified by:
getPathFinderin interfaceITcDataSource<V>- Returns:
- a path finder for the graph.
-
getReducedGraph
The graph of SCCs; each SCC is represented by its representative node (seegetRepresentative(Object))- Since:
- 1.6
-