Skip to content

Incorrect graph import from GraphML file #1719

Closed
@dk766

Description

Problem description

In some cases (when node attributes are not "grouped" in the file) some attributes are incorrectly interpreted.

I save a graph (generated with NetworkX) and save it in graphml and try to import it in Gephi
The nodes have the following attributes:

  • id
  • label (similar value with the id)
  • x, y, z
  • r, g, b

After importing in Gephi I see that some attributes have wrong values: the label field contains the value from one of the rgb components, the r,g,b values are wrong etc.

http://forum-gephi.org/viewtopic.php?f=29&t=6206&p=14383&hilit=Import+graphml#p14383

Expected Behavior

All the attributes from the graphml file should be correctly loaded

Current Behavior

The attribute values are read from the input file but assigned to wrong attributes:

  • label field contains the value from one of the rgb components
  • the values of the r,g,b are wrong

Possible Solution

By changing the order of the elements and making sure that x,y,x and r,g,b are in the correct order the problem is usually avoided. However this is only a workaround since the definition of the attributes can be in any order in the graphml file

Steps to Reproduce

  1. Import in Gephi the "test.graphml" file provided (on the gephi forum) http://forum-gephi.org/download/file.php?id=719
  2. Right click on a node and choose "Select in data laboratory"
  3. Click on tab "Data laboratory"
  4. Right click on the selected line from the table and choose: "Edit Node"
  5. In the left pane inspect the values for attributes: Position (x),Position (y),Position (z),Color, Label and notice they are different from the values within the test.graphml provided file

Context

I am dynamically generating graph with hundreds of node with NetworkX (and I customly set the positions and colours of the nodes/edges based on the app logic). I save it in graphml (no control over how NetworkX is saving the file)

Your Environment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions