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.