Class VertexPartition<V,E>
java.lang.Object
edu.uci.ics.jung.algorithms.blockmodel.VertexPartition<V,E>
Maintains information about a vertex partition of a graph.
This can be built from a map from vertices to vertex sets
or from a collection of (disjoint) vertex sets,
such as those created by various clustering methods.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionVertexPartition
(Graph<V, E> g, Collection<Set<V>> vertex_sets) Creates an instance based on the specified graph and set of disjoint vertex sets, and generates a vertex-to-partition map based on these sets.Creates an instance based on the specified graph and mapping from vertices to vertex sets, and generates a set of partitions based on this mapping.Creates an instance based on the specified graph, vertex-set mapping, and set of disjoint vertex sets. -
Method Summary
Modifier and TypeMethodDescriptiongetGraph()
Returns the graph on which the partition is defined.Collection
<Set<V>> Returns a collection of vertex sets, where each vertex in the input graph is in exactly one set.Returns a map from each vertex in the input graph to its partition.int
toString()
-
Field Details
-
vertex_partition_map
-
vertex_sets
-
graph
-
-
Constructor Details
-
VertexPartition
Creates an instance based on the specified graph and mapping from vertices to vertex sets, and generates a set of partitions based on this mapping.- Parameters:
g
- the graph over which the vertex partition is definedpartition_map
- the mapping from vertices to vertex sets (partitions)
-
VertexPartition
Creates an instance based on the specified graph, vertex-set mapping, and set of disjoint vertex sets. The vertex-set mapping and vertex partitions must be consistent; that is, the mapping must reflect the division of vertices into partitions, and each vertex must appear in exactly one partition.- Parameters:
g
- the graph over which the vertex partition is definedpartition_map
- the mapping from vertices to vertex sets (partitions)vertex_sets
- the set of disjoint vertex sets
-
VertexPartition
Creates an instance based on the specified graph and set of disjoint vertex sets, and generates a vertex-to-partition map based on these sets.- Parameters:
g
- the graph over which the vertex partition is definedvertex_sets
- the set of disjoint vertex sets
-
-
Method Details
-
getGraph
Returns the graph on which the partition is defined.- Returns:
- the graph on which the partition is defined
-
getVertexToPartitionMap
Returns a map from each vertex in the input graph to its partition. This map is generated if it does not already exist.- Returns:
- a map from each vertex in the input graph to a vertex set
-
getVertexPartitions
Returns a collection of vertex sets, where each vertex in the input graph is in exactly one set. This collection is generated based on the vertex-to-partition map if it does not already exist.- Returns:
- a collection of vertex sets such that each vertex in the instance's graph is in exactly one set
-
numPartitions
public int numPartitions()- Returns:
- the number of partitions.
-
toString
-