Ticket #7845: isomorphism.patch
File isomorphism.patch, 3.9 KB (added by , 10 years ago) |
---|
-
isomorphism.hpp
old new 222 222 recur: 223 223 if (iter != ordered_edges.end()) { 224 224 i = source(*iter, G1); 225 j = target(*iter, G 2);225 j = target(*iter, G1); 226 226 if (dfs_num[i] > dfs_num_k) { 227 227 G2_verts = vertices(G2); 228 228 while (G2_verts.first != G2_verts.second) { … … 310 310 if (k.empty()) return false; 311 311 const match_continuation& this_k = k.back(); 312 312 switch (this_k.position) { 313 case match_continuation::pos_G2_vertex_loop: {G2_verts = this_k.G2_verts; iter = this_k.iter; dfs_num_k = this_k.dfs_num_k; k.pop_back(); in_S[*G2_verts.first] = false; i = source(*iter, G1); j = target(*iter, G 2); goto G2_loop_k;}314 case match_continuation::pos_fi_adj_loop: {fi_adj = this_k.fi_adj; iter = this_k.iter; dfs_num_k = this_k.dfs_num_k; k.pop_back(); in_S[*fi_adj.first] = false; i = source(*iter, G1); j = target(*iter, G 2); goto fi_adj_loop_k;}313 case match_continuation::pos_G2_vertex_loop: {G2_verts = this_k.G2_verts; iter = this_k.iter; dfs_num_k = this_k.dfs_num_k; k.pop_back(); in_S[*G2_verts.first] = false; i = source(*iter, G1); j = target(*iter, G1); goto G2_loop_k;} 314 case match_continuation::pos_fi_adj_loop: {fi_adj = this_k.fi_adj; iter = this_k.iter; dfs_num_k = this_k.dfs_num_k; k.pop_back(); in_S[*fi_adj.first] = false; i = source(*iter, G1); j = target(*iter, G1); goto fi_adj_loop_k;} 315 315 case match_continuation::pos_dfs_num: {k.pop_back(); goto return_point_false;} 316 316 default: { 317 317 BOOST_ASSERT(!"Bad position"); … … 378 378 const Graph& m_g; 379 379 }; 380 380 381 template <typename Graph> 382 size_t get_num_vertices(const Graph& g) 383 { 384 size_t n = 0; 385 typename boost::graph_traits<Graph>::vertex_iterator v, v_end; 386 for(tie(v, v_end) = vertices(g); v != v_end; ++v) 387 n++; 388 return n; 389 } 390 391 template <typename Graph> 392 size_t get_num_edges(const Graph& g) 393 { 394 size_t n = 0; 395 typename boost::graph_traits<Graph>::edge_iterator e, e_end; 396 for(tie(e, e_end) = edges(g); e != e_end; ++e) 397 n++; 398 return n; 399 } 381 400 382 401 template <typename Graph1, typename Graph2, typename IsoMapping, 383 402 typename Invariant1, typename Invariant2, … … 392 411 BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph1> )); 393 412 BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph1> )); 394 413 BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph2> )); 395 BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph2> ));414 //BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph2> )); 396 415 397 416 typedef typename graph_traits<Graph1>::vertex_descriptor vertex1_t; 398 417 typedef typename graph_traits<Graph2>::vertex_descriptor vertex2_t; … … 407 426 // Property map requirements 408 427 BOOST_CONCEPT_ASSERT(( ReadWritePropertyMapConcept<IsoMapping, vertex1_t> )); 409 428 typedef typename property_traits<IsoMapping>::value_type IsoMappingValue; 410 BOOST_STATIC_ASSERT((is_ same<IsoMappingValue, vertex2_t>::value));429 BOOST_STATIC_ASSERT((is_convertible<IsoMappingValue, vertex2_t>::value)); 411 430 412 431 BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<IndexMap1, vertex1_t> )); 413 432 typedef typename property_traits<IndexMap1>::value_type IndexMap1Value; … … 417 436 typedef typename property_traits<IndexMap2>::value_type IndexMap2Value; 418 437 BOOST_STATIC_ASSERT((is_convertible<IndexMap2Value, size_type>::value)); 419 438 420 if ( num_vertices(G1) !=num_vertices(G2))439 if (get_num_vertices(G1) != get_num_vertices(G2)) 421 440 return false; 422 if ( num_vertices(G1) == 0 &&num_vertices(G2) == 0)441 if (get_num_vertices(G1) == 0 && get_num_vertices(G2) == 0) 423 442 return true; 424 443 425 444 detail::isomorphism_algo<Graph1, Graph2, IsoMapping, Invariant1,