1

I'm using Dagre to layout my graph and need to send additional properties through to set class/style later in cytoscape.

var graph = new dagre.graphlib.Graph({...});

graph.setEdge(source, target, {
  val1: 'foo'
}, e.value);

How to access the additional property val1 later when iterating through edges using graph.edges()?

mut1na
  • 795
  • 6
  • 21

1 Answers1

0

If I understand it right you should probably be able to get it like that:

var edges = graph.edges();
var i;
for (i = 0; i < edges.length; i++) {
    // do stuff


    var data = edges[i].data().val1;  
    // or 
    var data = edges[i].data('val1');  
    // or get all attributes
    var data = edges[i].data();

    //do other stuff
}
Stephan T.
  • 5,843
  • 3
  • 20
  • 42