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.

Categories

Problems with labels from a gml file converted with gv2gml

0 votes
Hi

I would like to import a dot file. I converted the dot file to a gml file with the tool gv2gml.exe from Graphviz.

The nodes have only names but no labels. gml code for a node looks like this:

node [
    id 12
    name "V1"
    graphics [
      w 36
      H 36
      type "box"
    ]
  ]

I would like to have the name "V1" as label in position "northwest" for this node.

The nodes are correctly connected by edges. All nodes have ellipsis as shape with no labels. The original dot layout has rectangles.

How can I get the layout with labels?

Thanks in advance for any help!

Fanki
in Help by (140 points)

1 Answer

+1 vote

To get rectangular nodes, you need to change type "box" to type "rectangle". Moreover, yEd does not use the name tag, but a label tag. Use a text editor to search for all type "box" and name ocurrances in your GML file and replace them with type "rectangle" and label respectively.

To have your labels appear in the north west corner of your nodes, you need to add a LabelGraphics section to each node section in your GML:

  LabelGraphics
  [
    anchor  "tl"
  ]

For additional properties, create a sample diagram with one node styled according to your requirements and save it as GML file, then inspect the created GML file. Note, though, GML is a legacy format that does not support all the available visual features. E.g. yEd's default label are not supported. For node labels, you should use the Internal model, for edge labels the model 6 Pos instead.

by [yWorks] (161k points)
Thanks Thomas for your prompt answer!

I already changed the name tag to label in a text editor. Now labels are shown. I already noticed that imported symbols are not saved with the gml format but with graphml format.
I would use graphml format but Graphviz provides no tool to convert dot to graphml format. What about an importer for dot format? It is a rather simple format. But anyway yEd is great software!! Thanks to provide it free of charge!

There is already a feature request for adding dot import to yEd. Please consider voting for it.

Legal Disclosure | Privacy Policy
...