Thanks, Terry, for pushing back a little bit. During my workout a few minutes ago I realized that Terry is right. Leo can and should support general graphs.
You could say I didn't like the sound of my own voice. In writing why graphs wouldn't work, I ironically saw that they would. Indeed, all my former objections were bogus. I'm not sure exactly what triggered the Aha, but let's see what would happen if instead of timidly warning that clones can't be their own ancestors, we just say that they can. - Data: no change required to Leo! - iterators. No real problem! Iterators like p.children_iter() and p.siblings_iter will be unchanged. Iterators like c.allNodes_iter() and p.subtree_iter() will skip a node if p.isBackLink(p2) is True. Recognizing back links is easy: p2 is a back link if p2.v is in p.stack. - Drawing code, and other code that doesn't use iterators will similarly skip back links. - .leo file write code: some invention may be needed, but it shouldn't be difficult. - .leo file read code: the sax code may just work, or it may loop. Some invention may be needed. Let's look at larger design issues: - A user option could prevent clones from being their own parent. However, most newbies will not notice the change. In particular, the graph world should not be too confusing. - We actually don't need to worry about new graph world code until a Leo outline becomes a general graph. This makes testing easy: we can crash and burn in test.leo when adding back-link clones, while remaining pretty safe in leoPy.leo. - Unlike the general graph packages, Leo's iterators are *not* more confusing in the graph world!! This is what mislead me for so long. The difference is that Leo's graphs are *already* projected onto a DAG/ outline. This *existing* projection provides the context in which all iterators mean something obvious. We don't have to define "fancy" iterators: the *tree* iterators are all we need. - We could be bold and allow a "follow_back_links" option to iterators like p.self_and_subtree_iter() and c.allNodes_iter(). Scripts would then be responsible for not looping. Naturally, this work will be done in a separate branch. There may be a few surprises. I shall create this branch today: it would be so cool to get this working before vacation. Edward --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en -~----------~----~----~----~------~----~------~--~---
