开发者

Boost Graph - using both directed and undirected edges

What开发者_如何转开发 would be the best strategy to build a boost graph that holds both directed and undirected edges?

I want to model a social network, where nodes represent people, and edges represent relationships. Some relationships are undirected (BrotherOf), while other are directed (FatherOf).

I need something like in_edges, out_edges and undirected_edges iterators.

Edit:

Since I need to deal with very large graphs, I want a method which is efficient both in memory consumption and in algorithms execution speed.


You could simply represent it as a directed graph.

An undirected edge can then be represented by replacing it with a directed edge in both directions.


There's a fairly simple way: a graph for the brother relationship, another for the father relationship. Or one for all undirected relationships, and one for directed relationships, which may include the undirected ones in both directions so that the standard graph algorithms work as expected.


Represent it as a directed graph.

And if edges have too many properties, you can just store a pointer to your data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜