Class DFSPathFinder<V>
java.lang.Object
tools.refinery.interpreter.rete.itc.alg.misc.DFSPathFinder<V>
- Type Parameters:
V
- the node type of the graph
- All Implemented Interfaces:
IGraphPathFinder<V>
A depth-first search implementation of the
IGraphPathFinder
.
TODO use ITC to filter nodes that must be traversed, instead of checks-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAllPaths
(V sourceNode, V targetNode) Returns the collection of paths from the source node to the target node (if such exists).getAllPathsToTargets
(V sourceNode, Set<V> targetNodes) Returns the collection of paths from the source node to any of the target nodes (if such exists).Returns an arbitrary path from the source node to the target node (if such exists).getShortestPaths
(V sourceNode, V targetNode) Returns the collection of shortest paths from the source node to the target node (if such exists).printPaths
(List<Deque<V>> paths)
-
Constructor Details
-
DFSPathFinder
-
-
Method Details
-
getAllPaths
Description copied from interface:IGraphPathFinder
Returns the collection of paths from the source node to the target node (if such exists). If there is no path between them, an empty collection is returned.- Specified by:
getAllPaths
in interfaceIGraphPathFinder<V>
- Parameters:
sourceNode
- the source node of the pathtargetNode
- the target node of the path- Returns:
- the collection of paths from the source to the target, or empty collection if target is not reachable from source.
-
getAllPathsToTargets
Description copied from interface:IGraphPathFinder
Returns the collection of paths from the source node to any of the target nodes (if such exists). If there is no path between them, an empty collection is returned.- Specified by:
getAllPathsToTargets
in interfaceIGraphPathFinder<V>
- Parameters:
sourceNode
- the source node of the pathtargetNodes
- the set of target nodes of the paths- Returns:
- the collection of paths from the source to any of the targets, or empty collection if neither target is reachable from source.
-
getPaths
-
printPaths
-
getPath
Description copied from interface:IGraphPathFinder
Returns an arbitrary path from the source node to the target node (if such exists). If there is no path between them, an empty collection is returned.- Specified by:
getPath
in interfaceIGraphPathFinder<V>
- Parameters:
sourceNode
- the source node of the pathtargetNode
- the target node of the path- Returns:
- the path from the source to the target, or empty collection if target is not reachable from source.
-
getShortestPaths
Description copied from interface:IGraphPathFinder
Returns the collection of shortest paths from the source node to the target node (if such exists). If there is no path between them, an empty collection is returned.- Specified by:
getShortestPaths
in interfaceIGraphPathFinder<V>
- Parameters:
sourceNode
- the source node of the pathtargetNode
- the target node of the path- Returns:
- the collection of shortest paths from the source to the target, or empty collection if target is not reachable from source.
-