Ask Your Question

I keep losing my node labels on graph export

asked 2016-01-16 03:21:55 +0200

Malte gravatar image

updated 2016-06-06 21:26:06 +0200

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()

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.


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-01-16 11:23:58 +0200

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="" xmlns:xsi="" xsi:schemaLocation="">
  <key"multiedges" attr.type="boolean" for="graph" id="d2" />
  <key"name" attr.type="string" for="graph" id="d1" />
  <key"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" />

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


Asked: 2016-01-16 03:21:55 +0200

Seen: 445 times

Last updated: Jan 16 '16