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.

链接地址: http://www.djcxy.com/p/52372.html

上一篇: 在C ++图形结构中高效地表示边

下一篇: 使用有向和无向边缘