igraph layout_reingold_tilford提供了错误 [英] igraph layout_reingold_tilford gives errors

查看:73
本文介绍了igraph layout_reingold_tilford提供了错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用layout_reingold_tilford布局时收到以下错误消息

I get the following error message when trying to use the layout_reingold_tilford layout

init 中的文件"C:\ Python27 \ lib \ site-packages \ igraph \ layout.py",第80行 self._coords = [列出坐标中的坐标] TypeError:"int"对象不可迭代

File "C:\Python27\lib\site-packages\igraph\layout.py", line 80, in init self._coords = [list(coord) for coord in coords] TypeError: 'int' object is not iterable

我发现以下问题具有简单的问题和答案,但是当我尝试该示例时,仍然遇到相同的错误

I have found the following question which has a simple question and answer but when I try the example I get the same error

用根节点位于顶部

import igraph as ig
g = ig.Graph(n = 12, directed=True)
g.add_edges([(1,0),(2,1), (3,2), (4,3),
         (5,1),
         (6,2), (7,6), (8,7),
         (9,0),
         (10,0), (11,10)])
g.vs["label"] = ["A", "B", "A", "B", "C", "F", "C", "B", "D", "C", "D", "F"]
layout = g.layout_reingold_tilford(mode="in", root=0)
ig.plot(g, layout=layout)

推荐答案

查看

Looking at the C implementation of this function, root is considered to be in iterable only, however the documentation is a bit confusing: "the index of the root vertex or root vertices".

尝试改用root=[0].

这篇关于igraph layout_reingold_tilford提供了错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆