python - 如何在图表中标记特定类型(例如 030T)的所有三元组?
问题描述
我有一个数据框 df :
Source, Target
aaaa, bbbb
aaaa, cccc
aaaa, dddd
bbbb, cccc
cccc, dddd
等等。
文件“total_edges.csv”(71kb):https ://uni-duisburg-essen.sciebo.de/s/WLDD4ytkjekVcIL
我得到一个图形对象,并且根据 github 问题跟踪器(https://github.com/igraph/python-igraph/issues/253)三元组节点/边缘,但它失败了:
import pandas as pd
import igraph as ig
df_edges = pd.read_csv("total_edges.csv")
g = ig.Graph.TupleList(df_edges.itertuples(index=False), directed=True)
tc = g.triad_census()
ffl = ig.Graph.Formula("A --> B --> C, A --> C")
result = g.get_subisomorphisms_lad(ffl, induced=True)
print(result)
错误消息(带有更新的 Pop_OS x64、Python 3.7.5 的 VM):
Traceback (most recent call last):
File "count_triads.py", line 20, in <module>
ffl = ig.Graph.Formula("A --> B --> C, A --> C")
File "/home/admin/.local/lib/python3.7/site-packages/igraph/formula.py", line 209, in construct_graph_from_formula
for start_names, end_names, arrowheads in generate_edges(part):
File "/home/admin/.local/lib/python3.7/site-packages/igraph/formula.py", line 90, in generate_edges
raise SyntaxError(msg)
SyntaxError: invalid token found in edge specification: A --> B --> C
如何使用三元组类型 030T 的三元组值(A、B、C、无)标记该图中的所有节点,以便我可以以不同的方式过滤/绘制三元组和非三元组?
解决方案
关于该错误,您似乎在公式解析器中遇到了与此问题类似的问题。
尝试应用最近的更改或安装 python-igraph 的开发版本可能会有所帮助。
推荐阅读
- javascript - 数据表不重新加载ajax
- jquery - 单击类名从多个类中获取唯一的 id 值
- reactjs - 可分配给“P”类型的约束,但“P”可以用约束“TextInputProps”的不同子类型来实例化
- python - 如何在 python 的 itertools.islice() 函数中打开关闭的 _io.TextIoWrapper 对象?
- javascript - 类成员变量是动态的。取决于打字稿中地图的键
- apache - 更改域完全重定向所有 URL,除了一个必须重定向到不同 URL 的 URL
- python-3.7 - 如何从 PySimpleGUI 中读取多行元素
- excel - 如何在电源查询连接字符串 Excel 中添加登录凭据
- python - 尝试使用 tensorflow 2 在 SavedModel 上进行预测时出错
- python - Django Rest Api Annotate group by Filter 显示错误?