A working (but super slow) topological dist metric

Gotta optimize the performance later