;

    graph_traits&lt;Graph&gt;::edge_iterator e, e_end;
    for (boost::tie(e,e_end) = edges(g); e != e_end; ++e)
        put(edge_weight_t(), g, *e, 3);

    dynamic_properties dp;
    dp.property(&quot;name&quot;, get(vertex_color_t(), g));
    dp.property(&quot;weight&quot;, get(edge_weight_t(), g));

    write_graphml(std::cout, g, dp, true);
 }
</pre>
<p>The output will be:</p>
<pre class="literal-block">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;graphml xmlns=&quot;http://