如何在图形中标记特定类型(例如030T)的所有空间坐标轴?

2024-04-19 06:06:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个数据帧df:

Source, Target
aaaa, bbbb
aaaa, cccc
aaaa, dddd
bbbb, cccc
cccc, dddd

等等。你知道吗

文件“总计_边缘.csv“(71kb):https://uni-duisburg-essen.sciebo.de/s/WLDD4ytkjekVcIL

我得到一个graph对象,根据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的虚拟机):

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、None)标记该图中的所有节点,以便以不同方式过滤/绘制空间坐标轴和非空间坐标轴?你知道吗


Tags: csvinpydfline空间filegraph