hadim / pygraphml

Parse GraphML file in Python.
BSD 3-Clause "New" or "Revised" License
59 stars 43 forks source link

Format incompatible with Boost GraphML loader #34

Open rancheng opened 5 years ago

rancheng commented 5 years ago

Thanks for your contribution! I'm currently using this lib to dump the graph data into xml and load with boost, but seems like these two formats are inconsistant:

part of xml wrote with pygraphml

<?xml version="1.0" ?>
<graphml>
    <key attr.name="label" attr.type="string" id="label"/>
    <graph edgedefault="directed" id="">
        <node id="v_000000001"/>
        <node id="v_000000040"/>

But when I try with boost, their file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key id="key0" for="edge" attr.name="edge_name" attr.type="string" />
  <key id="key1" for="node" attr.name="vertex_name" attr.type="string" />
  <graph id="G" edgedefault="undirected" parse.nodeids="free" parse.edgeids="canonical" parse.order="nodesfirst">
    <node id="n0">
      <data key="key1">v_000000000</data>
    </node>
    <node id="n1">
      <data key="key1">v_000000001</data>
    </node>

Is there any plan for support boost favorable format?

rancheng commented 5 years ago

If not, I have wrote a simple loader that read csv files into boost graphML xml:

write_graphml.cpp