Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.

In YEd live, import of Graph ML does not seem to bring across any labels

0 votes

hi. Graph ML imports the node and edge structure but I cannot see which node is which, either as label or annotation.Thanks for a great tool.

Best wishes


asked Dec 12, 2018 in Help by anonymous
retagged Dec 24, 2018 by thomas.behr

Without knowing your file there is no way for us to determine what the problem might be. Can you upload the problematic file here? See How to upload files to yEd Q&A? for instructions on uploading files.

2 Answers

+1 vote

Thank you very much for the additional information and especially your GraphML file.

The problem you are facing is actually the very open GraphML specification. The specification defines how to encode the structure of a graph and it defines how to encode additional custom data. That is all there is. Data like geometry, labels, and colors is considered "additional custom data" by the specification. This means every application that uses GraphML may and has to come up with its own way of storing geometry, labels, and colors. At this point, it probably does not come as much of a surprise that Gephi and yEd use two completely different approaches to storing geometry, labels, and colors.

The Gephi approach:

<graphml xmlns="http://graphml.graphdrawing.org/xmlns">
<key attr.name="label" attr.type="string" for="node" id="label"/>
<key attr.name="r" attr.type="int" for="node" id="r"/>
<key attr.name="g" attr.type="int" for="node" id="g"/>
<key attr.name="b" attr.type="int" for="node" id="b"/>
<key attr.name="x" attr.type="float" for="node" id="x"/>
<key attr.name="y" attr.type="float" for="node" id="y"/>
<key attr.name="size" attr.type="float" for="node" id="size"/>
<key attr.name="Modularity Class" attr.type="int" for="node" id="modularity_class"/>
<graph edgedefault="undirected">
<node id="1">
<data key="label">Napoleon</data>
<data key="modularity_class">0</data>
<data key="size">4.0</data>
<data key="r">91</data>
<data key="g">91</data>
<data key="b">245</data>
<data key="x">-418.08344</data>
<data key="y">-446.8853</data>

The yEd approach:

  <key for="node" id="d1" yfiles.type="nodegraphics"/>
  <key for="edge" id="d2" yfiles.type="edgegraphics"/>
  <graph edgedefault="directed" id="G">
    <node id="n0">
      <data key="d1">
          <y:Geometry height="4.0" width="4.0" x="-418.08344" y="-446.8853"/>
          <y:Fill color="#5B5BF5" transparent="false"/>
          <y:BorderStyle color="#5B5BF5" raised="false" type="line" width="1.0"/>
          <y:NodeLabel modelName="sandwich" modelPosition="s">Napolean</y:NodeLabel>
          <y:Shape type="ellipse"/>

Even though the the two formats are quite different and yEd cannot automatically understand geometry, labels, and colors from the Gephi format, yEd does recognize Gephi's "x", "y", "size", "r", "g", "b", "label", and "modularity_class" data as additional data and imports the data as custom properties. (After opening the Gephi GraphML file in yEd, click on a node, go to the properties view in the lower right corner, and scroll down to section "Data".) The good thing about that is that you can use yEd's properties mapper to convert Gephi's "x", "y", "size", and "label" data to node X, Y, Width, Height, and label text. You can use this properties mapper configuration for this purpose.

Finally, once you have opened your Gephi file in yEd, adopted the Gephi data using yEd's properties mapper, and applied whatever additional changes you need, you can save the polished diagram in yEd's GraphML file format. If you open the new yEd GraphML file in yEd Live you will get a properly looking diagram.

answered Dec 24, 2018 by thomas.behr [yWorks] (119,030 points)
edited Dec 24, 2018 by thomas.behr
Actually I had to change the size from 4.0 to 60.0 to get a big enough node.
I then also change from Eliptical to Rectangle for it to show the text inside the box. But I never made it to change to center with the "c" insted of "s" parameter.
The "sandwich" label model does not offer a center position, but only "north" and "south". If you want centered labels, select the nodes in question, change "Placement" to "Internal: Center" in section "Label" (in yEd's editor UI), save as GraphML, and inspect the created file for the corresponding GraphML code.
Hi Thomas.
I wanted to thank you very much for this very encouraging and thorough answer. You have even created a mapping file for use in the Properties Mapper thankyou so much!
I have been delayed replying as I have not yet been able to install YEd to test the solution. I am working mostly on YEd Live, but I will go and install this and let you know how it goes.
hi Thomas. I have now used the Config file on the Mac application with a grapheml file and it works really well. Im very pleased thankyou. Plus you have taken the time to explain some of the graphml nomenclature so that I understand the issue.
You are welcome.
0 votes

hi Thomas

Thanks for the reply. 

I am creating graphs in Gephi and then exporting them as GraphML. It seems to happen with any graph, so here is the Les Miserables dataset as a Gephi graph, exported as Graph ML which loses its labels in YEd Live.

Many thanks



answered Dec 20, 2018 by anonymous
Imprint | Privacy Policy