From ee5f4a47882d37b2d3a174767c8aa47a5e494a28 Mon Sep 17 00:00:00 2001 From: Tyler Reardon Date: Wed, 5 Oct 2022 13:26:15 -0700 Subject: [PATCH] update comments --- README.md | 3 +++ src/defaults.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 8b78aabe..64579c52 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,9 @@ var defaults = { transform: function( node, pos ){ return pos; }, // a function that applies a transform to the final node position ready: function(){}, // on layoutready sort: undefined, // a sorting function to order the nodes and edges; e.g. function(a, b){ return a.data('weight') - b.data('weight') } + // because cytoscape dagre creates a directed graph, and directed graphs use the node order as a tie breaker when + // defining the topology of a graph, this sort function can help ensure the correct order of the nodes/edges. + // this feature is most useful when adding and removing the same nodes and edges multiple times in a graph. stop: function(){} // on layoutstop }; ``` diff --git a/src/defaults.js b/src/defaults.js index b13cfbd7..19af45c2 100644 --- a/src/defaults.js +++ b/src/defaults.js @@ -25,6 +25,9 @@ let defaults = { transform: function( node, pos ){ return pos; }, // a function that applies a transform to the final node position ready: function(){}, // on layoutready sort: undefined, // a sorting function to order the nodes and edges; e.g. function(a, b){ return a.data('weight') - b.data('weight') } + // because cytoscape dagre creates a directed graph, and directed graphs use the node order as a tie breaker when + // defining the topology of a graph, this sort function can help ensure the correct order of the nodes/edges. + // this feature is most useful when adding and removing the same nodes and edges multiple times in a graph. stop: function(){} // on layoutstop };