diff --git a/include/boost/graph/graphml.hpp b/include/boost/graph/graphml.hpp index a7faa647..32953ddb 100644 --- a/include/boost/graph/graphml.hpp +++ b/include/boost/graph/graphml.hpp @@ -289,10 +289,13 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, { if (i->second->key() == typeid(Graph*)) { + std::string type_name = "string"; + mpl::for_each(get_type_name(i->second->value(), type_names, type_name)); // The const_cast here is just to get typeid correct for property // map key; the graph should not be mutated using it. out << " first] << "\">" - << encode_char_entities(i->second->get_string(const_cast(&g))) << "\n"; + << (type_name == "boolean" ? (i->second->get_string(const_cast(&g)) == "1" ? "true" : "false") + : encode_char_entities(i->second->get_string(const_cast(&g)))) << "\n"; } } @@ -306,8 +309,11 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, { if (i->second->key() == typeid(vertex_descriptor)) { + std::string type_name = "string"; + mpl::for_each(get_type_name(i->second->value(), type_names, type_name)); out << " first] << "\">" - << encode_char_entities(i->second->get_string(*v)) << "\n"; + << (type_name == "boolean" ? (i->second->get_string((*v)) == "1" ? "true" : "false") + : encode_char_entities(i->second->get_string(*v))) << "\n"; } } out << " \n"; @@ -327,8 +333,11 @@ write_graphml(std::ostream& out, const Graph& g, VertexIndexMap vertex_index, { if (i->second->key() == typeid(edge_descriptor)) { + std::string type_name = "string"; + mpl::for_each(get_type_name(i->second->value(), type_names, type_name)); out << " first] << "\">" - << encode_char_entities(i->second->get_string(*e)) << "\n"; + << (type_name == "boolean" ? (i->second->get_string((*e)) == "1" ? "true" : "false") + : encode_char_entities(i->second->get_string(*e))) << "\n"; } } out << " \n";