code: def _single_tree_paths(self, tree):
      
      skel = tree.consolidate()
  
      tree = defaultdict(list)
  
      for edge in skel.edges:
        svert = edge[0]
        evert = edge[1]
        tree[svert].append(evert)
        tree[evert].append(svert)
  
      def dfs(path, visited):
        paths = []
        stack = [ (path, visited) ]
        
        while stack:
          path, visited = stack.pop(0)
  
          vertex = path[-1]
          children = tree[vertex]
          
          visited[vertex] = True
  
          children = [ child for child in children if not visited[child] ]
  
          if len(children) == 0:
            paths.append(path)
  
          for child in children:
            stack.append( 
              (path + [child], copy.deepcopy(visited))
            )
  
        return paths
        
      root = skel.edges[0,0]
      paths = dfs([root], defaultdict(bool))
  
      root = np.argmax([ len(_) for _ in paths ])
      root = paths[root][-1]
    
      paths = dfs([ root ], defaultdict(bool))
      
      return [ np.flip(skel.vertices[path], axis=0) for path in paths ]
docs: Get all traversal paths from a single tree.