Class CycleBreaker

java.lang.Object
org.biopax.paxtools.query.algorithm.BFS
org.biopax.paxtools.query.algorithm.CycleBreaker

public class CycleBreaker extends BFS
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
  • Constructor Details

    • CycleBreaker

      public CycleBreaker(Set<GraphObject> result, Set<Node> ST, int limit)
      Constructor with the objects in the result, source and target nodes, and search limit.
      Parameters:
      result - Result set to search in
      ST - Source and target nodes
      limit - Search limit
  • Method Details

    • breakCycles

      public void breakCycles()
      Run the algorithm.
    • isSafe

      public boolean isSafe(Node node, Edge edge)
      Checks whether an edge is on an unwanted cycle.
      Parameters:
      node - Node that the edge is bound
      edge - The edge to check
      Returns:
      True if no cycle is detected, false otherwise
    • processNode2

      protected boolean processNode2(Node current)
      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