Setting the "vertex_invariant" parameter to the isomorphism function does not seem to have any affect on the behavior of the function. In isomorphism.hpp, it appears that the function "isomorphism_impl" is supposed to read the parameter at the return statement: return isomorphism(G1, G2, f, choose_param(get_param(params, vertex_invariant1_t()), invariant1), choose_param(get_param(params, vertex_invariant2_t()), invariant2), choose_param(get_param(params, vertex_max_invariant_t()), ( invariant2.max )()), index_map1, index_map2 ); If "vertex_invariant1_t()" and "vertex_invariant2_t()" are both changed to "vertex_invariant_t()", the setting of the parameter then seems to have an affect. Has anyone been able to successfully set the vertex_invariant parameter using the named parameter version of the isomorphism function? I have had to resort to calling one of the internal isomorphism functions to set this parameter. any help is appreciated, Patrick
On 6/12/07, Patrick A. La Fratta
Setting the "vertex_invariant" parameter to the isomorphism function does not seem to have any affect on the behavior of the function. In isomorphism.hpp, it appears that the function "isomorphism_impl" is supposed to read the parameter at the return statement:
return isomorphism(G1, G2, f, choose_param(get_param(params, vertex_invariant1_t()), invariant1), choose_param(get_param(params, vertex_invariant2_t()), invariant2), choose_param(get_param(params, vertex_max_invariant_t()), ( invariant2.max)()), index_map1, index_map2 );
If "vertex_invariant1_t()" and "vertex_invariant2_t()" are both changed to "vertex_invariant_t()", the setting of the parameter then seems to have an affect. Has anyone been able to successfully set the vertex_invariant parameter using the named parameter version of the isomorphism function? I have had to resort to calling one of the internal isomorphism functions to set this parameter.
any help is appreciated, Patrick
Hi Patrick, It appears that the algorithm implementation diverged a little from the documentation. The docs mention a "vertex_invariant" named parameter whose operator() must work on both graphs passed in to the isomorphism function - this was later replaced with two separate vertex invariant functors - "vertex_invariant1" and "vertex_invariant2", which could be applied to the first and second input graph, respectively. You're right, though, the named parameter mechanism wasn't fully set up to handle this when this change was made. If you'd like, use the diff I've appended to this email to patch the file boost/graph/named_params.hpp. This patch just adds some necessary definitions so that you can actually use vertex_invariant1 and vertex_invariant2 as named parameters in the function, like so: MyVertexInvariant1 my_invariant1; MyVertexInvariant2 my_invariant2; bool are_isomorphic = isomorphism(g1,g2, isomorphism_map(my_isomorphism_map) .vertex_index1_map(my_vertex_index_map1) .vertex_index2_map(my_vertex_index_map2) .vertex_invariant1(my_invariant1) .vertex_invariant2(my_invariant2)); Does anyone object if I commit this patch to HEAD and update the documentation for isomorphism to reflect the two separate vertex invariant named parameters? Regards, Aaron ---------------------------------------------------------------------------------------------------------- 286a287,300
template <typename VertexInvar> bgl_named_params
vertex_invariant1(const VertexInvar& c) const { typedef bgl_named_params Params; return Params(c, *this); } template <typename VertexInvar> bgl_named_params
vertex_invariant2(const VertexInvar& c) const { typedef bgl_named_params Params; return Params(c, *this); }
549a564,577
template <typename VertexInvar> bgl_named_params
vertex_invariant1(const VertexInvar& c) { typedef bgl_named_params Params; return Params(c); } template <typename VertexInvar> bgl_named_params
vertex_invariant2(const VertexInvar& c) { typedef bgl_named_params Params; return Params(c); }
Aaron Windsor wrote:
If you'd like, use the diff I've appended to this email to patch the file boost/graph/named_params.hpp. This patch just adds some necessary definitions so that you can actually use vertex_invariant1 and vertex_invariant2 as named parameters in the function, like so:
MyVertexInvariant1 my_invariant1; MyVertexInvariant2 my_invariant2;
bool are_isomorphic = isomorphism(g1,g2, isomorphism_map(my_isomorphism_map) .vertex_index1_map(my_vertex_index_map1) .vertex_index2_map(my_vertex_index_map2) .vertex_invariant1(my_invariant1) .vertex_invariant2(my_invariant2));
Does anyone object if I commit this patch to HEAD and update the documentation for isomorphism to reflect the two separate vertex invariant named parameters?
The patch looks good. Please go ahead and commit (along with the documentation fix!) - Doug
Thanks for your help and the fix. Also, there is a comment in the "
isomorphism.hpp" file in the "match" function that says "this *HAS* to be a
bug!". Does anyone know if there is a problem here that hasn't been
addressed?
- Patrick
On 6/13/07, Douglas Gregor
Aaron Windsor wrote:
If you'd like, use the diff I've appended to this email to patch the file boost/graph/named_params.hpp. This patch just adds some necessary definitions so that you can actually use vertex_invariant1 and vertex_invariant2 as named parameters in the function, like so:
MyVertexInvariant1 my_invariant1; MyVertexInvariant2 my_invariant2;
bool are_isomorphic = isomorphism(g1,g2, isomorphism_map(my_isomorphism_map) .vertex_index1_map(my_vertex_index_map1) .vertex_index2_map(my_vertex_index_map2) .vertex_invariant1(my_invariant1) .vertex_invariant2(my_invariant2));
Does anyone object if I commit this patch to HEAD and update the documentation for isomorphism to reflect the two separate vertex invariant named parameters?
The patch looks good. Please go ahead and commit (along with the documentation fix!)
- Doug _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Also, I believe the vertex_max_invariant named parameter needs to be set for
the isomorphism function to work (mine doesn't seem to work without it set).
I added the necessary change to my named_params.hpp, similar to the patches
you gave, in order to set this. It seems to work fine now.
thanks,
Patrick
On 6/13/07, Patrick A. La Fratta
Thanks for your help and the fix. Also, there is a comment in the " isomorphism.hpp" file in the "match" function that says "this *HAS* to be a bug!". Does anyone know if there is a problem here that hasn't been addressed?
- Patrick
On 6/13/07, Douglas Gregor
wrote: Aaron Windsor wrote:
If you'd like, use the diff I've appended to this email to patch the file boost/graph/named_params.hpp. This patch just adds some necessary definitions so that you can actually use vertex_invariant1 and vertex_invariant2 as named parameters in the function, like so:
MyVertexInvariant1 my_invariant1; MyVertexInvariant2 my_invariant2;
bool are_isomorphic = isomorphism(g1,g2, isomorphism_map(my_isomorphism_map)
.vertex_index1_map(my_vertex_index_map1)
.vertex_index2_map(my_vertex_index_map2)
.vertex_invariant1(my_invariant1) .vertex_invariant2(my_invariant2));
Does anyone object if I commit this patch to HEAD and update the documentation for isomorphism to reflect the two separate vertex invariant named parameters?
The patch looks good. Please go ahead and commit (along with the documentation fix!)
- Doug _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On 6/13/07, Patrick A. La Fratta
Also, I believe the vertex_max_invariant named parameter needs to be set for the isomorphism function to work (mine doesn't seem to work without it set). I added the necessary change to my named_params.hpp, similar to the patches you gave, in order to set this. It seems to work fine now. thanks, Patrick
On 6/13/07, Patrick A. La Fratta
wrote: Thanks for your help and the fix. Also, there is a comment in the
"isomorphism.hpp" file in the "match" function that says "this *HAS* to be a bug!". Does anyone know if there is a problem here that hasn't been addressed?
- Patrick
Hi Patrick, Thanks - I'll add the named parameter for vertex_max_invariant to the patch as well. As for the "this has to be a bug comment" - I've seen that too. What I can say is that I've hit the isomorphism code pretty hard recently with several thousands of small graphs and it looks good to me. I use it in the planarity testing/embedding code that I have in the vault right now (http://tinyurl.com/2dltju) to verify non-planar graphs - any graph that isn't planar contains a subgraph that can be contracted and tested for isomorphism against either the complete graph on 5 vertices or the complete bipartite graph on 6 vertices (with 3 vertices in each bipartition). So, admittedly, I'm using it to test for isomorphism against two very special small graphs, but I've never seen it give incorrect results. Regards, Aaron
participants (3)
-
Aaron Windsor
-
Douglas Gregor
-
Patrick A. La Fratta