11 forbid = list(filter(
lambda x: vis[x] == 1, edges[u]))
12 assert len(forbid) == 0,
'Graph is not DAG'
13 nxt = list(filter(
lambda x: vis[x] == 0, edges[u]))
43 for idx, ch
in enumerate(tree.children):
44 if ch.data ==
'vardeclinit':
45 var_name = ch.children[0]
46 var_dict[str(var_name)] = (idx, ch)
47 if len(ch.children) == 3:
49 if dep.data ==
'hvarref':
50 prev = dep.children[0]
51 edge.setdefault(var_name, list()).append(prev)
55 indices = sorted(list(map(
lambda x: var_dict[x][0], sorted_noes)))
56 for idx, n
in zip(indices, sorted_noes):
57 tree.children[idx] = var_dict[n][1]