# ``igraph`.`clustering``

module documentation
(source)

Classes related to graph clustering.

Function | `_biconnected_components` | Calculates the biconnected components of the graph.
Function | `_clusters` | Deprecated alias to `Graph.connected_components()`.
Function | `_cohesive_blocks` | Calculates the cohesive block structure of the graph.
Function | `_connected_components` | Calculates the (strong or weak) connected components for a given graph.
Function | `_handle_mark_groups_arg_for_clustering` | Handles the mark_groups=... keyword argument in plotting methods of clusterings.
Function | `_prepare_community_comparison` | Auxiliary method that takes two community structures either as membership lists or instances of `Clustering`, and returns a tuple whose two elements are membership lists.

def _biconnected_components(graph, return_articulation_points=False): (source)

Calculates the biconnected components of the graph.

Parameters
graph | Undocumented
return_articulation_points | whether to return the articulation points as well

Returns
a `VertexCover` object describing the biconnected components, and optionally the list of articulation points as well

def _clusters(graph, mode='strong'): (source)

Deprecated alias to `Graph.connected_components()`.

def _cohesive_blocks(graph): (source)

Calculates the cohesive block structure of the graph.

Cohesive blocking is a method of determining hierarchical subsets of graph vertices based on their structural cohesion (i.e. vertex connectivity). For a given graph G, a subset of its vertices S is said to be maximally k-cohesive if there is no superset of S with vertex connectivity greater than or equal to k. Cohesive blocking is a process through which, given a k-cohesive set of vertices, maximally l-cohesive subsets are recursively identified with l > k. Thus a hierarchy of vertex subsets is obtained in the end, with the entire graph G at its root.

Returns
an instance of `CohesiveBlocks`. See the documentation of `CohesiveBlocks` for more information.

See Also
`CohesiveBlocks`

def _connected_components(graph, mode='strong'): (source)

Calculates the (strong or weak) connected components for a given graph.

Parameters
graph | Undocumented
mode | must be either `"strong"` or `"weak"`, depending on the connected components being sought. Optional, defaults to `"strong"`.

Returns
a `VertexClustering` object

def _handle_mark_groups_arg_for_clustering(mark_groups, clustering): (source)

Handles the mark_groups=... keyword argument in plotting methods of clusterings.

This is an internal method, you shouldn't need to mess around with it. Its purpose is to handle the extended semantics of the mark_groups=... keyword argument in the `__plot__` method of `VertexClustering` and `VertexCover` instances, namely the feature that numeric IDs are resolved to clusters automatically.

def _prepare_community_comparison(comm1, comm2, remove_none=False): (source)

Auxiliary method that takes two community structures either as membership lists or instances of `Clustering`, and returns a tuple whose two elements are membership lists.

This is used by `compare_communities` and `split_join_distance`.

Parameters
comm1 | the first community structure as a membership list or as a `Clustering` object.
comm2 | the second community structure as a membership list or as a `Clustering` object.
remove_none | whether to remove `None` entries from the membership lists. If `remove_none` is `False`, a `None` entry in either `comm1` or `comm2` will result in an exception. If `remove_none` is `True`, `None` values are filtered away and only the remaining lists are compared.