python-igraph API reference

List of all classes, functions and methods in python-igraph

class documentation

class CohesiveBlocks(VertexCover):

View In Hierarchy

The cohesive block structure of a graph.

Instances of this type are created by Graph.cohesive_blocks(). See the documentation of Graph.cohesive_blocks() for an explanation of what cohesive blocks are.

This class provides a few more methods that make handling of cohesive block structures easier.

Method __init__ Constructs a new cohesive block structure for the given graph.
Method cohesion Returns the cohesion of the group with the given index.
Method cohesions Returns the list of cohesion values for each group.
Method hierarchy Returns a new graph that describes the hierarchical relationships between the groups.
Method max_cohesion Finds the maximum cohesion score among all the groups that contain the given vertex.
Method max_cohesions For each vertex in the graph, returns the maximum cohesion score among all the groups that contain the vertex.
Method parent Returns the parent group index of the group with the given index or None if the given group is the root.
Method parents Returns the list of parent group indices for each group or None if the given group is the root.
Method __plot__ Plots the cohesive block structure to the given Cairo context in the given bounding box.
Instance Variable _cohesion Undocumented
Instance Variable _parent Undocumented

Inherited from VertexCover:

Method crossing Returns a boolean vector where element i is True iff edge i lies between clusters, False otherwise.
Property graph Returns the graph belonging to this object
Method subgraph Get the subgraph belonging to a given cluster.
Method subgraphs Gets all the subgraphs belonging to each of the clusters.
Instance Variable _graph Undocumented
Method _formatted_cluster_iterator Iterates over the clusters and formats them into a string to be presented in the summary.

Inherited from Cover (via VertexCover):

Method __getitem__ Returns the cluster with the given index.
Method __iter__ Iterates over the clusters in this cover.
Method __len__ Returns the number of clusters in this cover.
Method __str__ Returns a string representation of the cover.
Property membership Returns the membership vector of this cover.
Property n Returns the number of elements in the set covered by this cover.
Method size Returns the size of a given cluster.
Method sizes Returns the size of given clusters.
Method size_histogram Returns the histogram of cluster sizes.
Method summary Returns the summary of the cover.
Instance Variable _clusters Undocumented
Instance Variable _n Undocumented
def __init__(self, graph, blocks=None, cohesion=None, parent=None):

Constructs a new cohesive block structure for the given graph.

If any of blocks, cohesion or parent is None, all the arguments will be ignored and Graph.cohesive_blocks() will be called to calculate the cohesive blocks. Otherwise, these three variables should describe the *result* of a cohesive block structure calculation. Chances are that you never have to construct CohesiveBlocks instances directly, just use Graph.cohesive_blocks().

Parametersgraphthe graph itself
blocksa list containing the blocks; each block is described as a list containing vertex IDs.
cohesionthe cohesion of each block. The length of this list must be equal to the length of blocks.
parentthe parent block of each block. Negative values or None mean that there is no parent block for that block. There should be only one parent block, which covers the entire graph.
See AlsoGraph.cohesive_blocks()
_cohesion =

Undocumented

_parent =

Undocumented

def cohesion(self, idx):

Returns the cohesion of the group with the given index.

def cohesions(self):

Returns the list of cohesion values for each group.

def hierarchy(self):

Returns a new graph that describes the hierarchical relationships between the groups.

The new graph will be a directed tree; an edge will point from vertex i to vertex j if group i is a superset of group j. In other words, the edges point downwards.

def max_cohesion(self, idx):

Finds the maximum cohesion score among all the groups that contain the given vertex.

def max_cohesions(self):

For each vertex in the graph, returns the maximum cohesion score among all the groups that contain the vertex.

def parent(self, idx):

Returns the parent group index of the group with the given index or None if the given group is the root.

def parents(self):

Returns the list of parent group indices for each group or None if the given group is the root.

def __plot__(self, context, bbox, palette, *args, **kwds):

Plots the cohesive block structure to the given Cairo context in the given bounding box.

Since a CohesiveBlocks instance is also a VertexCover, keyword arguments accepted by VertexCover.__plot__() are also accepted here. The only difference is that the vertices are colored according to their maximal cohesions by default, and groups are marked by colored blobs except the last group which encapsulates the whole graph.

See the documentation of VertexCover.__plot__() for more details.

API Documentation for python-igraph, generated by pydoctor 21.2.2 at 2021-10-09 17:40:46.