You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a cycle because a parent needs a reference to a child and a child a reference to the parent. The index is copy, because we may want to store multiple copies of the index in our usage of this lib.
Because the goal of this lib is to make trees (and not graphs), we should add a test with some nodes cycling and fix the code to avoid this if needed.
@ArnaudValensi Are you sure you need parent pointers? If so, please keep them separate so the main parent -> children tree is easy to verify. Cycle detection is non-trivial and far from a cheap check in the general case. For trees the optimal solution is to use non-copy handles. For a DAG, enforce topological insertion order.
By definition trees contain zero cycles. The
Index
implementsCopy
, and the documentation mentions "cycles". This crate implements a directed graph.If you'd like to restrict
vec-tree
to trees, make theIndex
non-Copy.The text was updated successfully, but these errors were encountered: