BGL in_edges() issue

Hi!
I started using Boost Graph Library and I've problems using in_edges() over a direct graph. I can print all out-edges for each vertex, but I'm not able to print in_edges.

Here's my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
typedef boost::adjacency_list<boost::listS, boost::vecS, boost::directedS> directed_graph;
directed_graph directG; 
    
directed_graph::vertex_iterator d_iterator, d_iteratorEnd; 
directed_graph::adjacency_iterator d_adjNode, d_adjNodeEnd; 
directed_graph::in_edge_iterator d_inEdge, d_inEdgeEnd; 
directed_graph::out_edge_iterator d_outEdge, d_outEdgeEnd; 
    
boost::adjacency_list<>::vertex_descriptor v1 = boost::add_vertex(directG); 
boost::adjacency_list<>::vertex_descriptor v2 = boost::add_vertex(directG); 
boost::adjacency_list<>::vertex_descriptor v3 = boost::add_vertex(directG); 
    
boost::add_edge(v1, v2, directG); //aggiunta arco(v1,v2)
boost::add_edge(v1, v3, directG); //aggiunta arco(v1,v3)
boost::add_edge(v3, v1, directG); //aggiunta arco (v3,v1)

std::cout<<"Out-Edge list for each vertex:"<<std::endl;
for(boost::tie(d_iterator, d_iteratorEnd)=boost::vertices(directG); d_iterator!=d_iteratorEnd; ++d_iterator){
       for(boost::tie(d_outEdge, d_outEdgeEnd)=boost::out_edges(*d_iterator, directG); d_outEdge!=d_outEdgeEnd; ++d_outEdge)
            std::cout<<"Out-Edge(): "<<*d_outEdge<<" "<<std::endl;
}

std::cout<<"In-Edge list for each vertex:"<<std::endl;
for(boost::tie(d_iterator, d_iteratorEnd)=boost::vertices(directG); d_iterator!=d_iteratorEnd; ++d_iterator){
     for(boost::tie(d_inEdge, d_inEdgeEnd)=boost::in_edges(*d_iterator, directG); d_inEdge!=d_inEdgeEnd; ++d_inEdge)
            std::cout<<"In-Edge(): "<<*d_inEdge<<" "<<std::endl;
    }


calling boost::in_edges(*d_iterator, directG) I get the following error: No matching function for call to in_edges()
Last edited on
in_edges() is not allowed in adjacency_list<listS, vecS, directionalS>,

change directionalS with, bidirectionalS to get cyclic graph.
Last edited on
Topic archived. No new replies allowed.