diff --git a/gt_matlab_trajs.py b/gt_matlab_trajs.py index f2de19b1cbd7537d27485f5a8038ed780535c984..b0a248b6b299618d0b040ae4e3c2f6a061994231 100755 --- a/gt_matlab_trajs.py +++ b/gt_matlab_trajs.py @@ -46,16 +46,17 @@ for edge in g.edges(): # source is a split if src.out_degree() > 1: 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.cost_function[e] for e in trg.out_edges()}): - # add trg to src trajectory + if current_cf <= min({g.ep.cost_function[e] + for e in trg.out_edges()}): + # Set trg trajectory to src trajectory g.vp.traj[trg] = g.vp.traj[src] - # else, target is a split or end or continuation else: g.vp.traj[trg] = g.vp.traj[src] - # source is a continuation or root with one out - 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): + 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: + # source is a continuation or root with one out if trg.in_degree() > 1: # if the current cf is the smallest if current_cf <= min({g.ep.cost_function[e] for e in trg.in_edges()}):