C++ 检查顶点之间的平行边:边范围不适用于有向图

C++ 检查顶点之间的平行边:边范围不适用于有向图,c++,boost,graph,C++,Boost,Graph,我不确定这是否与 但是我不能将edge\u range与directedS一起使用,并且从上面的链接中得到了不同的错误。将directedS更改为nondirectedS可以让它工作,但这不是我想要的 如果这不起作用,我们是否有其他方法来检查节点之间的平行边,而不是使用boost::out_edges 当我的图形允许平行边时,我会得到什么boost::edge(u,v,G)?第一个边缘 多谢各位 #include <boost/graph/adjacency_list.hpp> t

我不确定这是否与 但是我不能将
edge\u range
directedS
一起使用,并且从上面的链接中得到了不同的错误。将
directedS
更改为
nondirectedS
可以让它工作,但这不是我想要的

  • 如果这不起作用,我们是否有其他方法来检查节点之间的平行边,而不是使用
    boost::out_edges

  • 当我的图形允许平行边时,我会得到什么
    boost::edge(u,v,G)
    ?第一个边缘

  • 多谢各位

    #include <boost/graph/adjacency_list.hpp>
    
    typedef boost::adjacency_list<
        boost::multisetS,
        boost::vecS, 
        boost::directedS,
        boost::no_property,
        boost::no_property,
        boost::no_property,
        boost::setS 
        > Graph;
    
    typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex;
    typedef typename boost::graph_traits<Graph>::edge_descriptor Edge;
    
    void test(Edge aE, const Graph &aG) {
        Vertex sv = boost::source(aE, aG);
        Vertex tv = boost::target(aE, aG);
        typename boost::graph_traits<Graph>::out_edge_iterator it, eit;
        for (boost::tie(it, eit) = boost::edge_range(sv, tv, aG);
            it != eit;
            ++it) {
        }
    }
    
    #包括
    typedef boost::邻接列表<
    boost::多集,
    boost::vecS,
    boost::directedS,
    boost::无_属性,
    boost::无_属性,
    boost::无_属性,
    boost::集合
    >图形;
    typedef typename boost::图形特征::顶点描述符顶点;
    typedef typename boost::graph_traits::edge_描述符edge;
    孔隙测试(边缘aE、常量图和aG){
    顶点sv=升压::源(aE,aG);
    顶点电视=助推::目标(aE,aG);
    typename boost::graph\u traits::out\u edge\u迭代器it,eit;
    对于(boost::tie(it,eit)=boost::edge_范围(sv,tv,aG);
    它!=eit;
    ++(it){
    }
    }
    
    信息

       In file included from .../glnxa64/boost/include/boost/graph/adjacency_list.hpp:370:0,
                     from sl_execgraph/Test.cpp:2:
    .../glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp: In instantiation of ‘std::pair<typename Config::out_edge_iterator, typename Config::out_edge_iterator> boost::edge_range(typename Config::vertex_descriptor, typename Config::vertex_descriptor, const boost::adj_list_helper<Config, Base>&) [with Config = boost::detail::adj_list_gen<boost::adjacency_list<boost::multisetS, boost::vecS, boost::directedS, boost::no_property, boost::no_property, boost::no_property, boost::setS>, boost::vecS, boost::multisetS, boost::directedS, boost::no_property, boost::no_property, boost::no_property, boost::setS>::config; Base = boost::directed_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::multisetS, boost::vecS, boost::directedS, boost::no_property, boost::no_property, boost::no_property, boost::setS>, boost::vecS, boost::multisetS, boost::directedS, boost::no_property, boost::no_property, boost::no_property, boost::setS>::config>; typename Config::out_edge_iterator = boost::detail::out_edge_iter<std::_Rb_tree_const_iterator<boost::detail::sep_<long unsigned int, boost::no_property> >, long unsigned int, boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int>, long int>; typename Config::vertex_descriptor = long unsigned int]’:
    
    sl_execgraph/Test.cpp:21:60:   required from here
    
    .../glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:1625:7: error: no matching function for call to ‘boost::detail::sep_<long unsigned int, boost::no_property>::sep_(boost::detail::adj_list_gen<boost::adjacency_list<boost::multisetS, boost::vecS, boost::directedS, boost::no_property, boost::no_property, boost::no_property, boost::setS>, boost::vecS, boost::multisetS, boost::directedS, boost::no_property, boost::no_property, boost::no_property, boost::setS>::config::vertex_descriptor&, std::set<boost::list_edge<long unsigned int, boost::no_property>, std::less<boost::list_edge<long unsigned int, boost::no_property> >, std::allocator<boost::list_edge<long unsigned int, boost::no_property> > >::iterator, boost::detail::adj_list_gen<boost::adjacency_list<boost::multisetS, boost::vecS, boost::directedS, boost::no_property, boost::no_property, boost::no_property, boost::setS>, boost::vecS, boost::multisetS, boost::directedS, boost::no_property, boost::no_property, boost::no_property, boost::setS>::config::EdgeContainer*)’
    .../glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:1625:7: 
    
    note: candidates are:
    
    In file included from .../glnxa64/boost/include/boost/graph/adjacency_list.hpp:370:0,
    
                     from sl_execgraph/Test.cpp:2:
    
    .../glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:273:7: note: boost::detail::sep_<Vertex, Property>::sep_(const self&) [with Vertex = long unsigned int; Property = boost::no_property; boost::detail::sep_<Vertex, Property>::self = boost::detail::sep_<long unsigned int, boost::no_property>]
    
    .../glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:273:7: note:   candidate expects 1 argument, 3 provided
    
    .../glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:270:14: note: boost::detail::sep_<Vertex, Property>::sep_(Vertex, const Property&) [with Vertex = long unsigned int; Property = boost::no_property]
    
    .../glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:270:14: note:   candidate expects 2 arguments, 3 provided
    
    .../glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:269:14: note: boost::detail::sep_<Vertex, Property>::sep_() [with Vertex = long unsigned int; Property = boost::no_property]
    
    .../glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:269:14: note:   candidate expects 0 arguments, 3 provided
    
    .../Makefile.module: recipe for target 'Test.o' failed
    
    在…/glnxa64/boost/include/boost/graph/adjacence_list.hpp:370:0中包含的文件中,
    从sl_execgraph/Test.cpp:2:
    …/glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:在“std::pair boost::edge_range”(typename配置::顶点描述符,typename配置::顶点描述符,常量boost::adj_list_helper&)的实例化中[with Config=boost::detail::adj_list_gen::Config;Base=boost::directed_graph_helper;typename Config::out_edge_iterator=boost::detail::out_edge_iter;typename Config::vertex_descriptor=long unsigned int]:
    sl_execgraph/Test.cpp:21:60:此处为必填项
    …/glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:1625:7:错误:调用“boost::detail::sep_::sep__”(boost::detail::adj_list_gen::config::vertex_描述符&,std::set::iterator,boost::detail::adj_list_gen::config::EdgeContainer*)没有匹配函数
    …/glnxa64/boost/include/boost/graph/detail/adj_list.hpp:1625:7:
    注:候选人包括:
    在…/glnxa64/boost/include/boost/graph/adjacence_list.hpp:370:0中包含的文件中,
    从sl_execgraph/Test.cpp:2:
    …/glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:273:7:注意:boost::detail::sep_u216;::sep_216;(const self&)[顶点=长无符号int;属性=boost::no_属性;boost::detail::sep_216;sef=boost::detail::sep_216;]
    …/glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:273:7:注意:候选者需要1个参数,提供3个参数
    …/glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:270:14:注意:boost::detail::sep_::sep_(顶点,常量属性&)[顶点=长无符号整数;属性=boost::no_属性]
    …/glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:270:14:注意:候选者需要2个参数,提供3个参数
    …/glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:269:14:注意:boost::detail::sep_::sep_()[with Vertex=long unsigned int;Property=boost::no_Property]
    …/glnxa64/boost/include/boost/graph/detail/adjacency_list.hpp:269:14:注意:候选者需要0个参数,提供3个参数
    …/Makefile.module:目标“Test.o”的配方失败
    
    您遇到的错误在Boost 1.56中已修复

    修复提交可能是4af6108

    tree 21e89a6ae24b1d94cdc38e3e0219ae81f0ff52e9
    parent 031ce8084b5ca6e79b359b3a3fee671115fffc41
    author Jeremiah Willcock <jewillco@osl.iu.edu> Sat Oct 26 22:57:10 2013 +0000
    committer Jeremiah Willcock <jewillco@osl.iu.edu> Sat Oct 26 22:57:10 2013 +0000
    
    Fixed edge_range bug from http://stackoverflow.com/questions/19223692/boost-graph-library-directed-multigraph-edge-range-bug?rq=1
    
    [SVN r86469]
    
    diff --git a/include/boost/graph/detail/adjacency_list.hpp b/include/boost/graph/detail/adjacency_list.hpp
    index 16cf026..87fd557 100644
    --- a/include/boost/graph/detail/adjacency_list.hpp
    +++ b/include/boost/graph/detail/adjacency_list.hpp
    @@ -1610,8 +1610,7 @@ namespace boost {
        typename Config::OutEdgeList::iterator first, last;
        typename Config::EdgeContainer fake_edge_container;
        boost::tie(first, last) = graph_detail::
    -        equal_range(el, StoredEdge(v, fake_edge_container.end(),
    -                                   &fake_edge_container));
    +        equal_range(el, StoredEdge(v));
        return std::make_pair(out_edge_iterator(first, u),
                                out_edge_iterator(last, u));
        }
    
    树21e89a6ae24b1d94cdc38e3e0219ae81f0ff52e9
    母公司031ce8084b5ca6e79b359b3a3fee671115fffc41
    作者Jeremiah Willcock 10月26日星期六22:57:10 2013+0000
    提交人Jeremiah Willcock,2013年10月26日22:57:10+0000
    固定边缘_范围错误从http://stackoverflow.com/questions/19223692/boost-graph-library-directed-multigraph-edge-range-bug?rq=1
    [SVN r86469]
    diff--git a/include/boost/graph/detail/adj_list.hpp b/include/boost/graph/detail/adj_list.hpp
    索引16cf026..87fd557 100644
    ---a/include/boost/graph/detail/adjacence_list.hpp
    +++b/include/boost/graph/detail/adjancy_list.hpp
    @@-1610,8+1610,7@@命名空间增强{
    typename配置::OutEdgeList::迭代器first,last;
    typename配置::EdgeContainer fake_edge_容器;
    boost::tie(first,last)=图表详细信息:
    -相等范围(el,StoredEdge(v,假边缘)容器。end(),
    -&假边(容器));
    +等量程(el,储存Ge(v));
    返回std::make_pair(out_edge_迭代器(第一个,u),
    out_edge_迭代器(last,u));
    }
    

    您可以看到它(使用Boost 1.57)

    您好,您用来重新格式化txt的命令是什么?我很惊讶您能在一秒钟内更新它们。谢谢。只需使用按钮:(另请参阅)嗨,sehe,我应该如何在Coliru中运行/编译代码?在我单击编辑、编译/链接/运行后,我什么也没发生。谢谢,它可能超时了:(在这种情况下,切换到
    clang++-Os
    有时会有帮助。不要忘记所示的程序没有输出。如果它一直超时,你可以购买一台机器在其上运行GCC,或者(像)我要求Coliru的维护人员增加超时:)嗨,我成功了。这是一个有趣的工具。