我在networkx中的最低成本网络流量成本需要花费大量时间来计算

时间:2014-12-03 06:34:22

标签: python networkx network-flow

我是python的新手,我有这个有向图,有近2109个节点和6322个边,在每次迭代时我都会改变一些节点的需求和每次迭代时某些边的权重:         def ChangeTheNodes():

for cp in xrange (1,int(custNb*per+1)): 
    G.node[cp]['demand']= int(delivery()[cp-1])
return G

def ChangeTheEdges():

for t in xrange (0,per): 
   #between the source and plant1      
    G[0][int(custNb*per+1+plantNb*t)]['weight']= Variable_Cost()[2*t]

    #between the source and the plant2
    G[0][int(custNb*per+2+plantNb*t)]['weight']= Variable_Cost()[2*t+1]  
return G  

代码需要几个小时才能给出图表的最低费用,无论如何还要加快速度吗?

0 个答案:

没有答案