Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Deal with cross-edges #6

Open
michielbdejong opened this issue Nov 11, 2016 · 3 comments
Open

Deal with cross-edges #6

michielbdejong opened this issue Nov 11, 2016 · 3 comments

Comments

@michielbdejong
Copy link
Contributor

michielbdejong commented Nov 11, 2016

In this graph, node C would falsely conclude it found a cycle (it should mark the treeToken as already backtracked):

a -> b  -> c
|          ^
 \__ d ___/
michielbdejong added a commit that referenced this issue Nov 11, 2016
@michielbdejong
Copy link
Contributor Author

If DDCD did its work correctly, DFS will never backtrack. Will need to construct a test where a link disappears early enough to trigger a backtrack, but late enough so not the whole tree crumbles down.

@michielbdejong
Copy link
Contributor Author

http://www.geeksforgeeks.org/detect-cycle-direct-graph-using-colors/ distinguishes between tree edges (the ones visited first), back-edges (ones that close a cycle, given the tree edges), cross-edges (connects two nodes with common ancestors), and forward edges (from ancestor to descendant).

@michielbdejong
Copy link
Contributor Author

Maybe it's simpler and safer never to try more than one sibling out-neighbor, see ledgerloops/ledgerloops-whitepaper#4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant