Commit 0d9cc033 authored by PkSM3's avatar PkSM3

egoquery and multiplequery unified

parent 2a82051f
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -162,8 +162,6 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -162,8 +162,6 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
pr("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]") pr("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]")
return; return;
} }
pr("heeere in edge weight filter")
// sliderDivID = "#sliderAEdgeWeight" // sliderDivID = "#sliderAEdgeWeight"
// type = "nodes1" // type = "nodes1"
// type_attrb = "label" // type_attrb = "label"
...@@ -178,13 +176,11 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -178,13 +176,11 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight") // AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size") // AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size") // AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size")
pr(partialGraph._core.graph.edges)
var filterparams = AlgorithmForSliders ( partialGraph._core.graph.edges , type_attrb , type , criteria) var filterparams = AlgorithmForSliders ( partialGraph._core.graph.edges , type_attrb , type , criteria)
pr("after algorithm for sliders")
var steps = filterparams["steps"] var steps = filterparams["steps"]
var finalarray = filterparams["finalarray"] var finalarray = filterparams["finalarray"]
pr(finalarray)
//finished //finished
$(sliderDivID).freshslider({ $(sliderDivID).freshslider({
range: true, range: true,
...@@ -320,13 +316,10 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -320,13 +316,10 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
function AlgorithmForSliders( elements , type_attrb , type , criteria) { function AlgorithmForSliders( elements , type_attrb , type , criteria) {
// // ( 1 ) // // ( 1 )
// // get visible sigma nodes|edges // // get visible sigma nodes|edges
pr(elements)
elems=elements.filter(function(e) { elems=elements.filter(function(e) {
return e[type_attrb]==type; return e[type_attrb]==type;
}); });
pr("nodes|edges length: "+elems.length)
pr(elems)
// // ( 2 ) // // ( 2 )
// // extract [ "edgeID" : edgeWEIGHT ] | [ "nodeID" : nodeSIZE ] // // extract [ "edgeID" : edgeWEIGHT ] | [ "nodeID" : nodeSIZE ]
// // and save this into edges_weight | nodes_size // // and save this into edges_weight | nodes_size
......
...@@ -9,7 +9,8 @@ $( window ).resize(function() { ...@@ -9,7 +9,8 @@ $( window ).resize(function() {
// === [what to do at start] === // // === [what to do at start] === //
if (mainfile) { if (mainfile) {
listGexfs(); // http://localhost/adasd/explorerjs.html?file=data/140907Syneco.gexf
// listGexfs(); //should be uncomm
if(!isUndef(getUrlParam.file)){ if(!isUndef(getUrlParam.file)){
$.doTimeout(30,function (){ $.doTimeout(30,function (){
parse(getUrlParam.file); parse(getUrlParam.file);
...@@ -33,11 +34,12 @@ if (mainfile) { ...@@ -33,11 +34,12 @@ if (mainfile) {
if(isUndef(getUrlParam.nodeidparam)) { if(isUndef(getUrlParam.nodeidparam)) {
pr("do nothing, 'cause don't wanna"); pr("do nothing, 'cause don't wanna");
// pr(getUrlParam.nodeidparam)
// $('#mainmodal').modal('show'); // $('#mainmodal').modal('show');
// $("#my-text-input").tokenInput("try.json"); // $("#my-text-input").tokenInput("try.json");
// pr("doing something 'cause i'm a doer"); mainfile=true; // pr("doing something 'cause i'm a doer"); mainfile=true;
// bringTheNoise("data/pkmn_types.gexf","mono"); // bringTheNoise("data/140907Syneco.gexf","mono");
// scanCategories(); // scanCategories();
} else { } else {
if(getUrlParam.nodeidparam.indexOf("__")===-1){ if(getUrlParam.nodeidparam.indexOf("__")===-1){
...@@ -78,6 +80,8 @@ function sigmaLimits(){ ...@@ -78,6 +80,8 @@ function sigmaLimits(){
function bringTheNoise(pathfile,type){ function bringTheNoise(pathfile,type){
pr("printing the pathfile:")
pr(pathfile)
$("#semLoader").hide(); $("#semLoader").hide();
$('#modalloader').modal('show'); $('#modalloader').modal('show');
...@@ -200,228 +204,45 @@ function bringTheNoise(pathfile,type){ ...@@ -200,228 +204,45 @@ function bringTheNoise(pathfile,type){
theListeners(); theListeners();
} else { } else {
var theurl,thedata,thename;
if(type=="unique_id") { if(type=="unique_id") {
pr("bring the noise, case: unique_id"); pr("bring the noise, case: unique_id");
pr(getClientTime()+" : DataExt Ini"); pr(getClientTime()+" : DataExt Ini");
// < === DATA EXTRACTION === > // < === DATA EXTRACTION === >
$.ajax({ theurl = bridge["forNormalQuery"]
type: 'GET', thedata = "unique_id="+getUrlParam.nodeidparam+"&it="+iterationsFA2;
url: bridge["forNormalQuery"], thename = true;
data: "unique_id="+pathfile+"&it="+iterationsFA2, }
contentType: "application/json",
dataType: 'jsonp',
async: true,
success : function(data) {
if(!isUndef(getUrlParam.seed))seed=getUrlParam.seed;
extractFromJson(data,seed);
pr("\tLALALALAALALALALALA1")
pr(partialGraph._core.graph.edges)
changeToMacro("social");
pr(getClientTime()+" : DataExt Fin");
// < === DATA EXTRACTED!! === >
pr("\tLALALALAALALALALALA2")
pr(partialGraph._core.graph.edges)
if(fa2enabled==="off") $("#edgesButton").hide();
pushSWClick("social");
pr(partialGraph._core.graph.nodes.length)
pr(partialGraph._core.graph.edges.length)
nbnodes = partialGraph._core.graph.nodes.length
if(nbnodes>=400 && nbnodes<1000) {
snbnodes = nbnodes+"";
cut1 = snbnodes[0];
cut2 = snbnodes.length;
pr("cut1: "+cut1)
pr("cut2: "+cut2)
iterationsFA2 = Math.round(iterationsFA2/(cut1/cut2))
}
if(nbnodes>=1000) iterationsFA2 = 150;
pr("iterationsFA2: "+iterationsFA2)
var netname = pathfile.replace(/\_/g, ' ').toUpperCase();
$("#network").html(netname);
// < === ASYNCHRONOUS FA2.JS === >
pr(getClientTime()+" : Ini FA2");
var ForceAtlas2 = new Worker("FA2.js");
ForceAtlas2.postMessage({
"nodes": partialGraph._core.graph.nodes,
"edges": partialGraph._core.graph.edges,
"it":iterationsFA2
});
ForceAtlas2.addEventListener('message', function(e) {
iterations=e.data.it;
nds=e.data.nodes;
for(var n in nds){
id=nds[n].id;
x=nds[n].x
y=nds[n].y
partialGraph._core.graph.nodes[n].x=x;
partialGraph._core.graph.nodes[n].y=y;
partialGraph._core.graph.nodesIndex[id].x=x
partialGraph._core.graph.nodesIndex[id].y=y
Nodes[id].x=x;
Nodes[id].y=y;
}
pr("\ttotalIterations: "+iterations)
pr(getClientTime()+" : Fin FA2");
console.log("Parsing and FA2 complete.");
pr("\n=================\n")
// < === ASYNCHRONOUS FA2.JS DONE!! === >
// [ calculate iterations for semanticgraph ]
pr(getClientTime()+" : Ini FA2 for SemanticGraph");
var cut1_,cut2_,iterationsFA2_=iterationsFA2;
pr(otherGraph._core.graph.nodes.length)
pr(otherGraph._core.graph.edges.length)
nbnodes = otherGraph._core.graph.nodes.length
if(nbnodes>=400 && nbnodes<1000) {
snbnodes = nbnodes+"";
cut1_ = snbnodes[0];
cut2_ = snbnodes.length;
pr("cut1 sem: "+cut1_)
pr("cut2 sem: "+cut2_)
iterationsFA2_ = Math.round(iterationsFA2/(cut1_/cut2_))
}
if(nbnodes>=1000) iterationsFA2_ = 150;
pr("iterationsFA2 sem: "+iterationsFA2_)
// [ / calculate iterations for semanticgraph ]
// [ semantic layouting ]
var ForceAtlas2_ = new Worker("FA2.js");
ForceAtlas2_.postMessage({
"nodes": otherGraph._core.graph.nodes,
"edges": otherGraph._core.graph.edges,
"it":iterationsFA2_
});
ForceAtlas2_.addEventListener('message', function(e) {
iterations=e.data.it;
nds=e.data.nodes;
for(var n in nds){
id=nds[n].id;
x=nds[n].x
y=nds[n].y
Nodes[id].x=x;
Nodes[id].y=y;
}
pr("\ttotalIterations: "+iterations)
pr(getClientTime()+" : Fin FA2 for SemanticGraph");
otherGraph.emptyGraph();
otherGraph = null;
$("#sigma-othergraph").html("");
semanticConverged = true;
$("#semLoader").hide();
if( NOW=="B" ) {
changeToMacro("semantic");
partialGraph.draw();
}
console.log("Parsing and FA2 complete for SemanticGraph.");
});
// [ / semantic layouting ]
theListeners();
});
},
error: function(){
pr("Page Not found. parseCustom, inside the IF");
}
});
} else {
if ("filtermode") {
// "php/bridgeClientServer_filter.php?query="+getUrlParam.nodeidparam; if (type=="filtermode") {
pr("bring the noise, case: query with multiple filters"); pr("bring the noise, case: multipleQuery");
pr(getClientTime()+" : DataExt Ini"); pr(getClientTime()+" : DataExt Ini");
pr(bridge["forFilteredQuery"]+"?query="+getUrlParam.nodeidparam); theurl = bridge["forFilteredQuery"];
// < === DATA EXTRACTION === > thedata = "query="+getUrlParam.nodeidparam;
$.ajax({ thename = false;
type: 'GET', }
url: bridge["forFilteredQuery"],
data: "query="+getUrlParam.nodeidparam,
contentType: "application/json",
dataType: 'jsonp',
async: true,
success : function(data){
if(!isUndef(getUrlParam.seed))seed=getUrlParam.seed;
extractFromJson(data,seed);
pr(getClientTime()+" : DataExt Fin");
// < === DATA EXTRACTED!! === >
if(fa2enabled==="off") $("#edgesButton").hide();
pushSWClick("social");
pr(partialGraph._core.graph.nodes.length)
pr(partialGraph._core.graph.edges.length)
nbnodes = partialGraph._core.graph.nodes.length
if(nbnodes>=400 && nbnodes<1000) {
snbnodes = nbnodes+"";
cut1 = snbnodes[0];
cut2 = snbnodes.length;
pr("cut1: "+cut1)
pr("cut2: "+cut2)
iterationsFA2 = Math.round(iterationsFA2/(cut1/cut2))
}
if(nbnodes>=1000) iterationsFA2 = 150;
pr("iterationsFA2: "+iterationsFA2)
var netname = pathfile.replace(/\_/g, ' ').toUpperCase();
$("#network").html("MultiQuery: lalala");
// < === ASYNCHRONOUS FA2.JS === >
pr(getClientTime()+" : Ini FA2");
var ForceAtlas2 = new Worker("FA2.js");
ForceAtlas2.postMessage({
"nodes": partialGraph._core.graph.nodes,
"edges": partialGraph._core.graph.edges,
"it":iterationsFA2
});
ForceAtlas2.addEventListener('message', function(e) {
iterations=e.data.it;
nds=e.data.nodes;
for(var n in nds){
id=nds[n].id;
x=nds[n].x
y=nds[n].y
partialGraph._core.graph.nodes[n].x=x;
partialGraph._core.graph.nodes[n].y=y;
partialGraph._core.graph.nodesIndex[id].x=x
partialGraph._core.graph.nodesIndex[id].y=y
Nodes[id].x=x;
Nodes[id].y=y;
}
pr("\ttotalIterations: "+iterations)
pr(getClientTime()+" : Fin FA2");
console.log("Parsing and FA2 complete.");
// < === ASYNCHRONOUS FA2.JS DONE!! === >
theListeners();
});
},
error: function(){
pr("Page Not found. parseCustom, inside the IF");
}
});
if (thename) thename = getUrlParam.nodeidparam.replace(/\_/g, ' ').toUpperCase();
else {
elements = []
queryarray = JSON.parse(getUrlParam.nodeidparam)
for(var i in queryarray) {
item = queryarray[i]
if(Array.isArray(item) && item.length>0) {
for(var j in item) elements.push(item[j])
}
} }
thename = '"'+elements.join('" , "')+'"';
} }
SigmaLayouting( theurl , thedata , thename );
} }
} }
function theListeners(){ function theListeners(){
pr("in THELISTENERS"); pr("in THELISTENERS");
// leftPanel("close"); // leftPanel("close");
...@@ -700,7 +521,7 @@ function theListeners(){ ...@@ -700,7 +521,7 @@ function theListeners(){
// finished // finished
//this should be available at start!! //this should be available at start!!
// pr("applying edge weith filter") // pr("applying edge weith filter")
// EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight"); EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
//finished //finished
...@@ -762,3 +583,137 @@ function theListeners(){ ...@@ -762,3 +583,137 @@ function theListeners(){
} }
function SigmaLayouting( URL, DATA, NAME) {
return $.ajax({
type: 'GET',
url: URL,
data: DATA,
contentType: "application/json",
dataType: 'jsonp',
async: true,
success : function(data) {
if(!isUndef(getUrlParam.seed))seed=getUrlParam.seed;
extractFromJson(data,seed);
// changeToMacro("social");
pr(getClientTime()+" : DataExt Fin");
// < === DATA EXTRACTED!! === >
if(fa2enabled==="off") $("#edgesButton").hide();
pushSWClick("social");
pr(partialGraph._core.graph.nodes.length)
pr(partialGraph._core.graph.edges.length)
nbnodes = partialGraph._core.graph.nodes.length
if(nbnodes>=400 && nbnodes<1000) {
snbnodes = nbnodes+"";
cut1 = snbnodes[0];
cut2 = snbnodes.length;
pr("cut1: "+cut1)
pr("cut2: "+cut2)
iterationsFA2 = Math.round(iterationsFA2/(cut1/cut2))
}
if(nbnodes>=1000) iterationsFA2 = 150;
pr("iterationsFA2: "+iterationsFA2)
$("#network").html(NAME);
// < === ASYNCHRONOUS FA2.JS === >
pr(getClientTime()+" : Ini FA2");
var ForceAtlas2 = new Worker("FA2.js");
ForceAtlas2.postMessage({
"nodes": partialGraph._core.graph.nodes,
"edges": partialGraph._core.graph.edges,
"it":iterationsFA2
});
ForceAtlas2.addEventListener('message', function(e) {
iterations=e.data.it;
nds=e.data.nodes;
for(var n in nds){
id=nds[n].id;
x=nds[n].x
y=nds[n].y
partialGraph._core.graph.nodes[n].x=x;
partialGraph._core.graph.nodes[n].y=y;
partialGraph._core.graph.nodesIndex[id].x=x
partialGraph._core.graph.nodesIndex[id].y=y
Nodes[id].x=x;
Nodes[id].y=y;
}
pr("\ttotalIterations: "+iterations)
pr(getClientTime()+" : Fin FA2");
console.log("Parsing and FA2 complete.");
pr("\n=================\n")
// < === ASYNCHRONOUS FA2.JS DONE!! === >
// [ calculate iterations for semanticgraph ]
pr(getClientTime()+" : Ini FA2 for SemanticGraph");
var cut1_,cut2_,iterationsFA2_=iterationsFA2;
pr(otherGraph._core.graph.nodes.length)
pr(otherGraph._core.graph.edges.length)
nbnodes = otherGraph._core.graph.nodes.length
if(nbnodes>=400 && nbnodes<1000) {
snbnodes = nbnodes+"";
cut1_ = snbnodes[0];
cut2_ = snbnodes.length;
pr("cut1 sem: "+cut1_)
pr("cut2 sem: "+cut2_)
iterationsFA2_ = Math.round(iterationsFA2/(cut1_/cut2_))
}
if(nbnodes>=1000) iterationsFA2_ = 150;
pr("iterationsFA2 sem: "+iterationsFA2_)
// [ / calculate iterations for semanticgraph ]
// [ semantic layouting ]
var ForceAtlas2_ = new Worker("FA2.js");
ForceAtlas2_.postMessage({
"nodes": otherGraph._core.graph.nodes,
"edges": otherGraph._core.graph.edges,
"it":iterationsFA2_
});
ForceAtlas2_.addEventListener('message', function(e) {
iterations=e.data.it;
nds=e.data.nodes;
for(var n in nds){
id=nds[n].id;
x=nds[n].x
y=nds[n].y
Nodes[id].x=x;
Nodes[id].y=y;
}
pr("\ttotalIterations: "+iterations)
pr(getClientTime()+" : Fin FA2 for SemanticGraph");
otherGraph.emptyGraph();
otherGraph = null;
$("#sigma-othergraph").html("");
semanticConverged = true;
$("#semLoader").hide();
if( NOW=="B" ) {
changeToMacro("semantic");
partialGraph.draw();
EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
}
console.log("Parsing and FA2 complete for SemanticGraph.");
});
// [ / semantic layouting ]
theListeners();
});
},
error: function(){
pr("Page Not found. parseCustom, inside the IF");
}
});
}
...@@ -239,7 +239,7 @@ function RefreshState(newNOW){ ...@@ -239,7 +239,7 @@ function RefreshState(newNOW){
} }
//this should be available!! //this should be available!!
// EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight"); EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
$("#semLoader").hide(); $("#semLoader").hide();
$("#colorGraph").show(); $("#colorGraph").show();
...@@ -264,12 +264,15 @@ function RefreshState(newNOW){ ...@@ -264,12 +264,15 @@ function RefreshState(newNOW){
if ( semanticConverged ) $("#semLoader").hide(); if ( semanticConverged ) $("#semLoader").hide();
else $("#semLoader").show(); else $("#semLoader").show();
//this should be available!! //this should be available!!
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight"); EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
// NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size") NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
$("#colorGraph").hide(); $("#colorGraph").hide();
} }
if(NOW=="AaBb"){ if(NOW=="AaBb"){
LevelButtonDisable(true); LevelButtonDisable(true);
EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
$("#colorGraph").hide(); $("#colorGraph").hide();
} }
...@@ -1189,9 +1192,6 @@ function graphResetColor(){ ...@@ -1189,9 +1192,6 @@ function graphResetColor(){
function createEdgesForExistingNodes (typeOfNodes) { function createEdgesForExistingNodes (typeOfNodes) {
pr("create Edges for existing Nodes")
pr(partialGraph._core.graph.nodes)
if(typeOfNodes=="social") typeOfNodes="Scholars" if(typeOfNodes=="social") typeOfNodes="Scholars"
if(typeOfNodes=="semantic") typeOfNodes="Keywords" if(typeOfNodes=="semantic") typeOfNodes="Keywords"
if(typeOfNodes=="sociosemantic") typeOfNodes="Bipartite" if(typeOfNodes=="sociosemantic") typeOfNodes="Bipartite"
...@@ -1298,8 +1298,6 @@ function createEdgesForExistingNodes (typeOfNodes) { ...@@ -1298,8 +1298,6 @@ function createEdgesForExistingNodes (typeOfNodes) {
} }
} }
} }
pr("AT THE END OF createEdgesForExistingNodes")
pr(partialGraph._core.graph.edges)
} }
function hideEverything(){ function hideEverything(){
......
...@@ -38,8 +38,8 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -38,8 +38,8 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
// Runtime (the ForceAtlas2 itself) // Runtime (the ForceAtlas2 itself)
this.init = function() { this.init = function() {
console.log("#Nodes: "+V) // console.log("#Nodes: "+V)
console.log("#Edges: "+E) // console.log("#Edges: "+E)
self.state = {step: 0, index: 0}; self.state = {step: 0, index: 0};
...@@ -886,9 +886,11 @@ sigma.forceatlas2.Region.prototype.updateMassAndGeometry = function() { ...@@ -886,9 +886,11 @@ sigma.forceatlas2.Region.prototype.updateMassAndGeometry = function() {
var massSumX = 0; var massSumX = 0;
var massSumY = 0; var massSumY = 0;
this.nodes.forEach(function(n) { this.nodes.forEach(function(n) {
mass += n.fa2.mass; if(n.fa2) {
massSumX += n.x * n.fa2.mass; mass += n.fa2.mass;
massSumY += n.y * n.fa2.mass; massSumX += n.x * n.fa2.mass;
massSumY += n.y * n.fa2.mass;
}
}); });
var massCenterX = massSumX / mass; var massCenterX = massSumX / mass;
massCenterY = massSumY / mass; massCenterY = massSumY / mass;
...@@ -1082,7 +1084,7 @@ sigma.publicPrototype.stopForceAtlas2 = function() { ...@@ -1082,7 +1084,7 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
var ybuffer = miny; var ybuffer = miny;
for (var i in this._core.graph.nodesIndex) { for (var i in this._core.graph.nodesIndex) {
if (swMacro) { if (swMacro && this._core.graph.nodesIndex[i].degree>0) {
Nodes[i].x = this._core.graph.nodesIndex[i].x; Nodes[i].x = this._core.graph.nodesIndex[i].x;
Nodes[i].y = this._core.graph.nodesIndex[i].y; Nodes[i].y = this._core.graph.nodesIndex[i].y;
} }
...@@ -1106,11 +1108,11 @@ sigma.publicPrototype.stopForceAtlas2 = function() { ...@@ -1106,11 +1108,11 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
} }
// -- / UPDATING THE DEGREE -- // -- / UPDATING THE DEGREE --
pr("minx: "+minx) // pr("minx: "+minx)
pr("maxx: "+maxx) // pr("maxx: "+maxx)
pr("miny: "+miny) // pr("miny: "+miny)
pr("maxy: "+maxy) // pr("maxy: "+maxy)
pr("") // pr("")
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment