Boost logo

Boost Users :

Subject: Re: [Boost-users] [Graph] Static allocation of nodes and edges
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2013-11-08 10:59:41


On Fri, 8 Nov 2013, Sensei wrote:

> On 11/8/13, 3:15pm, Jeremiah Willcock wrote:
>> If you have so few edges per vertex, you definitely don't want to use an
>> adjacency matrix. If your graph will be read-only (in terms of
>> structure, not properties), use compressed_sparse_row_graph; be sure to
>> change the vertex and edge count sizes to uint32_t if you know your
>> graph size will fit into that. If you are going to be doing
>> modifications, use adjacency_list instead. Adjacency matrices use N^2
>> storage for N vertices, regardless of the number of edges, so they are
>> unlikely to fit into memory for your problem size.
>
> Actually, I would create at run-time a (huge) graph, and after that it will
> be read-only. The construction will have a constant nnumber of nodes (so I
> can use this in the constructor), while edges must be calculated at run-time,
> and I don't see any facility for doing this.

You can pass in a sequence (iterator range) of edges and the
compressed_sparse_row_graph code will automatically count and sort them.
Can you get that as a single entity (or a way to compute the edges), at
least?

-- Jeremiah Willcock


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net