Are these trees isomorphic?

Python, 83

The anonymous function on the 2nd line is my solution.

f=lambda l,i=0:sorted(f(l,j+1)for j,e in enumerate(l)if e==i)
lambda a,b:f(a)==f(b)

f returns a canonized form of a subtree which is a sorted list of its canonized children. Then we must simply check if the canonized forms of each tree are equal.


Mathematica, 48 bytes

SameQ@@(Sort//@(0(0//.PositionIndex@#))&/@{##})&

It's even shorter than the solution that uses IsomorphicGraphQ:

IsomorphicGraphQ@@(Graph@*MapIndexed[#->Tr@#2&]/@{##})&