Ask Your Question
1

I keep losing my node labels on graph export

asked 2016-01-15 20:21:55 -0500

Malte gravatar image

updated 2016-06-06 14:26:06 -0500

FrédéricC gravatar image

Hello! I often export Sage graphs by using networkx. This is a typical example:

import networkx
g = graphs.HerschelGraph()
h = g.networkx_graph()
networkx.write_graphml(h,'HerschelGraph.graphml')

However, when I open the graphml-file in the YEd Graph Editor (which is my favorite software for displaying graphs) I find that the node labels (that are clearly existent in the Sage version of the graph) have disappeared forever. Everything else works fine. Assuming that this is Sage's fault rather than the graph editor's fault: What can I do to export the node labels as well?

Thank you very much for your help.

Malte

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2016-01-16 04:23:58 -0500

tmonteil gravatar image

Looking at the file prodiced, the labels (and even the name) of the graph do appear:

<?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 attr.name="multiedges" attr.type="boolean" for="graph" id="d2" />
  <key attr.name="name" attr.type="string" for="graph" id="d1" />
  <key attr.name="selfloops" attr.type="boolean" for="graph" id="d0" />
  <graph edgedefault="undirected">
    <data key="d0">False</data>
    <data key="d1">Herschel graph</data>
    <data key="d2">False</data>
    <node id="0" />
    <node id="1" />
    <node id="2" />
    <node id="3" />
    <node id="4" />
    <node id="5" />
    <node id="6" />
    <node id="7" />
    <node id="8" />
    <node id="9" />
    <node id="10" />
    <edge source="0" target="1" />
    <edge source="0" target="3" />
    <edge source="0" target="4" />
    <edge source="1" target="2" />
    <edge source="1" target="5" />
    <edge source="1" target="6" />
    <edge source="2" target="3" />
    <edge source="2" target="7" />
    <edge source="3" target="8" />
    <edge source="3" target="9" />
    <edge source="4" target="9" />
    <edge source="4" target="5" />
    <edge source="5" target="10" />
    <edge source="6" target="10" />
    <edge source="6" target="7" />
    <edge source="7" target="8" />
    <edge source="8" target="10" />
    <edge source="9" target="10" />
  </graph>
</graphml>

Hencce i would rather say that there is an import issue.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-01-15 20:21:55 -0500

Seen: 62 times

Last updated: Jan 16 '16