Boost C++ Libraries: Ticket #10086: Backwards compatibility to 1.42 adjacency list serialisation is broken https://svn.boost.org/trac10/ticket/10086 <p> I have an archive created with boost serialization of an adjacency list which was created with boost 1.42. When switching to Boost 1.55, the adjacency list cannot be deserialised from the archive anymore. </p> <p> I identified commit <a class="changeset" href="https://svn.boost.org/trac10/changeset/77549" title="Changed property lookup code to simplify graph implementations (remove ...">[77549]</a> which probably broke the serialisation: It appears that the vertex and edges are not wrapped in a 'property' anymore, but stored directly in the adjacency list. Additionaly, in <a class="changeset" href="https://svn.boost.org/trac10/changeset/77615" title="Added graph property to serialization, and made default graph property ...">[77615]</a> a new member "graph_property" was added to the serialisation code. </p> <p> Unfortunately, the serialisation version number of adjacency list was not incremented and the code in 'boost/graph/adj_list_serialize.hpp' was not changed accordingly. </p> <p> Furthermore in 'boost/pending/property_serialize.hpp', the serialisation order of 'value' and 'base' was switched, again without changing the class serialisation version number. </p> <p> I was able to load the old archive by making following changes: </p> <p> <strong> adj_list_serialize.hpp </strong> </p> <pre class="wiki">template&lt;class Archive, class OEL, class VL, class D, class VP, class EP, class GP, class EL&gt; inline void load( Archive &amp; ar, boost::adjacency_list&lt;OEL,VL,D,VP,EP,GP,EL&gt; &amp;graph, const unsigned int /* file_version */ ){ typedef adjacency_list&lt;OEL,VL,D,VP,EP,GP,EL&gt; Graph; typedef typename graph_traits&lt;Graph&gt;::vertex_descriptor Vertex; typedef typename graph_traits&lt;Graph&gt;::edge_descriptor Edge; unsigned int V; ar &gt;&gt; BOOST_SERIALIZATION_NVP(V); unsigned int E; ar &gt;&gt; BOOST_SERIALIZATION_NVP(E); std::vector&lt;Vertex&gt; verts(V); int i = 0; while(V-- &gt; 0){ // &gt;&gt;&gt;&gt;&gt; BOOST_ADJ_LIST_1_42_SERIALIZATION_PATCH if( ar.get_library_version() &lt;= 7 /* not sure about the 7, could be a greater version */){ Vertex v = add_vertex(graph); boost::property&lt;boost::vertex_bundle_t, VP&gt; vertexAsProperty; ar &gt;&gt; vertexAsProperty; graph[v] = vertexAsProperty.m_value; verts[i++] = v; } else // &lt;&lt;&lt;&lt;&lt; BOOST_ADJ_LIST_1_42_SERIALIZATION_PATCH { Vertex v = add_vertex(graph); verts[i++] = v; ar &gt;&gt; serialization::make_nvp("vertex_property", get(vertex_all_t(), graph, v) ); } } while(E-- &gt; 0){ // &gt;&gt;&gt;&gt;&gt; BOOST_ADJ_LIST_1_42_SERIALIZATION_PATCH if( ar.get_library_version() &lt;= 7 /* not sure about the 7, could be a greater version */){ int u; int v; ar &gt;&gt; BOOST_SERIALIZATION_NVP(u); ar &gt;&gt; BOOST_SERIALIZATION_NVP(v); Edge e; bool inserted; boost::tie(e,inserted) = add_edge(verts[u], verts[v], graph); boost::property&lt;boost::edge_bundle_t, EP&gt; edgeAsProperty; ar &gt;&gt; edgeAsProperty; graph[e] = edgeAsProperty.m_value; } else // &lt;&lt;&lt;&lt;&lt; BOOST_ADJ_LIST_1_42_SERIALIZATION_PATCH { int u; int v; ar &gt;&gt; BOOST_SERIALIZATION_NVP(u); ar &gt;&gt; BOOST_SERIALIZATION_NVP(v); Edge e; bool inserted; boost::tie(e,inserted) = add_edge(verts[u], verts[v], graph); ar &gt;&gt; serialization::make_nvp("edge_property", get(edge_all_t(), graph, e) ); } } // &gt;&gt;&gt;&gt;&gt; BOOST_ADJ_LIST_1_42_SERIALIZATION_PATCH if(are_Adjacency_list_and_boost_property_in_old_format(ar) == false) ar &gt;&gt; serialization::make_nvp("graph_property", get_property(graph, graph_all_t()) ); // &lt;&lt;&lt;&lt;&lt; BOOST_ADJ_LIST_1_42_SERIALIZATION_PATCH } </pre><p> <strong> property_serialize.hpp </strong> </p> <pre class="wiki">template&lt;class Archive, class Tag, class T, class Base&gt; void serialize(Archive&amp; ar, property&lt;Tag, T, Base&gt;&amp; prop, const unsigned int /*version*/) { // &gt;&gt;&gt;&gt;&gt; BOOST_ADJ_LIST_1_42_SERIALIZATION_PATCH if( ar.get_library_version() &lt;= 7 /* not sure about the 7, could be a greater version */){ ar &amp; serialization::make_nvp( "property_base" , prop.m_base); ar &amp; serialization::make_nvp( "property_value" , prop.m_value ); } else // &lt;&lt;&lt;&lt;&lt; BOOST_ADJ_LIST_1_42_SERIALIZATION_PATCH { ar &amp; serialization::make_nvp( "property_value" , prop.m_value ); ar &amp; serialization::make_nvp( "property_base" , prop.m_base ); } } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10086 Trac 1.4.3