Commit 2a82051f authored by PkSM3's avatar PkSM3

edges-weight not undefined

parent 6a15ff56
......@@ -32,7 +32,7 @@ box-shadow: 0px 0px 3px 0px #888888;
position: fixed;
height: 100%;
border: 1px #888888 solid;
background: #fff url(../img/bg.jpg) repeat top right;
background: #fff url(../img2/bg.jpg) repeat top right;
-webkit-border-radius: 0px 11px 11px 0px;-moz-border-radius: 0px 11px 11px 0px; border-radius: 0px 11px 11px 0px;-webkit-box-shadow: #B3B3B3 4px 4px 4px;-moz-box-shadow: #B3B3B3 4px 4px 4px; box-shadow: #B3B3B3 4px 4px 4px;
/*-webkit-border-radius: 11px 0px 0px 11px;-moz-border-radius: 11px 0px 0px 11px;border-radius: 11px 0px 0px 11px;-webkit-box-shadow: #B3B3B3 4px 4px 4px;-moz-box-shadow: #B3B3B3 4px 4px 4px; box-shadow: #B3B3B3 4px 4px 4px;*/
/*transition: all 0.1s ease 0s;*/
......
/*
sizeof.js
A function to calculate the approximate memory usage of objects
Created by Stephen Morley - http://code.stephenmorley.org/ - and released under
the terms of the CC0 1.0 Universal legal code:
http://creativecommons.org/publicdomain/zero/1.0/legalcode
*/
function sizeof(_1){
var _2=[_1];
var _3=0;
for(var _4=0;_4<_2.length;_4++){
switch(typeof _2[_4]){
case "boolean":
_3+=4;
break;
case "number":
_3+=8;
break;
case "string":
_3+=2*_2[_4].length;
break;
case "object":
if(Object.prototype.toString.call(_2[_4])!="[object Array]"){
for(var _5 in _2[_4]){
_3+=2*_5.length;
}
}
for(var _5 in _2[_4]){
var _6=false;
for(var _7=0;_7<_2.length;_7++){
if(_2[_7]===_2[_4][_5]){
_6=true;
break;
}
}
if(!_6){
_2.push(_2[_4][_5]);
}
}
}
}
return _3;
};
......@@ -162,6 +162,8 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
pr("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]")
return;
}
pr("heeere in edge weight filter")
// sliderDivID = "#sliderAEdgeWeight"
// type = "nodes1"
// type_attrb = "label"
......@@ -176,10 +178,13 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "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)
pr("after algorithm for sliders")
var steps = filterparams["steps"]
var finalarray = filterparams["finalarray"]
pr(finalarray)
//finished
$(sliderDivID).freshslider({
range: true,
......@@ -315,11 +320,13 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
function AlgorithmForSliders( elements , type_attrb , type , criteria) {
// // ( 1 )
// // get visible sigma nodes|edges
pr(elements)
elems=elements.filter(function(e) {
return e[type_attrb]==type;
});
// pr("nodes|edges length: "+elems.length)
pr("nodes|edges length: "+elems.length)
pr(elems)
// // ( 2 )
// // extract [ "edgeID" : edgeWEIGHT ] | [ "nodeID" : nodeSIZE ]
// // and save this into edges_weight | nodes_size
......
......@@ -214,10 +214,17 @@ function bringTheNoise(pathfile,type){
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)
......@@ -237,8 +244,6 @@ function bringTheNoise(pathfile,type){
$("#network").html(netname);
// < === ASYNCHRONOUS FA2.JS === >
pr("prev first node:")
pr(partialGraph._core.graph.nodes[0])
pr(getClientTime()+" : Ini FA2");
var ForceAtlas2 = new Worker("FA2.js");
......@@ -267,8 +272,6 @@ function bringTheNoise(pathfile,type){
pr("\n=================\n")
// < === ASYNCHRONOUS FA2.JS DONE!! === >
pr("aft first node:")
pr(partialGraph._core.graph.nodes[0])
// [ calculate iterations for semanticgraph ]
pr(getClientTime()+" : Ini FA2 for SemanticGraph");
......@@ -696,6 +699,7 @@ function theListeners(){
// finished
//this should be available at start!!
// pr("applying edge weith filter")
// EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
......
......@@ -1189,13 +1189,15 @@ function graphResetColor(){
function createEdgesForExistingNodes (typeOfNodes) {
pr("create Edges for existing Nodes")
pr(partialGraph._core.graph.nodes)
if(typeOfNodes=="social") typeOfNodes="Scholars"
if(typeOfNodes=="semantic") typeOfNodes="Keywords"
if(typeOfNodes=="sociosemantic") typeOfNodes="Bipartite"
existingNodes = partialGraph._core.graph.nodes.filter(function(n) {
return !n['hidden'];
});
existingNodes = partialGraph._core.graph.nodes;
if(typeOfNodes=="Bipartite"){
for(i=0; i < existingNodes.length ; i++){
for(j=0; j < existingNodes.length ; j++){
......@@ -1247,45 +1249,57 @@ function createEdgesForExistingNodes (typeOfNodes) {
i1=existingNodes[i].id+";"+existingNodes[j].id;
i2=existingNodes[j].id+";"+existingNodes[i].id;
if(!isUndef(Edges[i1]) && !isUndef(Edges[i2]) && i1!=i2){
// pr("Edges[i1]:")
// pr(Edges[i1])
// pr("Edges[i2]:")
// pr(Edges[i2])
// pr(".")
// pr(".")
// if(!isUndef(Edges[i1]) && !isUndef(Edges[i2]) && i1!=i2){
if(typeOfNodes=="Scholars") {
if(Edges[i1].label=="nodes1" && Edges[i2].label=="nodes1"){
if(Edges[i1].weight > Edges[i2].weight){
unHide(i1);
}
if(Edges[i1].weight < Edges[i2].weight){
unHide(i2);
}
if(Edges[i1].weight == Edges[i2].weight){
unHide(i1);
}
}
}
if(typeOfNodes=="Keywords") {
if(Edges[i1].label=="nodes2" && Edges[i2].label=="nodes2"){
if(Edges[i1].weight > Edges[i2].weight){
unHide(i1);
}
if(Edges[i1].weight < Edges[i2].weight){
unHide(i2);
}
if(Edges[i1].weight == Edges[i2].weight){
unHide(i1);
}
}
}
}
else {
// if(typeOfNodes=="Scholars") {
// if(Edges[i1].label=="nodes1" && Edges[i2].label=="nodes1"){
// pr(Edges[i1])
// if(Edges[i1].weight > Edges[i2].weight){
// unHide(i1);
// }
// if(Edges[i1].weight < Edges[i2].weight){
// unHide(i2);
// }
// if(Edges[i1].weight == Edges[i2].weight){
// unHide(i1);
// }
// }
// }
// if(typeOfNodes=="Keywords") {
// if(Edges[i1].label=="nodes2" && Edges[i2].label=="nodes2"){
// pr(Edges[i1]);
// if(Edges[i1].weight > Edges[i2].weight){
// unHide(i1);
// }
// if(Edges[i1].weight < Edges[i2].weight){
// unHide(i2);
// }
// if(Edges[i1].weight == Edges[i2].weight){
// unHide(i1);
// }
// }
// }
// }
// else {
e=(!isUndef(Edges[i1]))?Edges[i1]:Edges[i2]
if(!isUndef(e)){
if(typeOfNodes=="Scholars" && e.label=="nodes1") unHide(e.id)
if(typeOfNodes=="Keywords" && e.label=="nodes2") unHide(e.id)
}
}
// }
}
}
}
pr("AT THE END OF createEdgesForExistingNodes")
pr(partialGraph._core.graph.edges)
}
function hideEverything(){
......@@ -1345,8 +1359,8 @@ function unHide(id){
sourceID: Edges[id].sourceID,
targetID: Edges[id].targetID,
lock : false,
label: Edges[id].type,
weight: Edges[id].w
label: Edges[id].label,
weight: Edges[id].weight
};
partialGraph.addEdge(id , anedge.sourceID , anedge.targetID , anedge);
......@@ -1426,7 +1440,7 @@ function changeToMeso(iwannagraph) {
// n.hidden=true;
// }
// }
hideEverything();
// hideEverything();
for(var i in selections) {
unHide(i);
for(var j in nodes1[i].neighbours) {
......@@ -1622,6 +1636,7 @@ function changeToMacro(iwannagraph) {
unHide(n);
}
} // and semantic edges
createEdgesForExistingNodes(iwannagraph);
if (!is_empty(selections))
......@@ -1633,14 +1648,13 @@ function changeToMacro(iwannagraph) {
} else {
//iwantograph socio-semantic
for(var n in Nodes) unHide(n);
for(var e in Edges) {
if(Edges[e].label=="nodes1" || Edges[e].label=="nodes2"){
st=e.split(";");
index = partialGraph._core.graph.edgesIndex;
if(index[st[0]+";"+st[1]] && index[st[1]+";"+st[0]] &&
index[st[0]+";"+st[1]].hidden==true &&
index[st[1]+";"+st[0]].hidden==true
if(Edges[st[0]+";"+st[1]] && Edges[st[1]+";"+st[0]] &&
Edges[st[0]+";"+st[1]].hidden==true &&
Edges[st[1]+";"+st[0]].hidden==true
){
if(Edges[st[0]+";"+st[1]].weight == Edges[st[1]+";"+st[0]].weight){
unHide(st[0]+";"+st[1]);
......
......@@ -11,7 +11,6 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
this.count=0;
this.p = {
count: 0,
linLogMode: false,
outboundAttractionDistribution: false,
adjustSizes: false,
......@@ -1082,6 +1081,12 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
var ybuffer = miny;
for (var i in this._core.graph.nodesIndex) {
if (swMacro) {
Nodes[i].x = this._core.graph.nodesIndex[i].x;
Nodes[i].y = this._core.graph.nodesIndex[i].y;
}
if(this._core.graph.nodesIndex[i].degree==0) {
// this._core.graph.nodesIndex[i].color = "#000000"
......@@ -1106,4 +1111,6 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
pr("miny: "+miny)
pr("maxy: "+maxy)
pr("")
};
......@@ -1086,7 +1086,8 @@ sigma.classes.Cascade = function() {
var r = (a[0] + b[0]) >> 1;
var g = (a[1] + b[1]) >> 1;
var b = (a[2] + b[2]) >> 1;
var color = '#'+sigma.tools.rgbToHex(parseFloat(r),parseFloat(g),parseFloat(b))
// var color = '#'+sigma.tools.rgbToHex(parseFloat(r),parseFloat(g),parseFloat(b))
var color = "rgba( "+r+", "+g+" , "+b+" ,0.5)";
//pr(params.label);
// if(params.label=="nodes1") {
......@@ -2305,7 +2306,8 @@ sigma.classes.Cascade = function() {
switch (edge['type'] || self.p.defaultEdgeType) {
case 'curve':
ctx.strokeStyle = color;
if(overNodes==false) {
if(!overNodes) {
//Coloring normal edges (without hover)
if(color == greyColor) {
ctx.lineWidth = edge['displaySize'] / 16;
}
......@@ -2314,11 +2316,13 @@ sigma.classes.Cascade = function() {
}
}
else {
//overNodes = TRUE
//Coloring hover edges
if(color == greyColor) {
ctx.lineWidth = edge['displaySize'] / 16;
}
else {
ctx.lineWidth = edge['displaySize']/1.2;/**/
ctx.lineWidth = edge['displaySize']*1.2;/**/
}
}
ctx.beginPath();
......
......@@ -765,4 +765,5 @@ function extractFromJson(data,seed){
//edge.hidden=false/**///should be commented
}
}
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