Boost Users :
Subject: [Boost-users] [boost-users][boost graph] edge_descriptor problem when copy from original graph
From: Emerson Xu (emersonxsu_at_[hidden])
Date: 2016-04-20 04:40:45
I have a boost graph copy problem that has been nagging me for a long time.
My question is, is there anyway that I can construct a graph once, and reuse it multiple times, each time I may mutate the graph a bit.
I have a class, which creates a boost graph with bundled vertex and edge properties (my own properties, vertices are routers in a network, while edges are logical links between routers). When creating the graph, some helper unordered maps are also created, like mapping from an edge_descriptor to a logical link name, from a router name to a vertex_descriptor, etc.
Now there are multiple clients calling some method in the class. Current strategy is to construct a new boost graph instance for every client, and run the service on each graph instance.
Now I want to improve the performance by avoiding constructing the graph for every client ( >100 clients are calling it simultaneously). So I am thinking that we can initialize only one base graph, and make it a copy for every client.
Then the problem comes, since in the method the client needs use those helper unordered maps, but the data inside the maps are from that original base graph. Even if I use a copy constructor(deep copy) for each graph copy, some graph data is still inconsistent, like the edge_descriptor, for example, I can't use the hashmap with edge_descriptor as key, because this edge_descriptor only points to the memory address of base graph.
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