V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
onyourroad
V2EX  ›  程序员

有用过 Python 的网络分析包 igraph 的大佬吗,小白有问题求教。

  •  
  •   onyourroad · 2018-03-29 20:14:31 +08:00 · 3396 次点击
    这是一个创建于 2190 天前的主题,其中的信息可能已经有所发展或是发生改变。
    第 1 条附言  ·  2018-03-31 08:19:45 +08:00
    ~~~py
    import igraph

    tedges = []
    with open("test.txt", "r") as f:
    while 1:
    row = f.readline()[:-1]
    if not row:
    break
    row = row.split(" ")
    u, v = [i for i in row]
    tedges.append((u, v))
    g = igraph.Graph.TupleList(tedges, directed=False)
    p = g.community_infomap()
    Q = g.modularity(p)
    print Q
    ~~~
    在 windows 上运行 igraph,结果一直报错“ module has no attribute Graph ”
    2 条回复    2018-03-30 11:21:47 +08:00
    ebingtel
        1
    ebingtel  
       2018-03-30 09:30:13 +08:00
    ……这不是问问题的方式
    fanhaipeng0403
        2
    fanhaipeng0403  
       2018-03-30 11:21:47 +08:00
    你倒是问啊
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3522 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 10:51 · PVG 18:51 · LAX 03:51 · JFK 06:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.