|
Boost : |
From: Walter Landry (wlandry_at_[hidden])
Date: 2006-09-11 19:02:20
Greetings,
It seems that serializing a graph into a file is broken. If I strip
down the Kevin bacon example and make it write to an archive rather
than read, I get a rather lengthy error message with g++ 3.3, 3.4,
4.0, and 4.1 on Linux. I get a different error if I try to serialize
a graph with no edge property. Is that known to be unsupported? I am
attaching the sample file and the error from g++ 4.1. This is using
the CVS version as of about a week ago.
As an aside, adjacency_list does not implement empty(). Shouldn't it?
Cheers,
Walter Landry
wlandry_at_[hidden]
#include <boost/config.hpp>
#include <iostream>
#include <fstream>
#include <string>
#include <boost/tuple/tuple.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/visitors.hpp>
#include <boost/graph/breadth_first_search.hpp>
#include <map>
#include <boost/graph/adj_list_serialize.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
struct vertex_properties {
std::string name;
template<class Archive>
void serialize(Archive & ar, const unsigned int version) {
ar & name;
}
};
struct edge_properties {
std::string name;
template<class Archive>
void serialize(Archive & ar, const unsigned int version) {
ar & name;
}
};
using namespace boost;
typedef adjacency_list<vecS, vecS, undirectedS,
vertex_properties, edge_properties> Graph;
typedef adjacency_list<vecS, vecS, undirectedS,
vertex_properties> Graph_no_edge_property;
int main()
{
{
std::ifstream ifs("./kevin-bacon2.dat");
archive::text_iarchive ia(ifs);
Graph g;
ia >> g;
// Graph_no_edge_property g_n;
// ia >> g_n;
}
{
std::ofstream ofs("./kevin-bacon2.dat");
archive::text_oarchive oa(ofs);
Graph g;
oa << g;
// Graph_no_edge_property g_n;
// oa << g_n;
}
return 0;
}
../../../boost/boost/graph/adj_list_serialize.hpp: In function âvoid boost::serialization::save(Archive&, const boost::adjacency_list<OEL, VL, D, VP, EP, GP, EL>&, unsigned int) [with Archive = boost::archive::text_oarchive, OEL = boost::vecS, VL = boost::vecS, D = boost::undirectedS, VP = vertex_properties, EP = edge_properties, GP = boost::no_property, EL = boost::listS]â:
../../../boost/boost/serialization/split_free.hpp:45: instantiated from âstatic void boost::serialization::free_saver<Archive, T>::invoke(Archive&, const T&, unsigned int) [with Archive = boost::archive::text_oarchive, T = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>]â
../../../boost/boost/serialization/split_free.hpp:74: instantiated from âvoid boost::serialization::split_free(Archive&, T&, unsigned int) [with Archive = boost::archive::text_oarchive, T = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>]â
../../../boost/boost/graph/adj_list_serialize.hpp:97: instantiated from âvoid boost::serialization::serialize(Archive&, boost::adjacency_list<OEL, VL, D, VP, EP, GP, EL>&, unsigned int) [with Archive = boost::archive::text_oarchive, OEL = boost::vecS, VL = boost::vecS, D = boost::undirectedS, VP = vertex_properties, EP = edge_properties, GP = boost::no_property, EL = boost::listS]â
../../../boost/boost/serialization/serialization.hpp:140: instantiated from âvoid boost::serialization::serialize_adl(Archive&, T&, unsigned int) [with Archive = boost::archive::text_oarchive, T = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>]â
../../../boost/boost/archive/detail/oserializer.hpp:151: instantiated from âvoid boost::archive::detail::oserializer<Archive, T>::save_object_data(boost::archive::detail::basic_oarchive&, const void*) const [with Archive = boost::archive::text_oarchive, T = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>]â
kevin-bacon2.cpp:61: instantiated from here
../../../boost/boost/graph/adj_list_serialize.hpp:45: error: no match for âoperator<<â in âar << boost::get(Property, const boost::adj_list_helper<Config, Base>&, const Key&) [with Config = boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>, boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, boost::no_property, boost::listS>::config, Base = boost::undirected_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>, boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, boost::no_property, boost::listS>::config>, Property = boost::vertex_all_t, Key = unsigned int](((const boost::adj_list_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>, boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, boost::no_property, boost::listS>::config, boost::undirected_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>, boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, boost::no_property, boost::listS>::config> >&)((const boost::adj_list_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>, boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, boost::no_property, boost::listS>::config, boost::undirected_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>, boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, boost::no_property, boost::listS>::config> >*)(+ graph))), ((const unsigned int&)(+((boost::iterator_facade<boost::counting_iterator<unsigned int, boost::use_default, boost::use_default>, unsigned int, boost::random_access_traversal_tag, const unsigned int&, long long int>*)(& vi))->boost::iterator_facade<I, V, TC, R, D>::operator* [with Derived = boost::counting_iterator<unsigned int, boost::use_default, boost::use_default>, Value = unsigned int, CategoryOrTraversal = boost::random_access_traversal_tag, Reference = const unsigned int&, Difference = long long int]())))â
../../../boost/boost/archive/detail/interface_oarchive.hpp:78: note: candidates are: Archive& boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T = boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, Archive = boost::archive::text_oarchive]
../../../boost/boost/serialization/split_free.hpp:45: instantiated from âstatic void boost::serialization::free_saver<Archive, T>::invoke(Archive&, const T&, unsigned int) [with Archive = boost::archive::text_oarchive, T = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>]â
../../../boost/boost/serialization/split_free.hpp:74: instantiated from âvoid boost::serialization::split_free(Archive&, T&, unsigned int) [with Archive = boost::archive::text_oarchive, T = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>]â
../../../boost/boost/graph/adj_list_serialize.hpp:97: instantiated from âvoid boost::serialization::serialize(Archive&, boost::adjacency_list<OEL, VL, D, VP, EP, GP, EL>&, unsigned int) [with Archive = boost::archive::text_oarchive, OEL = boost::vecS, VL = boost::vecS, D = boost::undirectedS, VP = vertex_properties, EP = edge_properties, GP = boost::no_property, EL = boost::listS]â
../../../boost/boost/serialization/serialization.hpp:140: instantiated from âvoid boost::serialization::serialize_adl(Archive&, T&, unsigned int) [with Archive = boost::archive::text_oarchive, T = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>]â
../../../boost/boost/archive/detail/oserializer.hpp:151: instantiated from âvoid boost::archive::detail::oserializer<Archive, T>::save_object_data(boost::archive::detail::basic_oarchive&, const void*) const [with Archive = boost::archive::text_oarchive, T = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>]â
kevin-bacon2.cpp:61: instantiated from here
../../../boost/boost/graph/adj_list_serialize.hpp:53: error: no match for âoperator<<â in âar << boost::get(Property, const boost::adj_list_helper<Config, Base>&, const Key&) [with Config = boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>, boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, boost::no_property, boost::listS>::config, Base = boost::undirected_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>, boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, boost::no_property, boost::listS>::config>, Property = boost::edge_all_t, Key = boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>](((const boost::adj_list_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>, boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, boost::no_property, boost::listS>::config, boost::undirected_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>, boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, boost::no_property, boost::listS>::config> >&)((const boost::adj_list_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>, boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, boost::no_property, boost::listS>::config, boost::undirected_graph_helper<boost::detail::adj_list_gen<boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, vertex_properties, edge_properties, boost::no_property, boost::listS>, boost::vecS, boost::vecS, boost::undirectedS, boost::property<boost::vertex_bundle_t, vertex_properties, boost::no_property>, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, boost::no_property, boost::listS>::config> >*)(+ graph))), ((const boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>&)((const boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>*)(&((boost::iterator_facade<boost::detail::undirected_edge_iter<std::_List_iterator<boost::list_edge<unsigned int, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property> > >, boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>, int>, boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>, boost::bidirectional_traversal_tag, boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>, int>*)(& ei))->boost::iterator_facade<I, V, TC, R, D>::operator* [with Derived = boost::detail::undirected_edge_iter<std::_List_iterator<boost::list_edge<unsigned int, boost::property<boost::edge_bundle_t, edge_properties, boost::no_property> > >, boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>, int>, Value = boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>, CategoryOrTraversal = boost::bidirectional_traversal_tag, Reference = boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>, Difference = int]()))))â
../../../boost/boost/archive/detail/interface_oarchive.hpp:78: note: candidates are: Archive& boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T = boost::property<boost::edge_bundle_t, edge_properties, boost::no_property>, Archive = boost::archive::text_oarchive]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk