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

class documentation

The cover of the vertex set of a graph.

This class extends `Cover`

by linking it to a specific `Graph`

object. It also provides some handy methods like getting the subgraph corresponding to a cluster and such.

Note | since this class is linked to a `Graph` , destroying the graph by the `del` operator does not free the memory occupied by the graph if there exists a `VertexCover` that references the `Graph` . |

Method | `__plot__` |
Plots the cover to the given Cairo context in the given bounding box. |

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. |

Method | `_formatted_cluster_iterator` |
Iterates over the clusters and formats them into a string to be presented in the summary. |

Instance Variable | `_graph` |
Undocumented |

Inherited from `Cover`

:

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 | `size_histogram` |
Returns the histogram of cluster sizes. |

Method | `sizes` |
Returns the size of given clusters. |

Method | `summary` |
Returns the summary of the cover. |

Instance Variable | `_clusters` |
Undocumented |

Instance Variable | `_n` |
Undocumented |

def __init__(self, graph, clusters=None):

overrides

`igraph.clustering.Cover.__init__`

overridden in

`igraph.clustering.CohesiveBlocks`

Creates a cover object for a given graph.

Parameters | graph | the graph that will be associated to the cover |

clusters | the list of clusters. If `None` , it is assumed that there is only a single cluster that covers the whole graph. |

def crossing(self):

Returns a boolean vector where element *i* is `True`

iff edge *i* lies between clusters, `False`

otherwise.

def subgraph(self, idx):

Get the subgraph belonging to a given cluster.

Precondition: the vertex set of the graph hasn't been modified since the moment the cover was constructed.

Parameters | idx | the cluster index |

Returns | a copy of the subgraph |

def subgraphs(self):

Gets all the subgraphs belonging to each of the clusters.

Precondition: the vertex set of the graph hasn't been modified since the moment the cover was constructed.

Returns | a list containing copies of the subgraphs |

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

overridden in

`igraph.clustering.CohesiveBlocks`

Plots the cover to the given Cairo context in the given bounding box.

This is done by calling `Graph.__plot__()`

with the same arguments, but drawing nice colored blobs around the vertex groups.

This method understands all the positional and keyword arguments that are understood by `Graph.__plot__()`

, only the differences will be highlighted here:

`mark_groups`

: whether to highlight the vertex clusters by colored polygons. Besides the values accepted by`Graph.__plot__`

(i.e., a dict mapping colors to vertex indices, a list containing lists of vertex indices, or`False`

), the following are also accepted:`True`

: all the clusters will be highlighted, the colors matching the corresponding color indices from the current palette (see the`palette`

keyword argument of`Graph.__plot__`

.- A dict mapping cluster indices or tuples of vertex indices to color names. The given clusters or vertex groups will be highlighted by the given colors.
- A list of cluster indices. This is equivalent to passing a dict mapping numeric color indices from the current palette to cluster indices; therefore, the cluster referred to by element
*i*of the list will be highlighted by color*i*from the palette.

The value of the

`plotting.mark_groups`

configuration key is also taken into account here; if that configuration key is`True`

and`mark_groups`

is not given explicitly, it will automatically be set to`True`

.In place of lists of vertex indices, you may also use

`VertexSeq`

instances.In place of color names, you may also use color indices into the current palette.

`None`

as a color name will mean that the corresponding group is ignored.`palette`

: the palette used to resolve numeric color indices to RGBA values. By default, this is an instance of`ClusterColoringPalette`

.

See Also | `Graph.__plot__()` for more supported keyword arguments. |