caesar0301 / treelib

An efficient implementation of tree data structure in python 2/3.
http://treelib.readthedocs.io/en/latest/
Other
812 stars 186 forks source link

Add ability to populate tree from dictionary #73

Closed dterg closed 6 years ago

dterg commented 7 years ago

After creating the tree object, calling import_tree_dict and passing a hierarchical dictionary will populate the tree with the nodes.

tree = Tree()
jsonData = {'id': 'root', 'name': 'root', 'children': [{'id': 'child1', 'name':'child1', 'children':[]},{'id': 'child2','name':'child2', 'children':[]}]}
tree.import_tree_dict(jsonData)
tree.show()
ocervell commented 6 years ago

What's preventing this from being merged ?

ocervell commented 6 years ago

@caesar0301 Could you please look at this and merge it ? A few people are waiting for this feature to be merged.

caesar0301 commented 6 years ago

@ocervell Yes, I am designing a unified interface to manipulate different formats. See #85. Thanks @dterg ahead. Your code will be merged, maybe, in a different way.

jiwidi commented 5 years ago

Why isn't this merged? #85 has been open since dec 2017 and the feature is not yet implemented. We have a working solution here, why not merging if you can't continue with #85?