aysylu / loom

Graph library for Clojure. Mailing list https://groups.google.com/forum/#!forum/loom-clj
http://aysy.lu/loom/
886 stars 108 forks source link

bipartite-color fails for digraphs with nodes containing no outgoing edges #118

Open prismofeverything opened 5 years ago

prismofeverything commented 5 years ago

The function bipartite-color will fail (non-deterministically!) for digraphs if it contains at least one node with no outgoing edges due to the use of successors here: https://github.com/aysylu/loom/blob/master/src/loom/alg.cljc#L438

There is discussion on this issue here (it was discovered while attempting to use ubergraph): https://github.com/Engelberg/ubergraph/issues/35

I have submitted a PR with a fix here: https://github.com/aysylu/loom/pull/117

I find the solution simple and straightforward, but I would appreciate any feedback from the Loom team about this as I know there may be larger considerations I am missing. Thanks!