了解Matlab中的phytree对象 [英] to understand the phytree object in matlab

查看:182
本文介绍了了解Matlab中的phytree对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里问了类似的问题:什么是phytree对象在matlab中?. 现在,这就是我为获得它所做的.

I asked the similar question here: what exactly is the phytree object in matlab?. Now this is what I did to try to get it.

clear;
d=[4,2,5,4,5,5];
z=seqneighjoin(d);
view(z)
get(z, 'Pointers')

这是输出:

ans =

     1     2
     3     5
     4     6

以及下面的phytree图.据我了解,该矩阵与phytree对象的树字段相同.这个矩阵和数字之间是什么关系?

And the phytree figure in the following. For my understanding, this matrix is the same as the tree field of the phytree object. What is the relation between this matrix and the figure?

推荐答案

您应按以下方式解释数组.

You should interpret the array in the following way.

首先,您具有四个节点1、2、3和4.在所连接的图中,节点1标记为Leaf 1;而节点1标记为Leaf 1.节点2标记为叶子3;节点3标记为叶子2;节点4标记为Leaf 4.

Firstly, you have the four nodes 1, 2, 3 and 4. In the graph you attach, node 1 is labelled Leaf 1; node 2 is labelled Leaf 3; node 3 is labelled Leaf 2; and node 4 is labelled Leaf 4.

然后依次获取数组的每一行.

Then take each row of the array in turn.

第一行表示我们首先连接节点1和2-我们现在将此节点称为5,因为它是比我们已经拥有的四个节点大的最小数字.在图中,这是连接Leaf 1和Leaf 3的节点.

The first row indicates that we first join nodes 1 and 2 - we now call this node 5, as it's the smallest number greater than the four nodes we already have. On the graph, this is the node connecting Leaf 1 and Leaf 3.

然后,第二行指示我们接下来将节点3和5联接在一起-我们现在称为该节点6,因为它再次是节点5之后的最小数.在图上,这是将先前的联接连接到Leaf 2的节点.

Then the second row indicates that we next join nodes 3 and 5 - we now call this node 6, as again it's the smallest number after node 5. On the graph, this is the node connecting the previous join to Leaf 2.

然后第三行表示我们最后连接了节点4和6-我们不需要调用任何东西,因为它是最终的根节点,但它可能是节点7.在图中,这是连接节点4的节点.以前加入到Leaf 4.

Then the third row indicates that we lastly join nodes 4 and 6 - we don't need to call it anything as it's the final root node, but it would be node 7. On the graph, this is the node connecting the previous join to Leaf 4.

这更有意义吗?

这篇关于了解Matlab中的phytree对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆