def predecessor_path(tree, u, v):
 def _traverse(u, v):
  w = tree[u][v]
  if (w == u):
   return []
  return ((_traverse(u, w) + [w]) + _traverse(w, v))
 return (([u] + _traverse(u, v)) + [v])

def predecessor_path ( tree , u , v ) : def _traverse ( u , v ) : w = tree [ u ] [ v ] if ( w == u ) : return [ ] return ( ( _traverse ( u , w ) + [ w ] ) + _traverse ( w , v ) ) return ( ( [ u ] + _traverse ( u , v ) ) + [ v ] )
returns the path between node u and node v as a list of node ids .