Commit 24a51ac7 authored by Morten Knutsen's avatar Morten Knutsen
Browse files

Remove superflous methods

parent 434d9dfc
......@@ -208,7 +208,6 @@ class Model:
#print "get_path_loads: (%s -> %s) [%s]" % (u,v,path)
cr = utils.calc_ratio
ccr = utils.calc_contrib_ratio
ndio = utils.node_diff_in_out
loadmatrix = {}
......
......@@ -149,39 +149,6 @@ def calc_ratio(G, loads, u, v, discard_inverse=False, no_diff=False, exclude_edg
ratio = 1
return ratio
def calc_contrib_ratio2(G, loads, u, v, discard_inverse=False, exclude_edges=[]):
sum = 0
for (u1,v1,d) in G.in_edges(v):
if (u1,v1) in exclude_edges: continue
if discard_inverse and (u1,v1) == (u,v): continue
sum += float(loads[(u1,v1)])
if sum == 0:
return 0
ratio = loads[(u,v)] / float(sum)
#if ratio < 0 or ratio > 1:
# print "Assertion failed for ratio (%s, %s): %s" \
# % (u, v, ratio)
return ratio
def calc_contrib_ratio(G, loads, u, v, discard_diff=False, exclude_edges=[]):
sum = 0
for (u1,v1,d) in G.in_edges(v):
if (u1,v1) in exclude_edges: continue
sum += float(loads[(u1,v1)])
print "Sum before diff:", sum
ee = []
#if discard_inverse: ee += [(u,v)]
ndiff = node_diff_in_out(G, loads, v, False, ee)
if not discard_diff:
if ndiff > 0:
sum += ndiff
print "Sum after diff:", sum
if sum == 0:
return 0
print "Initial load:", loads[(u,v)]
ratio = loads[(u,v)] / float(sum)
return ratio
def node_diff_in_out(G, loads, node, inverse=False, exclude_edges=[]):
sum_out = 0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment