What#39;s a good and stable C++ tree implementation?(什么是好的和稳定的 C++ 树实现?)
问题描述
我想知道是否有人可以推荐一个好的 C++ 树实现,希望是一个如果可能,与 stl 兼容.
I'm wondering if anyone can recommend a good C++ tree implementation, hopefully one that is stl compatible if at all possible.
为了记录,我以前写过很多次树算法,我知道这很有趣,但如果可能的话,我想变得务实和懒惰.因此,这里的目标是提供指向有效解决方案的实际链接.
For the record, I've written tree algorithms many times before, and I know it can be fun, but I want to be pragmatic and lazy if at all possible. So an actual link to a working solution is the goal here.
注意:我正在寻找通用树,而不是平衡树或地图/集,在这种情况下,结构本身和树的连接性很重要,而不仅仅是其中的数据.所以每个分支都需要能够保存任意数量的数据,并且每个分支都应该是可单独迭代的.
Note: I'm looking for a generic tree, not a balanced tree or a map/set, the structure itself and the connectivity of the tree is important in this case, not only the data within. So each branch needs to be able to hold arbitrary amounts of data, and each branch should be separately iterateable.
推荐答案
我不知道您的要求,但是您最好使用图表(例如在 Boost Graph) 如果您主要对结构感兴趣而不是对树特定的好处,例如通过平衡提高速度?您可以通过图形模拟"一棵树,也许它(概念上)更接近您要查找的内容.
I don't know about your requirements, but wouldn't you be better off with a graph (implementations for example in Boost Graph) if you're interested mostly in the structure and not so much in tree-specific benefits like speed through balancing? You can 'emulate' a tree through a graph, and maybe it'll be (conceptually) closer to what you're looking for.
这篇关于什么是好的和稳定的 C++ 树实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:什么是好的和稳定的 C++ 树实现?
基础教程推荐
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- CString 到 char* 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
