Skip to content

Commit

Permalink
Merge pull request #4 from iVis-at-Bilkent/unstable
Browse files Browse the repository at this point in the history
Merge unstable to master
  • Loading branch information
hasanbalci authored May 19, 2020
2 parents 24736f8 + 23e7615 commit 9fc90db
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 12 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019
Copyright (c) 2019 - present, iVis@Bilkent.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 13 additions & 0 deletions cose-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ CoSEConstants.DEFAULT_COMPONENT_SEPERATION = 60;
CoSEConstants.TILE = true;
CoSEConstants.TILING_PADDING_VERTICAL = 10;
CoSEConstants.TILING_PADDING_HORIZONTAL = 10;
CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = false; // make this true when cose is used incrementally as a part of other non-incremental layout

module.exports = CoSEConstants;

Expand Down Expand Up @@ -395,6 +396,18 @@ CoSELayout.prototype.classicLayout = function () {

this.positionNodesRandomly();
}
} else {
if (CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL) {
// Reduce the trees in incremental mode if only this constant is set to true
this.reduceTrees();
// Update nodes that gravity will be applied
this.graphManager.resetAllNodesToApplyGravitation();
var allNodes = new Set(this.getAllNodes());
var intersection = this.nodesWithGravity.filter(function (x) {
return allNodes.has(x);
});
this.graphManager.setAllNodesToApplyGravitation(intersection);
}
}

this.initSpringEmbedder();
Expand Down
41 changes: 30 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/CoSEConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ CoSEConstants.DEFAULT_COMPONENT_SEPERATION = 60;
CoSEConstants.TILE = true;
CoSEConstants.TILING_PADDING_VERTICAL = 10;
CoSEConstants.TILING_PADDING_HORIZONTAL = 10;
CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = false; // make this true when cose is used incrementally as a part of other non-incremental layout

module.exports = CoSEConstants;
11 changes: 11 additions & 0 deletions src/CoSELayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ CoSELayout.prototype.classicLayout = function () {
this.positionNodesRandomly();
}
}
else {
if(CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL){
// Reduce the trees in incremental mode if only this constant is set to true
this.reduceTrees();
// Update nodes that gravity will be applied
this.graphManager.resetAllNodesToApplyGravitation();
var allNodes = new Set(this.getAllNodes());
var intersection = this.nodesWithGravity.filter(x => allNodes.has(x));
this.graphManager.setAllNodesToApplyGravitation(intersection);
}
}

this.initSpringEmbedder();
this.runSpringEmbedder();
Expand Down

0 comments on commit 9fc90db

Please sign in to comment.