算法根据节点属性构建树 [英] Algorithm for building tree depending on node attributes

查看:152
本文介绍了算法根据节点属性构建树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图解决规划问题,我需要实现以下算法(大约):

I am trying to solve a programming problem where I need to implement the following algorithm (roughly):

有几个节点,即A,B,C等。

There are couple of nodes, ie, A, B, C, etc.

的每个节点可以具有在它的多个项目,即,A,B,C,X,Y,Z,等等。例如,

Every node can have multiple items in it, ie, a, b, c, x, y, z, etc. For example,

A [a, b, c, x, y, z]

B [a, b, c]

C [x, y, z]

可以有节点和项节点和无限数目可以有任何数量的项目(但相同的项目不会再次重复)。

There can be infinite number of nodes and items and nodes can have any number of items in it (but same item wont repeat again).

我必须做的是我要创建依赖于节点内部的普通物品的节点中层次结构。所以,在上面的例子中,A应具有较高的层次结构上B和C或者换言之,A是主B和C是从站。

What I have to do is I have to create heirarchy among the nodes depending on the common items inside the nodes. So, in the above example, A should have higher heirarchy over B and C. Or in other words, A is master and B and C are the slaves.

于是,我就在想,如果我可以从依赖于共同的项目节点的树,那么这将是我更容易。但我不知道该用哪种算法。任何人都知道这将是适合我的情况?构建树是不是强制性的,如果还有其他​​的方法来达到同样的事情,一切都会好的。谢谢你。

So, I was thinking if I can make a tree from the nodes depending on common items, then it will be easier for me. But I don't know which algorithm to use. Anybody know which will be suitable for my case? Building tree is not mandatory, if there are other ways to achieve the same thing, it will be okay. Thanks.

推荐答案

我已经适应了由明Syan陈,钟秀园和菲利普S在网络环境下的路径遍历模式数据挖掘提出论文的算法。羽。本文提供这里。虽然这里的算法直接不解决我的问题,但我的算法做了一点调整,使其适合我的问题的情况。现在,它工作正常,我得到我需要的结果。

I have adapted the algorithm proposed by the paper "Data Mining for Path Traversal Patterns in a Web Environment" by Ming-Syan Chen, Jong Soo Park and Philip S. Yu. This paper is available here. Though the algorithm here directly does not solve my problem, but I did little bit adaptation in the algorithm so that it fits my problem situation. Now it works fine and I get the result I need.

我要感谢大家花时间来阅读我的问题,并提出解决方案。

I would like to thank everyone took time to read my question and proposed solution.

这篇关于算法根据节点属性构建树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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