File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 11
22# adapted from osmnx: https://github.com/gboeing/osmnx/blob/main/osmnx/simplification.py
3+ """
4+ Predicate wether v is source node in g
5+ """
6+ is_source (g:: AbstractGraph , v) = outdegree (g, v) == 0
7+
8+ """
9+ Predicate wether v is sink node in g
10+ """
11+ is_sink (g:: AbstractGraph , v) = indegree (g, v) == 0
12+
313
414"""
515Predicate wether v is an edge endpoint in the simplified version of g
616"""
717function is_endpoint (g:: AbstractGraph , v)
818 neighbors = all_neighbors (g, v)
9- if v in neighbors # has self loop
19+ if is_source (g, v) || is_sink (g, v)
1020 return true
11- elseif outdegree (g, v) == 0 || indegree (g, v) == 0 # sink or source
21+ elseif v in neighbors # has self loop
1222 return true
1323 elseif length (neighbors) != 2 || indegree (g, v) != outdegree (g, v) # change to/from one way
1424 return true
You can’t perform that action at this time.
0 commit comments