cytoscape / cytoscape.js-klay

The Klay layout algorithm for Cytoscape.js
MIT License
86 stars 41 forks source link

cytoscape.js elements are not converted to klay graph json correctly #3

Closed d2fong closed 7 years ago

d2fong commented 7 years ago

Edges in a compound node x must be added as a property to the compound node x.

There are probably other minor details that klayjs is expecting in the cytoscapejs to klayjs function that are missing.

e.g

instead of:

{
   nodes: [...],
   edges: [...]
}

it has to be:

{
   nodes: [
      {
         x: {
           ...
           edges: [
             ...
            ]
         }
      }      
   ]
}
d2fong commented 7 years ago

For the first edge nesting issue, I need to come up with an algorithm that processes nodes in order of depth level. i.e process all nodes of depth level 0, level 1, level 2, etc.

d2fong commented 7 years ago

It seems like that error was specific to one graph.

d2fong commented 7 years ago

In particular, it looks like it works well for graphs with no compound nodes, and it does not work for graphs with compound nodes -- which probably means that it is a bug.

d2fong commented 7 years ago

Detailed error that klayjs is spitting out:

    "type": "de.cau.cs.kieler.klay.gwt.client.layout.UnsupportedJsonGraphException",
    "text": "An edge's source or target node could not be resolved.",
    "value": {
        "id": "http___identifiers_org_reactome_R-HSA-201422LEFT_TO_RIGHT-output--to--http___pathwaycommons_org_pc2_Complex_47b40f3c07861fe278cca379440b09f9",
        "source": "http___identifiers_org_reactome_R-HSA-201422LEFT_TO_RIGHT",
        "target": "http___pathwaycommons_org_pc2_Complex_47b40f3c07861fe278cca379440b09f9"
    },

Possbile reasons (non-exhaustive):

  1. source or target do not exist
  2. source or target has not been translated properly
  3. klayjs can't find cross hierarchy edges