ekirving / qpbrute

Heuristic search algorithm for fitting qpGraph models
MIT License
9 stars 3 forks source link

Unique solutions that are identical? #17

Closed dbssyck closed 2 years ago

dbssyck commented 2 years ago

Hi Evan,

Not exactly an issue/bug per se (?), but when running qpbrute I am encountering runs with identical results created in the "pdf" folder, but each with unique graph names (and the terminal log counting each of these same results as "unique" solutions). The pdf files look either exactly the same, or with biologically identical results but branches positioned differently. Would just like to check with you if this is expected behaviour?

ekirving commented 2 years ago

Thanks for reporting this issue. It's a know bug, in which a small number of cases result in two models having different unique hashes, but the same rendered topology. The models are technically different, because the internal nodes differ slightly in their representation, but they result in a rendering that is identical. This is not ideal behaviour, and I sketched out a solution a while ago, but did not get around to implementing it.

ekirving commented 2 years ago

The problem arises because the graph structure has unique internal node names, and it is possible to construct identical graph topologies by following different paths through graph space. To identify that that two models are topologically identical, I "flatten" the graph structure, then compute the md5 hashsum to index the models. In some cases, the flattening results in a representation of the topology that is not completely invariant to the path through graph space that was used to construct the graph, which results in this situation.

dbssyck commented 2 years ago

Thanks for the explanation! In cases where graphs appear identical - say, only four of eight graphs appear unique - would it be a sensible idea to calculate bayes factors for just the four of them to save time?

ekirving commented 2 years ago

Yes, that is a totally reasonable thing to do.

dbssyck commented 2 years ago

Sounds great, thank you for the advice!