Skip to content
Snippets Groups Projects
Commit 5f06a449 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Correct name of property to `cost_function`

Correct name of property from `nl_cost_function` to `cost_function`.
parent 0f351dd5
No related branches found
No related tags found
No related merge requests found
......@@ -55,37 +55,37 @@ g.load(sys.argv[1])
# nl_cf = g.new_ep('float')
# g.ep['nl_cost_function'] = nl_cf
# g.ep['cost_function'] = nl_cf
traj_mark = g.new_vp('int')
g.vp['traj'] = traj_mark
# g.ep.nl_cost_function[e1] = 6
# g.ep.nl_cost_function[e2] = 2
# g.ep.nl_cost_function[e3] = 7
# g.ep.nl_cost_function[e4] = 8
# g.ep.nl_cost_function[e5] = 4
# g.ep.nl_cost_function[e6] = 2
# g.ep.nl_cost_function[e7] = 10
# g.ep.nl_cost_function[e8] = 11
# g.ep.nl_cost_function[e9] = 2
# g.ep.nl_cost_function[e10] = 3
# g.ep.nl_cost_function[e11] = 2
# g.ep.nl_cost_function[e12] = 6
# g.ep.nl_cost_function[e13] = 4
# g.ep.nl_cost_function[e14] = 10
# g.ep.nl_cost_function[e15] = 6
# g.ep.nl_cost_function[e16] = 2
# g.ep.nl_cost_function[e17] = 4
# g.ep.nl_cost_function[e18] = 5
# g.ep.nl_cost_function[e19] = 6
# g.ep.nl_cost_function[e20] = 3
# g.ep.nl_cost_function[e21] = 2
# g.ep.nl_cost_function[e22] = 1
# g.ep.nl_cost_function[e23] = 7
# g.ep.nl_cost_function[e24] = 6
# g.ep.nl_cost_function[e25] = 8
# g.ep.nl_cost_function[e26] = 7
# g.ep.cost_function[e1] = 6
# g.ep.cost_function[e2] = 2
# g.ep.cost_function[e3] = 7
# g.ep.cost_function[e4] = 8
# g.ep.cost_function[e5] = 4
# g.ep.cost_function[e6] = 2
# g.ep.cost_function[e7] = 10
# g.ep.cost_function[e8] = 11
# g.ep.cost_function[e9] = 2
# g.ep.cost_function[e10] = 3
# g.ep.cost_function[e11] = 2
# g.ep.cost_function[e12] = 6
# g.ep.cost_function[e13] = 4
# g.ep.cost_function[e14] = 10
# g.ep.cost_function[e15] = 6
# g.ep.cost_function[e16] = 2
# g.ep.cost_function[e17] = 4
# g.ep.cost_function[e18] = 5
# g.ep.cost_function[e19] = 6
# g.ep.cost_function[e20] = 3
# g.ep.cost_function[e21] = 2
# g.ep.cost_function[e22] = 1
# g.ep.cost_function[e23] = 7
# g.ep.cost_function[e24] = 6
# g.ep.cost_function[e25] = 8
# g.ep.cost_function[e26] = 7
# name = g.new_vp('string')
# g.vp['name'] = name
......@@ -107,16 +107,16 @@ for node in g.vertices():
print('Algorithm starting...')
for edge in g.edges():
current_cf = g.ep.nl_cost_function[edge]
current_cf = g.ep.cost_function[edge]
src = edge.source()
trg = edge.target()
# source is a split
if src.out_degree() > 1:
if current_cf <= min({g.ep.nl_cost_function[e] for e in src.out_edges()}):
if current_cf <= min({g.ep.cost_function[e] for e in src.out_edges()}):
# elif target is a merge
if trg.in_degree() > 1:
if current_cf <= min({g.ep.nl_cost_function[e] for e in trg.out_edges()}):
if current_cf <= min({g.ep.cost_function[e] for e in trg.out_edges()}):
# add trg to src trajectory
g.vp.traj[trg] = g.vp.traj[src]
# else, target is a split or end or continuation
......@@ -126,7 +126,7 @@ for edge in g.edges():
elif (src.in_degree() == 1 and src.out_degree() == 1) or (src.in_degree() == 0 and src.out_degree() == 1) or (src.in_degree() > 1):
if trg.in_degree() > 1:
# if the current cf is the smallest
if current_cf <= min({g.ep.nl_cost_function[e] for e in trg.in_edges()}):
if current_cf <= min({g.ep.cost_function[e] for e in trg.in_edges()}):
g.vp.traj[trg] = g.vp.traj[src]
else:
g.vp.traj[trg] = g.vp.traj[src]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment