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

Use property map for out-degree

This seems to be a little faster, even if we do not use out-degree for
all the nodes. For `Global_1993_2023/Graph_anti`, this commit reduces the time
to define `traj_prop` from 23 s to 20 s.
parent 86e7612c
No related branches found
No related tags found
No related merge requests found
......@@ -76,6 +76,7 @@ traj_vert_ind = []
# of vertex indices.
in_deg_prop = g.degree_property_map("in")
out_deg_prop = g.degree_property_map("out")
# Loop to define traj_prop:
for n in topology.topological_sort(g):
......@@ -89,11 +90,11 @@ for n in topology.topological_sort(g):
pred = g.get_in_neighbors(n)
if in_deg_prop[pred[0]] == 1 == in_deg_prop[pred[1]] \
and np.all(g.get_out_degrees(pred) == 1):
== out_deg_prop[pred[0]] == out_deg_prop[pred[1]]:
n1 = g.get_in_neighbors(pred[0])[0]
n2 = g.get_in_neighbors(pred[1])[0]
if n1 == n2 and g.vertex(n1).out_degree() == 2:
if n1 == n2 and out_deg_prop[n1] == 2:
# We have a splitting event at n1 immediately followed
# by a merging at n. Check the time interval between
# splitting and merging. The date of merging is the
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment