Class CycleBreaker
java.lang.Object
org.biopax.paxtools.query.algorithm.BFS
org.biopax.paxtools.query.algorithm.CycleBreaker
When an algorithm searches for a paths between multiple source nodes, or from a source to a
target node (source and targets may overlap), sometimes there comes paths from and to the same
node, i.e cycles. When we want to avoid these cases this class can be used to remove those
cycles in the result set.
- Author:
- Ozgun Babur
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCycleBreaker(Set<GraphObject> result, Set<Node> ST, int limit) Constructor with the objects in the result, source and target nodes, and search limit. -
Method Summary
Modifier and TypeMethodDescriptionvoidRun the algorithm.booleanChecks whether an edge is on an unwanted cycle.protected booleanprocessNode2(Node current) Continue the search from the node.Methods inherited from class org.biopax.paxtools.query.algorithm.BFS
getColor, getLabel, initMaps, isEquivalentInTheSet, isEquivalentInTheSet, labelEquivRecursive, processNode, run, setColor, setLabel
-
Constructor Details
-
CycleBreaker
Constructor with the objects in the result, source and target nodes, and search limit.- Parameters:
result- Result set to search inST- Source and target nodeslimit- Search limit
-
-
Method Details
-
breakCycles
public void breakCycles()Run the algorithm. -
isSafe
Checks whether an edge is on an unwanted cycle.- Parameters:
node- Node that the edge is boundedge- The edge to check- Returns:
- True if no cycle is detected, false otherwise
-
processNode2
Continue the search from the node. 2 is added because a name clash in the parent class.- Parameters:
current- The node to traverse- Returns:
- False if a cycle is detected
-