class documentation

给定图的流程。

这是一个简单的类,用于表示由Graph.maxflow返回的流。它具有以下属性:

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

这个类通常不直接实例化,一切由Graph.maxflow处理。

示例:

>>> from igraph import Graph
>>> g = Graph.Ring(20)
>>> mf = g.maxflow(0, 10)
>>> print(mf.value)
2.0
>>> mf.es["color"] = "red"
方法 __init__ 初始化流。
方法 __repr__ 未记录
方法 __str__ 未记录
属性 flow 返回每条边的流量值。
实例变量 _flow 未记录

继承自 Cut:

属性 cut 返回切割中的边ID
属性 es 返回一个限制在切割中的边选择器
属性 partition 返回根据切割分区的顶点ID
属性 value 返回切割中边的容量总和
实例变量 _cut 未记录
实例变量 _partition 未记录
实例变量 _value 未记录

继承自 VertexClustering(通过 Cut):

类方法 FromAttribute 基于顶点属性的值创建顶点聚类。
方法 __plot__ 将聚类绘制到给定的Cairo上下文或matplotlib Axes上。
方法 as_cover 返回一个VertexCover,其中包含与此聚类相同的簇。
方法 cluster_graph 返回一个图,其中每个聚类被收缩为一个单独的顶点。
方法 crossing 返回一个布尔向量,其中元素 iTrue 当且仅当边 i 位于集群之间,否则为 False
方法 giant 返回聚类图中最大的簇。
方法 recalculate_modularity 重新计算存储的模块化值。
方法 subgraph 获取属于给定集群的子图。
方法 subgraphs 获取属于每个集群的所有子图。
属性 graph 返回属于此对象的图
属性 modularity 返回模块化分数
方法 _formatted_cluster_iterator 遍历集群并将它们格式化为字符串以在摘要中显示。
方法 _recalculate_modularity_safe 重新计算存储的模块化值,并捕获模块化函数引发的所有异常(如果有)。
类变量 _default_palette 未记录
实例变量 _graph 未记录
实例变量 _modularity 未记录
实例变量 _modularity_dirty 未记录
实例变量 _modularity_params 未记录

继承自 Clustering(通过 Cut, VertexClustering):

方法 __getitem__ 返回指定集群的成员。
方法 __iter__ 遍历此聚类中的集群。
方法 __len__ 返回聚类的数量。
方法 compare_to 使用某种相似性或距离度量将此聚类与另一个聚类进行比较。
方法 size 返回给定聚类的大小。
方法 size_histogram 返回聚类大小的直方图。
方法 sizes 返回给定聚类的大小。
方法 summary 返回聚类的摘要。
属性 membership 返回成员向量。
属性 n 返回此聚类覆盖的元素数量。
实例变量 _len 未记录
实例变量 _membership 未记录
def __init__(self, graph, value, flow, cut, partition): (source)

初始化流程。

这不应该直接调用,一切由Graph.maxflow处理。

def __repr__(self): (source)

未记录

def __str__(self): (source)

未记录

返回每条边的流量值。

对于有向图,这只是一个列表,其中元素 i 对应于边 i 上的流量。对于无向图,流量的方向不受限制(因为边是无向的),因此正流量总是表示从较小的顶点ID流向较大的顶点ID,而负流量则表示从较大的顶点ID流向较小的顶点ID。

未记录