[Boost-users] [Graph] Problems with in-edges for a user defined AdjacencyList

205 views
Skip to first unread message

Berit Løfstedt

unread,
Jul 30, 2010, 9:24:09 AM7/30/10
to Boost...@lists.boost.org
Hi,

I am fairly new to boost and I have a problem using the in_edges(v, G) function.

I have defined a graph of type AdjacencyList:
typedef adjacency_list<
vecS,
vecS,
directedS,
VertexProperties,
EdgeProperties
> mcf_graph;


The following code with m_current_network being a private class variable of type mcf_graph

void best_insertion::search()
{
  vertex_descriptor v,u,w;
  edge_descriptor e;
  graph_traits<mcf_graph>::in_edge_iterator in_e, in_end;
  graph_traits<mcf_graph>::out_edge_iterator out_e, out_end;
  edge_index_map_t edge_indices=get ( edge_index, m_current_network );
  edge_type_map_t edge_types= get(edge_type, m_current_network);
  capacity_map_t edge_capacities=get ( edge_capacity, m_current_network );

  vector<int> indices;
  vector<int>::iterator it, it_end;

//select vertex v to reinsert

//find_edge_indices of vertex v
  for ( tie ( in_e, in_end ) = in_edges(v, m_current_network ); in_e != in_end; in_e++ )
    {
      e=*in_e;
      indices.push_back ( edge_indices[e] );

    }

  for ( tie ( out_e, out_end ) = out_edges( v, m_current_network ); out_e != out_end; out_e++ )
    {
      e=*out_e;
      indices.push_back ( edge_indices[e] );
    }

 produces the error:
 error: no matching function for call to ‘in_edges(vertex_descriptor&, mcf_graph&)’

The problem does not occur for out_edges. From the examples I have seen AdjacencyList should support both functions. Can anybody explain to me why in_edges do not work for this example?


--
Best Regards,

 
Berit Løfstedt

PhD. Student

DTU Management Engineering, Operations Research
 

Technical University of Denmark

Department of Management Engineering
Produktionstorvet, Bygning 426
2800  Kgs. Lyngby
bl...@man.dtu.dk
www.or.man.dtu.dk

 




Jeremiah Willcock

unread,
Jul 30, 2010, 11:43:54 AM7/30/10
to boost...@lists.boost.org
On Fri, 30 Jul 2010, Berit L�fstedt wrote:

> Hi,
>
> I am fairly new to boost and I have a problem using the in_edges(v, G)
> function.
>
> I have defined a graph of type AdjacencyList:
> typedef adjacency_list<
> vecS,
> vecS,
> directedS,
> VertexProperties,
> EdgeProperties
>> mcf_graph;

(snip)

> produces the error:
> error: no matching function for call to 'in_edges(vertex_descriptor&,
> mcf_graph&)'
>
> The problem does not occur for out_edges. From the examples I have seen
> AdjacencyList should support both functions. Can anybody explain to me why
> in_edges do not work for this example?

The AdjancencyList concept only requires out_edges(). If you want
in_edges(), your graph must be specified with bidirectionalS rather than
directedS as the directedness category.

-- Jeremiah Willcock

Line Blander Reinhardt

unread,
Jul 31, 2010, 1:10:39 PM7/31/10
to boost...@lists.boost.org
Hi
Try using bidirectionalS instead (thats what I do for my directed graphs).
Please tell me is it works.
Best
Line :-)

________________________________________
Fra: boost-use...@lists.boost.org [boost-use...@lists.boost.org] P&#229; vegne af Berit Løfstedt [bl...@man.dtu.dk]
Sendt: 30. juli 2010 15:24
Til: Boost...@lists.boost.org
Emne: [Boost-users] [Graph] Problems with in-edges for a user defined AdjacencyList

Hi,

}


--
Best Regards,


Berit Løfstedt

PhD. Student


Technical University of Denmark
[cid:part1.00040...@man.dtu.dk]

Department of Management Engineering
Produktionstorvet, Bygning 426
2800 Kgs. Lyngby

bl...@man.dtu.dk<mailto:bl...@man.dtu.dk>
www.or.man.dtu.dk<http://www.or.man.dtu.dk>


_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Berit Løfstedt

unread,
Jul 31, 2010, 3:38:25 PM7/31/10
to boost...@lists.boost.org
Hi Line,

It does - excellent advice ;-)


Best Regards,

�
Berit L�fstedt

PhD. Student

DTU Management Engineering, Operations Research

�

Technical University of Denmark

Department of�Management Engineering
Produktionstorvet, Bygning 426
2800� Kgs. Lyngby
bl...@man.dtu.dk
www.or.man.dtu.dk

�






Line Blander Reinhardt wrote:
Hi
Try using bidirectionalS instead (thats what I do for my directed graphs).
Please tell me is it works.
Best
   Line :-)

________________________________________
Fra: boost-use...@lists.boost.org [boost-use...@lists.boost.org] P&#229; vegne af Berit L�fstedt [bl...@man.dtu.dk]
Sendt: 30. juli 2010 15:24
Til: Boost...@lists.boost.org

  
mcf_graph;
    

The following code with m_current_network being a private class variable of type mcf_graph

void best_insertion::search()
{
  vertex_descriptor v,u,w;
  edge_descriptor e;
  graph_traits<mcf_graph>::in_edge_iterator in_e, in_end;
  graph_traits<mcf_graph>::out_edge_iterator out_e, out_end;
  edge_index_map_t edge_indices=get ( edge_index, m_current_network );
  edge_type_map_t edge_types= get(edge_type, m_current_network);
  capacity_map_t edge_capacities=get ( edge_capacity, m_current_network );

  vector<int> indices;
  vector<int>::iterator it, it_end;

//select vertex v to reinsert

//find_edge_indices of vertex v
  for ( tie ( in_e, in_end ) = in_edges(v, m_current_network ); in_e != in_end; in_e++ )
    {
      e=*in_e;
      indices.push_back ( edge_indices[e] );

    }

  for ( tie ( out_e, out_end ) = out_edges( v, m_current_network ); out_e != out_end; out_e++ )
    {
      e=*out_e;
      indices.push_back ( edge_indices[e] );
    }

 produces the error:
 error: no matching function for call to �in_edges(vertex_descriptor&, mcf_graph&)�

The problem does not occur for out_edges. From the examples I have seen AdjacencyList should support both functions. Can anybody explain to me why in_edges do not work for this example?


--
Best Regards,


Berit L�fstedt

PhD. Student


DTU Management Engineering, Operations Research


Technical University of Denmark
        [cid:part1.00040...@man.dtu.dk]

Department of Management Engineering
Produktionstorvet, Bygning 426
2800  Kgs. Lyngby

Berit Løfstedt

unread,
Jul 31, 2010, 3:38:59 PM7/31/10
to boost...@lists.boost.org
Thanks - that resolved the issue :-)


Best Regards,

 
Berit Løfstedt

PhD. Student

DTU Management Engineering, Operations Research
 

Technical University of Denmark

Department of Management Engineering
Produktionstorvet, Bygning 426
2800  Kgs. Lyngby
bl...@man.dtu.dk
www.or.man.dtu.dk

 






Jeremiah Willcock wrote:
Reply all
Reply to author
Forward
0 new messages