class documentation

图的顶点集的覆盖。

该类通过将其链接到特定的Graph对象来扩展Cover。它还提供了一些方便的方法,如获取与集群对应的子图等。

注意
由于此类与Graph相关联,如果存在引用GraphVertexCover,则通过del操作符销毁图不会释放图占用的内存。
方法 __init__ 为给定图创建一个覆盖对象。
方法 __plot__ 将覆盖图绘制到给定的Cairo上下文或matplotlib轴。
方法 crossing 返回一个布尔向量,其中元素 iTrue 当且仅当边 i 位于集群之间,否则为 False
方法 subgraph 获取属于给定集群的子图。
方法 subgraphs 获取属于每个集群的所有子图。
属性 graph 返回属于此对象的图
静态方法 _resolve_names_in_clusters 未记录
方法 _formatted_cluster_iterator 遍历集群并将它们格式化为字符串以在摘要中显示。
实例变量 _graph 未记录

继承自 Cover:

方法 __getitem__ 返回具有给定索引的集群。
方法 __iter__ 遍历此覆盖中的集群。
方法 __len__ 返回此覆盖中的集群数量。
方法 __str__ 返回覆盖的字符串表示。
方法 size 返回给定集群的大小。
方法 size_histogram 返回集群大小的直方图。
方法 sizes 返回给定聚类的大小。
方法 summary 返回覆盖的摘要。
属性 membership 返回此覆盖的成员向量。
属性 n 返回此覆盖集合中的元素数量。
实例变量 _clusters 未记录
实例变量 _n 未记录
def __init__(self, graph, clusters=None): (source)
overridden in igraph.CohesiveBlocks

为给定的图创建一个覆盖对象。

参数
graph将与封面关联的图
clusters集群列表。如果为None,则假定只有一个覆盖整个图的集群。
def __plot__(self, backend, context, *args, **kwds): (source)
overridden in igraph.CohesiveBlocks

将封面绘制到给定的Cairo上下文或matplotlib Axes。

这是通过调用Graph.__plot__()并使用相同的参数来完成的,但在顶点组周围绘制漂亮的彩色斑点。

此方法理解Graph.__plot__()所理解的所有位置参数和关键字参数,这里只强调不同之处:

  • mark_groups: 是否通过彩色多边形突出显示顶点群组。除了Graph.__plot__接受的值(即,将颜色映射到顶点索引的字典,包含顶点索引列表的列表,或False),以下内容也被接受:

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

    这里还考虑了plotting.mark_groups配置键的值;如果该配置键为True且未显式给出mark_groups,它将自动设置为True

    代替顶点索引列表,你也可以使用VertexSeq实例。

    除了使用颜色名称外,您还可以使用当前调色板中的颜色索引。None 作为颜色名称意味着相应的组将被忽略。

  • palette: 用于将数字颜色索引解析为RGBA值的调色板。默认情况下,这是ClusterColoringPalette的一个实例。

另请参阅
Graph.__plot__() 了解更多支持的关键字参数。
def crossing(self): (source)

返回一个布尔向量,其中元素 iTrue 当且仅当边 i 位于集群之间,否则为 False

def subgraph(self, idx): (source)

获取属于给定集群的子图。

前提条件:自覆盖构建以来,图的顶点集未被修改。

参数
idx集群索引
返回
子图的一个副本
def subgraphs(self): (source)

获取属于每个集群的所有子图。

前提条件:自覆盖构建以来,图的顶点集未被修改。

返回
包含子图副本的列表

返回属于此对象的图

@staticmethod
def _resolve_names_in_clusters(graph, clusters): (source)

未记录

def _formatted_cluster_iterator(self): (source)

遍历集群并将它们格式化为字符串以在摘要中显示。

未记录