我想知道是否有人可以推荐一个好的 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++ 树实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!