|
Boost Users : |
From: Irek Szczesniak (ijs_at_[hidden])
Date: 2006-04-14 16:48:11
I want to use the read_graphiz function to load graphviz files. Graph
links have an extra property called "lambdas," which tells about the
number of wavelengths a link has. This link attribute is a positive
integer.
Below I'm sending you the program which I thought should work, but it
doesn't. Plus, there is a sample graphviz file. I have hard time
trying to decipher the errors, and made little progress, and so I
would appreciate any advice. I'm attaching the compilation errors.
Thanks for reading.
Thanks & best,
Irek
*********************************************************************
#include <fstream>
#include <string>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graphviz.hpp>
#include <boost/graph/depth_first_search.hpp>
#include <boost/graph/iteration_macros.hpp>
using namespace boost;
enum edge_lambdas_t { edge_lambdas };
namespace boost
{
BOOST_INSTALL_PROPERTY(edge, lambdas);
}
typedef boost::adjacency_list<vecS, vecS, undirectedS,
property<vertex_name_t, std::string>,
property<edge_weight_t, double>,
property<edge_lambdas_t, int> > Graph;
int
main()
{
Graph g;
dynamic_properties dp;
dp.property("lambdas", get(edge_lambdas, g));
dp.property("node_id", get(vertex_name, g));
dp.property("distance", get(edge_weight, g));
read_graphviz(std::cin, g, dp);
}
***********************************************************************
graph {
a;
b;
c;
c -- a [distance="100", lambdas="4"];
a -- b [distance="200", lambdas="4"];
}
***********************************************************************
g++ -I /usr/local/include/boost-1_33_1/ -l bgl-viz load.cc -o load
/usr/local/include/boost-1_33_1/boost/dynamic_property_map.hpp: In
member function `std::string
boost::detail::dynamic_property_map_adaptor<PropertyMap>::get_string(const
boost::any&) [with PropertyMap =
boost::adj_list_edge_property_map<boost::undirected_tag,
boost::detail::error_property_not_found,
boost::detail::error_property_not_found&, size_t,
boost::property<boost::edge_weight_t, double, boost::no_property>,
edge_lambdas_t>]':
load.cc:236: instantiated from here
/usr/local/include/boost-1_33_1/boost/dynamic_property_map.hpp:196:
error: no match for 'operator<<' in 'out << boost::get [with
PropertyMap = boost::adj_list_edge_property_map<boost::undirected_tag,
boost::detail::error_property_not_found,
boost::detail::error_property_not_found&, size_t,
boost::property<boost::edge_weight_t, double, boost::no_property>,
edge_lambdas_t>, Reference = boost::detail::error_property_not_found&,
K = boost::detail::edge_desc_impl<boost::undirected_tag,
size_t>](((const
boost::put_get_helper<boost::detail::error_property_not_found&,
boost::adj_list_edge_property_map<boost::undirected_tag,
boost::detail::error_property_not_found,
boost::detail::error_property_not_found&, size_t,
boost::property<boost::edge_weight_t, double, boost::no_property>,
edge_lambdas_t> >&)((const
boost::put_get_helper<boost::detail::error_property_not_found&,
boost::adj_list_edge_property_map<boost::undirected_tag,
boost::detail::error_property_not_found,
boost::detail::error_property_not_found&, size_t,
boost::property<boost::edge_weight_t, double, boost::no_property>,
edge_lambdas_t>
>*)((boost::put_get_helper<boost::detail::error_property_not_found&,
boost::adj_list_edge_property_map<boost::undirected_tag,
boost::detail::error_property_not_found,
boost::detail::error_property_not_found&, size_t,
boost::property<boost::edge_weight_t, double, boost::no_property>,
edge_lambdas_t>
>*)(((boost::adj_list_edge_property_map<boost::undirected_tag,
boost::detail::error_property_not_found,
boost::detail::error_property_not_found&, size_t,
boost::property<boost::edge_weight_t, double, boost::no_property>,
edge_lambdas_t>*)((boost::detail::dynamic_property_map_adaptor<boost::adj_list_edge_property_map<boost::undirected_tag,
boost::detail::error_property_not_found,
boost::detail::error_property_not_found&, size_t,
boost::property<boost::edge_weight_t, double, boost::no_property>,
edge_lambdas_t> >*)this)) + 4u)))), ((const
boost::detail::edge_desc_impl<boost::undirected_tag, size_t>&)((const
boost::detail::edge_desc_impl<boost::undirected_tag,
size_t>*)(&boost::any_cast [with ValueType =
boost::detail::edge_desc_impl<boost::undirected_tag, size_t>](((const
boost::any&)(+key)))))))'
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:63:
note: candidates are: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT,
_Traits>::operator<<(std::basic_ostream<_CharT,
_Traits>&(*)(std::basic_ostream<_CharT, _Traits>&)) [with _CharT =
char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:74:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ios<_CharT,
_Traits>&(*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char,
_Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:86:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT,
_Traits>::operator<<(std::ios_base&(*)(std::ios_base&)) [with _CharT =
char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:121:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT
= char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:155:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int)
[with _CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:98:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT =
char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:178:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:189:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int)
[with _CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:193:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT =
char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:204:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:179:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:214:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned
int) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:238:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT =
char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:219:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT =
char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:261:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:284:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:307:
note: std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT,
_Traits>::operator<<(std::basic_streambuf<_CharT, _Traits>*) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:504:
note: std::basic_ostream<char, _Traits>&
std::operator<<(std::basic_ostream<char, _Traits>&, const unsigned
char*) [with _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:499:
note: std::basic_ostream<char, _Traits>&
std::operator<<(std::basic_ostream<char, _Traits>&, const signed
char*) [with _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:612:
note: std::basic_ostream<char, _Traits>&
std::operator<<(std::basic_ostream<char, _Traits>&, const char*) [with
_Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:567:
note: std::basic_ostream<_CharT, _Traits>&
std::operator<<(std::basic_ostream<_CharT, _Traits>&, const char*)
[with _CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:465:
note: std::basic_ostream<char, _Traits>&
std::operator<<(std::basic_ostream<char, _Traits>&, unsigned char)
[with _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:460:
note: std::basic_ostream<char, _Traits>&
std::operator<<(std::basic_ostream<char, _Traits>&, signed char) [with
_Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ostream.tcc:505:
note: std::basic_ostream<char, _Traits>&
std::operator<<(std::basic_ostream<char, _Traits>&, char) [with
_Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:449:
note: std::basic_ostream<_CharT, _Traits>&
std::operator<<(std::basic_ostream<_CharT, _Traits>&, char) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/local/include/boost-1_33_1/boost/lexical_cast.hpp: In member
function `bool boost::detail::lexical_stream<Target,
Source>::operator>>(InputStreamable&) [with InputStreamable =
boost::detail::error_property_not_found, Target =
boost::detail::error_property_not_found, Source =
std::basic_string<char, std::char_traits<char>, std::allocator<char> >]':
/usr/local/include/boost-1_33_1/boost/lexical_cast.hpp:222:
instantiated from `Target boost::lexical_cast(const Source&) [with
Target = boost::detail::error_property_not_found, Source =
std::basic_string<char, std::char_traits<char>, std::allocator<char> >]'
/usr/local/include/boost-1_33_1/boost/dynamic_property_map.hpp:42:
instantiated from `Value boost::detail::read_value(const std::string&)
[with Value = boost::detail::error_property_not_found]'
/usr/local/include/boost-1_33_1/boost/dynamic_property_map.hpp:160:
instantiated from `void
boost::detail::dynamic_property_map_adaptor<PropertyMap>::do_put(const
boost::any&, const boost::any&, mpl_::bool_< true>) [with PropertyMap
= boost::adj_list_edge_property_map<boost::undirected_tag,
boost::detail::error_property_not_found,
boost::detail::error_property_not_found&, size_t,
boost::property<boost::edge_weight_t, double, boost::no_property>,
edge_lambdas_t>]'
/usr/local/include/boost-1_33_1/boost/dynamic_property_map.hpp:203:
instantiated from `void
boost::detail::dynamic_property_map_adaptor<PropertyMap>::put(const
boost::any&, const boost::any&) [with PropertyMap =
boost::adj_list_edge_property_map<boost::undirected_tag,
boost::detail::error_property_not_found,
boost::detail::error_property_not_found&, size_t,
boost::property<boost::edge_weight_t, double, boost::no_property>,
edge_lambdas_t>]'
load.cc:236: instantiated from here
/usr/local/include/boost-1_33_1/boost/lexical_cast.hpp:156: error: no
match for 'operator>>' in
'((boost::detail::lexical_stream<boost::detail::error_property_not_found,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>*)this)->boost::detail::lexical_stream<boost::detail::error_property_not_found,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>::stream >> output'
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:87:
note: candidates are: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT,
_Traits>::operator>>(std::basic_istream<_CharT,
_Traits>&(*)(std::basic_istream<_CharT, _Traits>&)) [with _CharT =
char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:93:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(std::basic_ios<_CharT,
_Traits>&(*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char,
_Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:102:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT,
_Traits>::operator>>(std::ios_base&(*)(std::ios_base&)) [with _CharT =
char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:111:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT =
char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:133:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:164:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&)
[with _CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:186:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT =
char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:217:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:239:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:261:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&)
[with _CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:284:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:306:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned
int&) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:329:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT =
char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:351:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT
= char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:373:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:395:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT =
char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/istream.tcc:417:
note: std::basic_istream<_CharT, _Traits>&
std::basic_istream<_CharT,
_Traits>::operator>>(std::basic_streambuf<_CharT, _Traits>*) [with
_CharT = char, _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/istream:692:
note: std::basic_istream<char, _Traits>&
std::operator>>(std::basic_istream<char, _Traits>&, signed char*)
[with _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/istream:687:
note: std::basic_istream<char, _Traits>&
std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)
[with _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/istream:651:
note: std::basic_istream<char, _Traits>&
std::operator>>(std::basic_istream<char, _Traits>&, signed char&)
[with _Traits = std::char_traits<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/istream:646:
note: std::basic_istream<char, _Traits>&
std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)
[with _Traits = std::char_traits<char>]
make: *** [load] Error 1
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