• 请不要在回答技术问题时复制粘贴 AI 生成的内容
onyourroad
V2EX  ›  程序员

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

  •  
  •   onyourroad · Mar 29, 2018 · 4243 views
    This topic created in 3007 days ago, the information mentioned may be changed or developed.
    Supplement 1  ·  Mar 31, 2018
    ~~~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 replies    2018-03-30 11:21:47 +08:00
    ebingtel
        1
    ebingtel  
       Mar 30, 2018
    ……这不是问问题的方式
    fanhaipeng0403
        2
    fanhaipeng0403  
       Mar 30, 2018
    你倒是问啊
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1297 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 17:13 · PVG 01:13 · LAX 10:13 · JFK 13:13
    ♥ Do have faith in what you're doing.