making combinations from each leaf to parent node in Matlab
2 次查看(过去 30 天)
显示 更早的评论
Hello, I have to make all combinations from a tree, starting from parent node and ends at the last leaf nodes. The depth of all leaf nodes is same. I don't understand how can i get such a combination... starting from parent node ending to the leaf node.
Can anyone help please.
5 个评论
Guillaume
2018-6-20
Where does the tree class come form? As far as I know there's no such thing in any matlab toolbox.
回答(1 个)
Steven Lord
2018-6-21
Consider building your tree as a graph. You could create the adjacency matrix or the edge lists as shown on that page or you could start with an empty graph and use addedge to add edges (either one at a time, or from a parent to each of its children, or in some other grouping.)
As you add edges, you can plot the resulting graph to see how it is growing. The rmedge function may help if you accidentally add the wrong edge.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!