小编h-m*_*suo的帖子

如何使用Boost的vf2_subgraph_iso检测多图上的子图同构?

我正在尝试使用Boost vf2_subgraph_iso()来检测子图同构.

我可以在简单的图形上成功完成此操作,但不能在多图形(允许有多个边缘的图形)上执行此操作.

考虑检测以下G1和G2之间的子图同构:

图

G1是G2的子图,我想使用以下代码检测:

#include <vector>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/vf2_sub_graph_iso.hpp>

int main()
{
  // Define edge property
  typedef boost::property<
    boost::edge_name_t,
    char
  > edge_property;

  // Define graph type
  typedef boost::adjacency_list<
    boost::vecS,           // OutEdgeListS
    boost::vecS,           // VertexListS
    boost::bidirectionalS, // DirectedS
    boost::no_property,    // VertexProperties
    edge_property,         // EdgeProperties
    boost::no_property,    // GraphProperties
    boost::listS           // EdgeListS
  > MyGraphType;

  // Build graph G1
  MyGraphType g1;
  std::vector<MyGraphType::vertex_descriptor> v1(3);
  for (auto itr = v1.begin(); itr != v1.end(); ++itr) {
    *itr = boost::add_vertex(g1);
  }
  boost::add_edge(v1[0], v1[1], …
Run Code Online (Sandbox Code Playgroud)

c++ boost graph isomorphism boost-graph

5
推荐指数
1
解决办法
182
查看次数

标签 统计

boost ×1

boost-graph ×1

c++ ×1

graph ×1

isomorphism ×1