Hello, I Have 2 graphs: graph1 and graph2, and two sets of edge descriptors.
One set is associated to edges of graph1 and another set associated to
edges of graph2.
I don't understand why is it possible to access information about edges of
graph2 by using graph1 and the edge descriptors of graph2.
I realized of that because of an own mistake when using graphs.
What I would like to know is why is that possible to do and if it should be
an exception that can handle this situation.
I send the code I was using to test this:
#include <iostream>
#include
On Wednesday, June 11, 2014 09:36 PM, Pablo Madoery wrote:
Hello, I Have 2 graphs: graph1 and graph2, and two sets of edge descriptors. One set is associated to edges of graph1 and another set associated to edges of graph2. I don't understand why is it possible to access information about edges of graph2 by using graph1 and the edge descriptors of graph2.
If the type of the vertex_descriptor is void*, internally, it's probably just cast to some node in the graph. Just because the interface takes a graph and a vertex_descriptor pair, doesn't mean it uses the graph you passed*. I guess the same would happen with a std::list<iterator>, if you use an iterator from the wrong list, the next one would still point into the wrong list, right? It's undefined behaviour, and not all operations are likely to work, but some might, as you've seen. Ben * It looks like you're using a member of the graph in that interface, but if the implementation of that member doesn't use the this pointer, it can still work.
participants (2)
-
Ben Pope
-
Pablo Madoery