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.


Simple standard way to label nodes and edges in existing graphml?

0 votes
I am loading graphml files not created using yEd.  I spent quite a bit of time trying to figure out a very simple widely-recognized way to add text labels to nodes and edges.  I finally stumbled on something that worked if I did Edit > Properties mapper ... and selected and applied single (until today, same file now says <No Value>).  Below is what had been working.  But is there a simple and conventional way to do simple edits to basic graphml to have labels display on load?

Hmm, no copy-paste or attachments.  Here is the basic idea:

<key id="nodeLabel" for="node" attr.name="nodeLabel" attr.type="string"/>

<node id="foo"><data key="nodeLabel">myLabel</data></node>
in Help by

1 Answer

0 votes

There is no "very simple widely-recognized way to add text labels to nodes and edges", because the GraphML specification only specifies how to encode structure.

The simplest way to edit GraphML files is actually to use yEd for editing.

Since yEd is based on yFiles for Java, it supports yFiles for Java 2.x and yFiles for Java (Swing) 3.x compatible label representations. Thus the second simplest way to edit GraphML files is using one those two libraries.

If the yFiles libraries are not an option for you, you will have to reverse engineer the yEd GraphML format. Here is a minimal label sample to get you started.

That said, neither yEd nor yFiles ever supported labels specified like in your "basic idea" example.

Finally, the post editor does support copy/paste as well as attachments. Please see How to upload files to yEd Q&A? for information on how to attach files.

by [yWorks] (160k points)
Legal Disclosure | Privacy Policy