如何找到匹配的子树?
我有一个大的二叉树,T.T“匹配”。 T 的一些子树也将匹配。 事实上,匹配的子树甚至不需要是完整的子树:它们也可以被截断。 通过截断子树,我的意思是子树中的节点可能不会一直包含子节点 - 某些具有子节点的节点可能会删除其子节点。
示例:请参阅此链接。 由诗歌1、节1、节2、行3表示的树是截断子树的示例。
确定树是否匹配需要对整个树执行计算。 这不是进步的。
我到底如何找到所有匹配项?
I have a large binary tree, T. T "matches". Some number of subtrees of T will also match. In fact, the matching subtrees need not even be full subtrees: they can be truncated, too. By truncated subtree, I mean that nodes in the subtree may not contain children all the way down - some nodes that have children may have their children removed.
An example: see this link. The tree represented by poem1, stanza1, stanza2, line3 is an example of a truncated subtree.
Determining if a tree matches requires performing a calculation on that entire tree. It's not progressive.
How the heck do I find all matches?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://en.wikipedia.org/wiki/Subgraph_isomorphism_problem
听起来大致像你一样试图找到(除了你也在原始图的所有子图上尝试这个,这使得它变得更加困难)。 我真的不知道你如何定义“匹配”(平等、图案、颜色协调、末端粘有化学物质,当被击中时会点燃?),所以这可能是一个完全不同的问题。
http://en.wikipedia.org/wiki/Subgraph_isomorphism_problem
sounds roughly like what you're trying to find (except that you're trying this on all subgraphs of an original graph as well, making it even harder). I don't really know how you are defining "matches" (equality, pattern, color coordinated, sticks with chemicals on the end that ignite when struck?), so it might be quite a different problem.