Commit 0d86003c authored by Tiago Peixoto's avatar Tiago Peixoto

Fix in_neighbor selector

parent e0153068
...@@ -629,6 +629,7 @@ struct graph_traits<adj_list<Vertex> > ...@@ -629,6 +629,7 @@ struct graph_traits<adj_list<Vertex> >
typedef typename adj_list<Vertex>::edge_descriptor edge_descriptor; typedef typename adj_list<Vertex>::edge_descriptor edge_descriptor;
typedef typename adj_list<Vertex>::edge_iterator edge_iterator; typedef typename adj_list<Vertex>::edge_iterator edge_iterator;
typedef typename adj_list<Vertex>::adjacency_iterator adjacency_iterator; typedef typename adj_list<Vertex>::adjacency_iterator adjacency_iterator;
typedef typename adj_list<Vertex>::in_adjacency_iterator in_adjacency_iterator;
typedef typename adj_list<Vertex>::out_edge_iterator out_edge_iterator; typedef typename adj_list<Vertex>::out_edge_iterator out_edge_iterator;
typedef typename adj_list<Vertex>::in_edge_iterator in_edge_iterator; typedef typename adj_list<Vertex>::in_edge_iterator in_edge_iterator;
......
...@@ -443,10 +443,10 @@ struct get_in_neighbors ...@@ -443,10 +443,10 @@ struct get_in_neighbors
boost::directed_tag>)); boost::directed_tag>));
typedef typename boost::graph_traits<Graph>::vertex_descriptor typedef typename boost::graph_traits<Graph>::vertex_descriptor
vertex_descriptor; vertex_descriptor;
typedef typename boost::graph_traits<Graph>::in_neighbor_iterator type; typedef typename Graph::in_adjacency_iterator type;
inline __attribute__((always_inline)) inline __attribute__((always_inline))
static std::pair<type,type> get_edges(vertex_descriptor v, static std::pair<type,type> get_neighbors(vertex_descriptor v,
const Graph& g) const Graph& g)
{ {
return in_neighbors(v, g); return in_neighbors(v, g);
} }
...@@ -460,7 +460,7 @@ struct get_in_neighbors<Graph,std::false_type> ...@@ -460,7 +460,7 @@ struct get_in_neighbors<Graph,std::false_type>
boost::undirected_tag>)); boost::undirected_tag>));
typedef typename boost::graph_traits<Graph>::vertex_descriptor typedef typename boost::graph_traits<Graph>::vertex_descriptor
vertex_descriptor; vertex_descriptor;
typedef typename boost::graph_traits<Graph>::out_neighbors_iterator type; typedef typename boost::graph_traits<Graph>::adjacency_iterator type;
inline __attribute__((always_inline)) inline __attribute__((always_inline))
static std::pair<type,type> get_neighbors(vertex_descriptor, static std::pair<type,type> get_neighbors(vertex_descriptor,
const Graph&) const Graph&)
...@@ -479,7 +479,7 @@ struct in_neighbor_iteratorS ...@@ -479,7 +479,7 @@ struct in_neighbor_iteratorS
directed_category; directed_category;
typedef typename std::is_convertible<directed_category, typedef typename std::is_convertible<directed_category,
boost::directed_tag>::type is_directed; boost::directed_tag>::type is_directed;
typedef typename get_in_edges<Graph,is_directed>::type type; typedef typename get_in_neighbors<Graph,is_directed>::type type;
typedef typename boost::graph_traits<Graph>::vertex_descriptor typedef typename boost::graph_traits<Graph>::vertex_descriptor
vertex_descriptor; vertex_descriptor;
...@@ -491,25 +491,11 @@ struct in_neighbor_iteratorS ...@@ -491,25 +491,11 @@ struct in_neighbor_iteratorS
} }
}; };
template <class Graph>
struct _all_neighbors_in_iteratorS
{
typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<Graph>::in_edge_iterator type;
inline __attribute__((always_inline))
static std::pair<type,type> get_neighbors(vertex_descriptor v,
const Graph& g)
{
return _all_neighbors_ins(v, g);
}
};
// out edges selector for completeness // out edges selector for completeness
template <class Graph> template <class Graph>
struct out_neighbor_iteratorS struct out_neighbor_iteratorS
{ {
typedef typename boost::graph_traits<Graph>::out_neighbors_iterator type; typedef typename boost::graph_traits<Graph>::adjacency_iterator type;
typedef typename boost::graph_traits<Graph>::vertex_descriptor typedef typename boost::graph_traits<Graph>::vertex_descriptor
vertex_descriptor; vertex_descriptor;
...@@ -549,7 +535,7 @@ struct in_or_out_neighbors_iteratorS ...@@ -549,7 +535,7 @@ struct in_or_out_neighbors_iteratorS
<typename boost::graph_traits<Graph>::directed_category, <typename boost::graph_traits<Graph>::directed_category,
boost::directed_tag>::value, boost::directed_tag>::value,
in_neighbor_iteratorS<Graph>, in_neighbor_iteratorS<Graph>,
_all_neighbors_in_iteratorS<Graph>>::type out_neighbor_iteratorS<Graph>>::type
{}; {};
// range adaptors // range adaptors
...@@ -655,10 +641,10 @@ auto in_or_out_edges_range(typename in_or_out_edge_iteratorS<Graph>::vertex_desc ...@@ -655,10 +641,10 @@ auto in_or_out_edges_range(typename in_or_out_edge_iteratorS<Graph>::vertex_desc
template <class Graph> template <class Graph>
inline __attribute__((always_inline)) __attribute__((flatten)) inline __attribute__((always_inline)) __attribute__((flatten))
auto in_or_out_neighbors_range(typename in_or_out_edge_iteratorS<Graph>::vertex_descriptor v, auto in_or_out_neighbors_range(typename in_or_out_neighbors_iteratorS<Graph>::vertex_descriptor v,
const Graph& g) const Graph& g)
{ {
return mk_range(in_or_out_edge_iteratorS<Graph>::get_neighbors(v, g)); return mk_range(in_or_out_neighbors_iteratorS<Graph>::get_neighbors(v, g));
} }
// useful type lists // useful type lists
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment