Comparison of cyclic objects (was RE: [Python-Dev] trashcan and PR#7)

Tim Peters tim_one@email.msn.com
Thu, 13 Apr 2000 22:32:44 -0400


[Jeremy Hylton]
> I'm not familiar with any algorithms for the graph isomorphism
> problem,

Well, while an instance of graph isomorphism, this one is a relatively
simple special case (because "the graphs" here are rooted, directed, and
have ordered children).

> but I took a stab at a simple comparison algorithm.  The idea
> is to detect comparisons that would cross back-edges in the object
> graphs.  Instead of starting a new comparison, assume they are the
> same.  If, in fact, the objects are not the same, they must differ in
> some other way; some other part of the comparison will fail.

Bingo!  That's the key trick.