Boost图作为简单DAG图的基础? [英] Boost Graph as basis for a simple DAG Graph?
问题描述
我正在使用Boost Graph Library作为dag图的基础。我以前并没有真正使用过它,所以不太熟悉它的工作原理。
虽然我不需要边权和巧妙的遍历算法,但是我很想获得免费的序列化,加上约束强制实施dag图并禁止平行弧。
计划抽象BGL的复杂性,但是这是过分的这种事情,因为我只会选择一个节点并递归遍历它的所有子节点?
我还希望能够拥有孤立的节点没有连接到图中的其他节点,但仍然可以在图中对这些节点进行迭代。这是提供的东西,还是我必须存储我自己的节点集合?
图中的节点迭代被提供。有一个接口在节点上返回一个 begin,end
一对迭代器(以及类似的边):
std :: pair< vertex_iterator,vertex_iterator>顶点(const adjacency_list& g)
从文档
I'm looking at using Boost Graph Library as the basis for a dag graph. I haven't really used it all that much before, so not too familiar with how it works.
Although I don't need edge weights and clever traversing algorithms, I would quite like to get the serialisation for free, plus the constraints enforcing dag graphs and disallowing parallel arcs.
Planning on abstracting the complexities of the BGL, but is this overkill for this kind of thing, as I'll only be selecting a node and recursing over all of its children?
I would also like to be able to have isolated nodes that aren't connected to other nodes in the graph, but still be able to iterate over these in the graph. Is this something that is provided, or would I have to store my own collection of nodes?
Iteration over nodes in a graph is provided. There's an interface that returns a begin, end
pair of iterators over the nodes (and a similar one over the edges):
std::pair<vertex_iterator, vertex_iterator> vertices(const adjacency_list& g)
From the documentation
这篇关于Boost图作为简单DAG图的基础?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!