Skip to content

Commit

Permalink
Remove applyMax funstions
Browse files Browse the repository at this point in the history
  • Loading branch information
JingVT authored Oct 26, 2018
1 parent 71b5aea commit 8286a55
Showing 1 changed file with 0 additions and 74 deletions.
74 changes: 0 additions & 74 deletions static/js/graphs_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -1969,43 +1969,6 @@ var graphPage = {
}
return largestK;
},
applyMax: function (graph_layout) {
//Gets all nodes and edges up do the max value set
//and only renders them
var maxVal = parseInt($("#input_max").val());

if (!maxVal) {
return;
}
var newJSON = {
"nodes": new Array(),
"edges": new Array()
};

// List of node ids that should remain in the graph
var nodeNames = Array();

//Get all edges that meet the max quantifier
for (var i = 0; i < graph_json.elements['edges'].length; i++) {
var edge_data = graph_json.elements['edges'][i];
if (edge_data['data']['k'] <= maxVal) {
newJSON['edges'].push(edge_data);
nodeNames.push(edge_data['data']['source']);
nodeNames.push(edge_data['data']['target']);
}
}

//Get all nodes that meet the max quantifier
for (var i = 0; i < graph_json.elements['nodes'].length; i++) {
var node_data = graph_json.elements['nodes'][i];
if (nodeNames.indexOf(node_data['data']['id']) > -1) {
newJSON['nodes'].push(node_data);
}
}

graphPage.cyGraph.load(newJSON);
graphPage.filterNodesEdges.showOnlyK();
},
showOnlyK: function () {
// Returns all the id's that are > k value
if ($("#input_k").val()) {
Expand Down Expand Up @@ -2338,43 +2301,6 @@ var graphPage = {
max: 50
});
},
applyMax: function (graph_layout) {
//Gets all nodes and edges up do the max value set
//and only renders them
var maxVal = parseInt($("#input_max").val());

if (!maxVal) {
return;
}
var newJSON = {
"nodes": new Array(),
"edges": new Array()
};

// List of node ids that should remain in the graph
var nodeNames = Array();

//Get all edges that meet the max quantifier
for (var i = 0; i < graph_json.elements['edges'].length; i++) {
var edge_data = graph_json.elements['edges'][i];
if (edge_data['data']['k'] <= maxVal) {
newJSON['edges'].push(edge_data);
nodeNames.push(edge_data['data']['source']);
nodeNames.push(edge_data['data']['target']);
}
}

//Get all nodes that meet the max quantifier
for (var i = 0; i < graph_json.elements['nodes'].length; i++) {
var node_data = graph_json.elements['nodes'][i];
if (nodeNames.indexOf(node_data['data']['id']) > -1) {
newJSON['nodes'].push(node_data);
}
}

graphPage.cyGraph.load(newJSON);
graphPage.filterNodesEdges.showOnlyK();
},
setBarToValueEdgeLength: function (inputId, barId) {
/**
* If the user enters a value greater than the max value allowed, change value of bar to max allowed value.
Expand Down

1 comment on commit 8286a55

@JingVT
Copy link
Owner Author

@JingVT JingVT commented on 8286a55 Oct 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove applyMax functions

Please sign in to comment.