making combinations from each leaf to parent node in Matlab

조회 수: 6 (최근 30일)
Sohaib Bin Altaf
Sohaib Bin Altaf 2018년 6월 19일
댓글: Sohaib Bin Altaf 2018년 6월 22일
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
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.
Sohaib Bin Altaf
Sohaib Bin Altaf 2018년 6월 21일
I followed this article, i was able to construct my required tree but unable to extract the branches which i need,

댓글을 달려면 로그인하십시오.

답변 (1개)

Steven Lord
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.
  댓글 수: 1
Sohaib Bin Altaf
Sohaib Bin Altaf 2018년 6월 22일
thanks a lot for your suggestion, i will try graphs this time. I hope it solves my problem.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by