Skip to content

Commit

Permalink
Apply tree reduction in incremental layout #33
Browse files Browse the repository at this point in the history
Before we don't apply tree reduction in incremental layout, but now cose-base supports a new version of the tree reduction to be used in pure incremental layout (an incremental layout that is not applied after randomized layout)
  • Loading branch information
hasanbalci committed Mar 3, 2021
1 parent db204cb commit ff5209b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions cytoscape-fcose.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ var coseLayout = function coseLayout(options, spectralResult) {
CoSEConstants.TILING_PADDING_HORIZONTAL = typeof options.tilingPaddingHorizontal === 'function' ? options.tilingPaddingHorizontal.call() : options.tilingPaddingHorizontal;

CoSEConstants.DEFAULT_INCREMENTAL = FDLayoutConstants.DEFAULT_INCREMENTAL = LayoutConstants.DEFAULT_INCREMENTAL = true;
CoSEConstants.PURE_INCREMENTAL = !options.randomize;
LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES = options.uniformNodeDimensions;

// This part is for debug/demo purpose
Expand All @@ -919,10 +920,10 @@ var coseLayout = function coseLayout(options, spectralResult) {
CoSEConstants.APPLY_LAYOUT = true;
}

if (options.randomize && !(options.fixedNodeConstraint || options.alignmentConstraint || options.relativePlacementConstraint)) {
CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = true;
} else {
if (options.fixedNodeConstraint || options.alignmentConstraint || options.relativePlacementConstraint) {
CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = false;
} else {
CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = true;
}

var coseLayout = new CoSELayout();
Expand Down
7 changes: 4 additions & 3 deletions src/fcose/cose.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ let coseLayout = function(options, spectralResult){
typeof options.tilingPaddingHorizontal === 'function' ? options.tilingPaddingHorizontal.call() : options.tilingPaddingHorizontal;

CoSEConstants.DEFAULT_INCREMENTAL = FDLayoutConstants.DEFAULT_INCREMENTAL = LayoutConstants.DEFAULT_INCREMENTAL = true;
CoSEConstants.PURE_INCREMENTAL = !options.randomize;
LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES = options.uniformNodeDimensions;

// This part is for debug/demo purpose
Expand Down Expand Up @@ -222,11 +223,11 @@ let coseLayout = function(options, spectralResult){
CoSEConstants.APPLY_LAYOUT = true;
}

if(options.randomize && !(options.fixedNodeConstraint || options.alignmentConstraint || options.relativePlacementConstraint)){
CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = true;
if(options.fixedNodeConstraint || options.alignmentConstraint || options.relativePlacementConstraint){
CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = false;
}
else{
CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = false;
CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = true;
}

let coseLayout = new CoSELayout();
Expand Down

0 comments on commit ff5209b

Please sign in to comment.