Boost logo

Boost Users :

From: wei guo (boost_weiqing_at_[hidden])
Date: 2002-09-16 16:13:50


Hi, group:

I have a problem of using edge_property_type.

in the example file: undirected.cpp, I added several lines like:

template < typename DirectedGraph > void
directed_graph_demo()
{
  const int V = 2;
  DirectedGraph digraph(V);
  typename graph_traits < DirectedGraph >::vertex_descriptor u, v;
  typedef typename DirectedGraph::edge_property_type Weight;
  typename property_map < DirectedGraph, edge_weight_t >::type
    weight = get(edge_weight, digraph);
  typename graph_traits < DirectedGraph >::edge_descriptor e1, e2;
  bool found;

.........

  Weight w1 = get(weight, e1); // <<----------- added line
  Weight w2 = get(weight, e2); //
  put( weight, e1, w1*w2/(w1+w2) ); // <<----------- added line

  std::cout << "weight[(u,v)] = " << get(weight, e1) << std::endl;
  std::cout << "weight[(v,u)] = " << get(weight, e2) << std::endl;
}

I got following compiling errors with KAI compiler:

"undirected.cpp", line 83: error: no operator "*" matches these operands
            operand types are: Weight * Weight
    put( weight, e1, w1*w2/(w1+w2) );
                       ^
          detected during instantiation of "void
                    directed_graph_demo<DirectedGraph>() [with
                    DirectedGraph=DirectedGraph]"

"undirected.cpp", line 83: error: no operator "+" matches these operands
            operand types are: Weight + Weight
    put( weight, e1, w1*w2/(w1+w2) );
                              ^
          detected during instantiation of "void
                    directed_graph_demo<DirectedGraph>() [with
                    DirectedGraph=DirectedGraph]"

2 errors detected in the compilation of "undirected.cpp".

however, if I change the put statement in the example code to be:

put( weight, e1, get(weight, e1)*get(weight, e2)/(get(weight, e1)+get(weight, e2)) );

it compiled successfully.

So, what do I missing here, and what is the return type of get(weight, e2) ? and how it connected with DirectedGraph::edge_property_type ?

thanks in advance!

weiqing

 

 

---------------------------------
Do you Yahoo!?
Yahoo! News - Today's headlines

[Non-text portions of this message have been removed]


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net