【问题标题】:convert csv File to GML using python or other suggestions使用 python 或其他建议将 csv 文件转换为 GML
【发布时间】:2021-12-29 08:49:56
【问题描述】:

我有一个数据集,其中包含调用列的网络数据,该数据集由表示两列之间连接的两列组成。

数据集可通过以下方式访问:https://docs.google.com/spreadsheets/d/1dViBlP1TP3qFLn6XFWPfsH4R0Y7VVIns/edit?usp=sharing&ouid=111642513965282802880&rtpof=true&sd=true

由于我在 Python 中使用 igraph,我想将此文件转换为 GML 格式以在此处使用: https://live.yworks.com/demos/layout/layoutstyles/index.html 有没有办法做到这一点?

作为对想看看我尝试过的人的回应: enter image description here 我使用了 yworks 命题

【问题讨论】:

  • 您能补充一下您一直在尝试的内容吗?
  • 链接在问题中不合适,而是尝试通过使用较小的示例重新创建表格和图像来重现您需要实现的目标。
  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: python networking graph tree powerbi


【解决方案1】:

要将边缘列表文件 (.edges) 转换为 gml 文件,请尝试以下代码。 我使用了networkx包。

import networkx as nx
G= nx.read_edgelist('414.edges') # load your edgelist file
nx.write_gml(G, "414.gml")   # gml file will be created

欲了解更多信息,请访问https://networkx.org/documentation/stable/reference/readwrite/gml.html#module-networkx.readwrite.gml

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-05
    • 1970-01-01
    • 1970-01-01
    • 2017-08-25
    • 2020-06-19
    • 2012-07-05
    • 2011-05-25
    相关资源
    最近更新 更多