Python lib NetworkX:CPU未充分利用

问题描述

当我在计算全局度量时:

  • nx.average_shortest_path_length
  • nx.直径

我注意到我的 cpu 内核没有被使用,只有一个内核的 40%。 这似乎非常低效。有没有办法充分利用我的 cpu 内核?

这是我的测试代码

import networkx as nx

data2 = open('bigrams/bigrams_sve.txt','r',encoding='utf-8')

G2 = nx.read_edgelist(data2,nodetype=str,data=(
    ('weight',int),),create_using=nx.DiGraph())

average_path_lenght = nx.average_shortest_path_length(G2)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)