Advertisement
lsegura

finding nodes

Aug 21st, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1.         if matches is None:
  2.             matches = []
  3.         parents = self.tree.keys()
  4.         if ttype in self.ttypes and ttype not in matches:
  5.             matches.append(ttype)
  6.         for node in parents:
  7.             if ttype == node:
  8.                 #matches.append(node)
  9.                 for child in self.tree[node]:
  10.                     self.find_the_node(child, matches)
  11.                     if child not in parents:
  12.                         matches.append(child)
  13.            # else:
  14.            #     for child in self.tree[node]:
  15.            #         if ttype == child and ttype not in matches:
  16.            #             matches.append(child)
  17.         return matches
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement