python-igraph API reference

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

class documentation

class Flow(Cut):

View In Hierarchy

A flow of a given graph.

This is a simple class used to represent flows returned by Graph.maxflow. It has the following attributes:

  • graph - the graph on which this flow is defined
  • value - the value (capacity) of the flow
  • flow - the flow values on each edge. For directed graphs, this is simply a list where element i corresponds to the flow on edge i. For undirected graphs, the direction of the flow is not constrained (since the edges are undirected), hence positive flow always means a flow from the smaller vertex ID to the larger, while negative flow means a flow from the larger vertex ID to the smaller.
  • cut - edge IDs in the minimal cut corresponding to the flow.
  • partition - vertex IDs in the parts created after removing edges in the cut
  • es - an edge selector restricted to the edges in the cut.

This class is usually not instantiated directly, everything is taken care of by Graph.maxflow.

Examples:

>>> from igraph import Graph
>>> g = Graph.Ring(20)
>>> mf = g.maxflow(0, 10)
>>> print(mf.value)
2.0
>>> mf.es["color"] = "red"
Method __init__ Initializes the flow.
Method __repr__ Undocumented
Method __str__ Undocumented
Property flow Returns the flow values for each edge.
Instance Variable _flow Undocumented

Inherited from Cut:

Property es Returns an edge selector restricted to the cut
Property partition Returns the vertex IDs partitioned according to the cut
Property cut Returns the edge IDs in the cut
Property value Returns the sum of edge capacities in the cut
Instance Variable _value Undocumented
Instance Variable _partition Undocumented
Instance Variable _cut Undocumented

Inherited from VertexClustering (via Cut):

Class Method FromAttribute Creates a vertex clustering based on the value of a vertex attribute.
Method as_cover Returns a VertexCover that contains the same clusters as this clustering.
Method cluster_graph Returns a graph where each cluster is contracted into a single vertex.
Method crossing Returns a boolean vector where element i is True iff edge i lies between clusters, False otherwise.
Property modularity Returns the modularity score
Property graph Returns the graph belonging to this object
Method recalculate_modularity Recalculates the stored modularity value.
Method subgraph Get the subgraph belonging to a given cluster.
Method subgraphs Gets all the subgraphs belonging to each of the clusters.
Method giant Returns the largest cluster of the clustered graph.
Method __plot__ Plots the clustering to the given Cairo context in the given bounding box.
Class Variable _default_palette Undocumented
Instance Variable _graph Undocumented
Instance Variable _modularity Undocumented
Instance Variable _modularity_dirty Undocumented
Instance Variable _modularity_params Undocumented
Method _recalculate_modularity_safe Recalculates the stored modularity value and swallows all exceptions raised by the modularity function (if any).
Method _formatted_cluster_iterator Iterates over the clusters and formats them into a string to be presented in the summary.

Inherited from Clustering (via Cut, VertexClustering):

Method __getitem__ Returns the members of the specified cluster.
Method __iter__ Iterates over the clusters in this clustering.
Method __len__ Returns the number of clusters.
Method compare_to Compares this clustering to another one using some similarity or distance metric.
Property membership Returns the membership vector.
Property n Returns the number of elements covered by this clustering.
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 clustering.
Instance Variable _membership Undocumented
Instance Variable _len Undocumented
def __init__(self, graph, value, flow, cut, partition):

Initializes the flow.

This should not be called directly, everything is taken care of by Graph.maxflow.

_flow =

Undocumented

def __repr__(self):

Undocumented

def __str__(self):

Undocumented

@property
flow =

Returns the flow values for each edge.

For directed graphs, this is simply a list where element i corresponds to the flow on edge i. For undirected graphs, the direction of the flow is not constrained (since the edges are undirected), hence positive flow always means a flow from the smaller vertex ID to the larger, while negative flow means a flow from the larger vertex ID to the smaller.

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