I am almost new to boost-graph library.
How to declare graph
as a member variable?
typedef boost::adjacency_list<boost::vecS,
boost::vecS,
boost::undirectedS> Graph;
class myclass{
private:
Graph graph;
void connect(const int N)
{
// Graph graph(N); // make it local
// or
graph(N); //error
for (size_t i = 0; i < N; i++)
{
for (size_t j = i + 1; j < N; j++)
{
if (adj[i][j] != 0)
boost::add_edge(i, j, graph);
}
}
}
Edit: maybe we can make an instance of graph and pass it to the class
Graph graph(N);
myclass.set_params(graph);
Is it the only option?