Skip to content

Define Parent after initializing elements via GraphML #20

@Lazloo

Description

@Lazloo

Hello everyone,

I like to work with components which can be defined via the parent property (https://js.cytoscape.org/#notation/compound-nodes)

However, I do not define my network graph by hand my load a graphml-file via cytoscape.js-graphml:

        var cy = window.cy = cytoscape({
        container: document.getElementById('cy'),
         ready: function () {
             this.graphml({layoutBy: 'random'});
             this.graphml(graphStr);
         }
        });

The graphml file looks like :

<?xml versi

    on='1.0' encoding='utf-8'?>
    <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd"><key attr.name="relationship" attr.type="string" for="edge" id="d8"/>

    <key attr.name="node_name" attr.type="string" for="node" id="d0"/>
    <key attr.name="parent" attr.type="long" for="node" id="d1"/>
    <graph edgedefault="directed">
    <node id="123">
      <data key="d0">First</data>
      <data key="d1">0</data>
    </node>
    <node id="124">
      <data key="d0">Second</data>
      <data key="d1">1</data>
    </node>
    ...

Where d1 indicates the parent/component id. The question is, how do I define the parent variable of a node afterward. The graphml is automatically generated and can not be modified.

THX Lazloo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions