Class GraphPartitioner

Object
GraphPartitioner
All Implemented Interfaces:
GraphWalker

public class GraphPartitioner extends Object implements GraphWalker
Creates a collection of connected graphs from a single graph. A connected graph in which for every two pair of nodes, there is a path between them.
Author:
Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
  • Constructor Details

    • GraphPartitioner

      public GraphPartitioner(Graph graph)
      Constructs a new partitioner for a graph.
      Parameters:
      graph - Graph to be partitioned.
  • Method Details

    • partition

      public boolean partition()
      Performs the partition.
      Returns:
      True if the partition was successful, otherwise false.
    • getPartitions

      public ArrayList<Serializable> getPartitions()
      Returns the partitions of the graph.
      Returns:
      A collection of Graph objects.
      See Also:
    • visit

      public int visit(Graphable element, GraphTraversal traversal)
      Adds the element to the current partition.
      Specified by:
      visit in interface GraphWalker
      Parameters:
      element - The component being visited.
      traversal - The traversal controlling the sequence of graph component visits.
      Returns:
      GraphTraversal#CONTINUE to signal that the traversal should continue.
      GraphTraversal#CONTINUE to signal that the traversal should suspend.
      GraphTraversal#KILL_BRANCH to signal that the traversal should kill its current branch.
      GraphTraversal#STOP to signal that the traversal should stop.
      See Also:
    • finish

      public void finish()
      Adds the current partition to the completed set of partitions and creates a new partition.
      Specified by:
      finish in interface GraphWalker
      See Also: