Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated node names #7

Closed
ghost opened this issue Jun 9, 2012 · 2 comments
Closed

Repeated node names #7

ghost opened this issue Jun 9, 2012 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 9, 2012

Documentation says this about node name: "Expected to be unique within the tree". But what could happend when names are not unique? In many cases you really don't need to care about it, you don't need a unique id.
I'd like you make a comment about it in documentation.

Thank you for your project! And congraturatons! You got rubytree is the facto ruby standart for a very very important data structure.

@ghost ghost assigned evolve75 Aug 19, 2012
@evolve75
Copy link
Owner

Thanks!

The issue with the node name having to be unique is that the internal data structures are based on hashes, and also the semantic does require that each of the nodes in the tree be directly accesible via the node name (we could potentially change the logic so that an array of nodes is returned if the name is the same, but this might not be exactly what we need).

I think a better option would be to treat the name as a unique handler/ID for the node, and the duplicate node objects themselves can be added in the value part. This actually works out better (and works in the current version as well).

I am going to take your suggestion to update the documentation so that this scenario is addressed more explicitly.

@ghost
Copy link
Author

ghost commented Aug 20, 2012

Thank you for answering. I could use object_id as node id, it's easy, it's unique. So I could forget that unique id issue, that I don't really care for my purposes. I'd use value for node tag and other node data.
Thank you again.

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

No branches or pull requests

1 participant