Boost logo

Boost Users :

Subject: [Boost-users] [BGL] isomorphism: how to define vertex invariant
From: Pablo Madoery (madoerypablo_at_[hidden])
Date: 2014-02-19 10:44:44


Hi, I have two graphs and I want to know if they are isomorphic.
I adjunct the graphs in .png. I read the documentation but i can't figure
out how i must define the vertex invariant correctly. what I want is to
consider that two graph are not isomorphic taking count of the vertices ids
(the unsigned int value that they have).
In the example i give I want the function isomorphism to return false.
actually it return true.

Thank you !

////////////////////////////////////////////////////////////////////////////////////////////
Graph graph1;
Graph::vertex_descriptor aA = add_vertex(graph1);
Graph::vertex_descriptor bA = add_vertex(graph1);
Graph::vertex_descriptor cA = add_vertex(graph1);
Graph::edge_descriptor edA1 = (add_edge(aA, bA, graph1)).first;
Graph::edge_descriptor edA2 = (add_edge(bA, cA, graph1)).first;

graph1[edA1].weight = 1;
graph1[edA2].weight = 2;

////////////////////////////////////////////////////////////////////////////////////////////
Graph graph2;
Graph::vertex_descriptor aB = add_vertex(graph2);
Graph::vertex_descriptor bB = add_vertex(graph2);
Graph::vertex_descriptor cB = add_vertex(graph2);
Graph::edge_descriptor edB1 = (add_edge(bB, aB, graph2)).first;
Graph::edge_descriptor edB2 = (add_edge(aB, cB, graph2)).first;

graph2[edB1].weight = 1;
graph2[edB2].weight = 2;

///////////////////////////////////////////////////////////////////////////////////////////

bool isIso = boost::isomorphism(graph1, graph2);




graphs.png

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