File indexing completed on 2025-01-30 09:43:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_GRAPH_LOOKUP_EDGE_HPP
0011 #define BOOST_GRAPH_LOOKUP_EDGE_HPP
0012
0013 #include <utility>
0014 #include <boost/config.hpp>
0015 #include <boost/utility/enable_if.hpp>
0016 #include <boost/graph/graph_traits.hpp>
0017
0018
0019
0020
0021 namespace boost
0022 {
0023
0024 template < typename Graph >
0025 std::pair< typename boost::graph_traits< Graph >::edge_descriptor, bool >
0026 lookup_edge(typename boost::graph_traits< Graph >::vertex_descriptor src,
0027 typename boost::graph_traits< Graph >::vertex_descriptor tgt,
0028 const Graph& g,
0029 typename boost::enable_if< is_adjacency_matrix< Graph >, int >::type = 0)
0030 {
0031 return edge(src, tgt, g);
0032 }
0033
0034 template < typename Graph >
0035 std::pair< typename boost::graph_traits< Graph >::edge_descriptor, bool >
0036 lookup_edge(typename boost::graph_traits< Graph >::vertex_descriptor src,
0037 typename boost::graph_traits< Graph >::vertex_descriptor tgt,
0038 const Graph& g,
0039 typename boost::disable_if< is_adjacency_matrix< Graph >, int >::type = 0)
0040 {
0041 typedef typename boost::graph_traits< Graph >::out_edge_iterator it;
0042 typedef typename boost::graph_traits< Graph >::edge_descriptor edesc;
0043 std::pair< it, it > oe = out_edges(src, g);
0044 for (; oe.first != oe.second; ++oe.first)
0045 {
0046 edesc e = *oe.first;
0047 if (target(e, g) == tgt)
0048 return std::make_pair(e, true);
0049 }
0050 return std::make_pair(edesc(), false);
0051 }
0052
0053 }
0054
0055 #endif