I have added more test cases and the method fails with some multigraphs and with some self-loops. I have improved the code and a new pull request is coming (including those test cases).


Thank you very much.