Package org.geotools.graph.util.graph
Class GraphPartitioner
Object
GraphPartitioner
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
finish()
Adds the current partition to the completed set of partitions and creates a new partition.Returns the partitions of the graph.boolean
Performs the partition.int
visit
(Graphable element, GraphTraversal traversal) Adds the element to the current partition.
-
Constructor Details
-
GraphPartitioner
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
Returns the partitions of the graph.- Returns:
- A collection of Graph objects.
- See Also:
-
visit
Adds the element to the current partition.- Specified by:
visit
in interfaceGraphWalker
- 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 interfaceGraphWalker
- See Also:
-