如何找到匹配的子树?

发布于 2024-07-26 10:53:26 字数 406 浏览 4 评论 0原文

我有一个大的二叉树,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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅暮の光 2024-08-02 10:53:26

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文