Comments (2)
Hi, I've seen this problem in my unit tests before just never got around to actually fixing it :-( but the good new is that I think I fixed it now :-)
The fixed solution is in a seperate branch: Depthfirst.Traverse.PostOrder
- Would you be able to test this for me and let me know if you see any issues with it?
I found that the old traversal structure was not too useful here because it had no direct readable states towards whether:
- a node has been visited
- a nodes children have been visited and so forth
So, I redesigned the algorithm using the private utility class:
TreeLib.Depthfirst.Traverse.VisitElement<T>
This class allows me tho keep the state in very simple way and yield each node in a simple while loop as you can see in the static IEnumerable<T>PostOrderIterator<T>(...)
method in TreeLib.Depthfirst.Traverse.
The case you are reporting is this:
This structure is tested in a unit test in TreeLibNugetUnitTests.CoreTests.TestMethod8() and does no longer return an error. I have added one or 2 more unit tests here for good measure but I think this is fine. Would you want to add more test patterns? If so, please let me know also...
Thanks for your detailed feedback.
from treelib.
First of all thanks for your quick response.So after a brief testing everything seems to work correctly.If i find something else i will keep you posted.Thanks!
from treelib.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from treelib.