my Minimum cost network flow cost in networkx takes a lot of time to be calculated

628 Views Asked by At

I am new to python and I have this digraph, with almost 2109 nodes and 6322 edges, at each iteration i am changing the demand of some nodes and weight of some edges at each iteration using:
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  

it takes hours for the code to give me the minimum cost glow of the graph, is there anyway to speed it up?

0

There are 0 best solutions below