Commit e8c8c22d authored by PkSM3's avatar PkSM3

portable on the way

parent 0d9cc033
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -176,6 +176,7 @@ 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")
if(partialGraph._core.graph.edges.length==0) return;
var filterparams = AlgorithmForSliders ( partialGraph._core.graph.edges , type_attrb , type , criteria)
var steps = filterparams["steps"]
......@@ -258,6 +259,8 @@ function NodeWeightFilter(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")
if(partialGraph._core.graph.nodes.length==0) return;
var filterparams = AlgorithmForSliders ( partialGraph._core.graph.nodes , type_attrb , type , criteria)
var steps = filterparams["steps"]
var finalarray = filterparams["finalarray"]
......
......@@ -7,6 +7,7 @@ $( window ).resize(function() {
});// === / monitor windows resize === //
mainfile = (isUndef(getUrlParam.file))?false:true;
// === [what to do at start] === //
if (mainfile) {
// http://localhost/adasd/explorerjs.html?file=data/140907Syneco.gexf
......@@ -194,11 +195,26 @@ function bringTheNoise(pathfile,type){
// < === EXTRACTING DATA === >
if(mainfile) {
pr("mainfile: "+mainfile)
parse(decodeURIComponent(pathfile));
if(type=="mono") {
onepartiteExtract();
$("#left").hide();
} else if(type=="bi") fullExtract();
}
if(type=="bi") {
semanticConverged=true;
pr("here in fullextract")
fullExtract();
$("#closeloader").click();
pushSWClick("social");
pr(partialGraph._core.graph.nodes.length)
pr(partialGraph._core.graph.edges.length)
}
partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8).draw(2,2,2);
theListeners();
......@@ -700,6 +716,7 @@ function SigmaLayouting( URL, DATA, NAME) {
partialGraph.draw();
EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
NodeWeightFilter ( "#sliderBNodeWeight" , "type" , "NGram" , "size")
$("#colorGraph").hide();
}
console.log("Parsing and FA2 complete for SemanticGraph.");
......
......@@ -198,6 +198,8 @@ function alertCheckBox(eventCheck){
// AaBb: Socio-Semantic
function RefreshState(newNOW){
pr("\t\t\tin RefreshState newNOW:_"+newNOW+"_.")
if (newNOW!="") {
PAST = NOW;
NOW = newNOW;
......@@ -1467,11 +1469,7 @@ function changeToMeso(iwannagraph) {
// unHide(id);
}
}
createEdgesForExistingNodes(iwannagraph);/**/
greyEverything();
for(var i in selections) markAsSelected(i,true);
overNodes=true;
createEdgesForExistingNodes(iwannagraph);/**/
}
if(swclickPrev=="semantic") {
......@@ -1493,7 +1491,7 @@ function changeToMeso(iwannagraph) {
}
if(swclickPrev=="sociosemantic") {
hideEverything();
// hideEverything();
for(var i in selections) {
if(Nodes[i].type==catSoc){
......@@ -1512,10 +1510,6 @@ function changeToMeso(iwannagraph) {
}
}
for(var i in selections) {
markAsSelected(i,true);
}
overNodes=true;
}
}
}
......@@ -1593,6 +1587,14 @@ function changeToMeso(iwannagraph) {
// // partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8);
// partialGraph.refresh();
// partialGraph.startForceAtlas2();
MultipleSelection(Object.keys(selections));
// greyEverything();
// for(var i in selections) markAsSelected(i,true);
// overNodes=true;
$('.gradient').css({"background-size":"90px 90px"});
}
......@@ -1649,6 +1651,7 @@ function changeToMacro(iwannagraph) {
for(var e in Edges) {
if(Edges[e].label=="nodes1" || Edges[e].label=="nodes2"){
st=e.split(";");
if(Edges[st[0]+";"+st[1]] && Edges[st[1]+";"+st[0]] &&
Edges[st[0]+";"+st[1]].hidden==true &&
......
......@@ -29,7 +29,7 @@ function scanCategories() {
attvalueNode = attvalueNodes[k];
attr = attvalueNode.getAttribute('for');
val = attvalueNode.getAttribute('value');
pr(val)
// pr(val)
if (attr=="category") categories[val]=val;
}
}
......@@ -403,24 +403,20 @@ function fullExtract(){
/* Para asignar tamaño a los NGrams */
if(atts["category"]===categoriesIndex[1]) {
if(typeof(node.size)==="undefined") node.size=parseInt(val).toFixed(2);
/* Type of Node*/
//console.log(val);
//if(val<30) val=30;
//Nodes[id].size=(parseInt(val).toFixed(2)*5)/70;
// Nodes[id].size=parseInt(val).toFixed(2);
// node.size=Nodes[id].size;
// if(id.charAt(0)=="D") {
// Nodes[id].size = "5";
// node.size = "5";
// }
}
/* Para asignar tamaño a los NGrams */
}
//console.log(node.attributes);
nodecat=node.attributes["category"];
nodew=parseInt(node.attributes["weight"]);
if( nodecat===categoriesIndex[1]){
node.type=catSoc;
node.id = "D::"+node.id;
node.shape="square";
numberOfDocs++;
//node.size=desirableScholarSize;
......@@ -428,34 +424,30 @@ function fullExtract(){
}
else {
node.type=catSem;
node.id = "N::"+node.id;
numberOfNGrams++;
if(typeof(node.size)==="undefined") node.size=nodew;
if(isUndef(node.size)) node.size=nodew;
}
if(parseInt(node.size) < parseInt(minNodeSize)) minNodeSize= node.size;
if(parseInt(node.size) > parseInt(maxNodeSize)) maxNodeSize= node.size;
// Create Node
Nodes[id] = node // The graph node
//pr(Nodes[id]);
Nodes[node.id] = node // The graph node
}
}
//New scale for node size: now, between 2 and 5 instead [1,70]
for(var i in Nodes){
normalizedSize=desirableNodeSizeMIN+(Nodes[i].size-1)*((desirableNodeSizeMAX-desirableNodeSizeMIN)/(parseInt(maxNodeSize)-parseInt(minNodeSize)));
Nodes[i].size = ""+normalizedSize;
if(Nodes[i].type==catSem) {
nodeK = Nodes[i];
nodeK.hidden=true;
partialGraph.addNode(i,nodeK);
delete Nodes[i].hidden;
}
else {
partialGraph.addNode(i,Nodes[i]);
unHide(i);
}
nodeK = Nodes[i];
if(Nodes[i].type==catSoc) partialGraph.addNode(i,nodeK);
}
var edgeId = 0;
var edgesNodes = gexf.getElementsByTagName('edges');
for(i=0; i<edgesNodes.length; i++){
......@@ -465,7 +457,13 @@ function fullExtract(){
var edgeNode = edgeNodes[j];
var source = edgeNode.getAttribute('source');
var target = edgeNode.getAttribute('target');
source = (Nodes["D::"+source])? ("D::"+source):("N::"+source)
target = (Nodes["D::"+target])? ("D::"+target):("N::"+target)
var indice=source+";"+target;
// pr(indice)
var edge = {
id: indice,
......@@ -486,7 +484,8 @@ function fullExtract(){
var attvalueNode = attvalueNodes[k];
var attr = attvalueNode.getAttribute('for');
var val = attvalueNode.getAttribute('value');
if(k==1) {
if(k=="category") {
kind=val;
edge.label=val;
}
......@@ -501,78 +500,102 @@ function fullExtract(){
});
}
idS=Nodes[edge.sourceID].type.charAt(0);
idT=Nodes[edge.targetID].type.charAt(0);
//pr(idS+";"+idT);
if(idS=="D" && idT=="D"){
edge.label="nodes1";
if( (typeof partialGraph._core.graph.edgesIndex[target+";"+source])=="undefined" ){
edge.hidden=false;
}
else edge.hidden=true;
if((typeof nodes1[source])=="undefined"){
// pr(edge)
idS=Nodes[edge.sourceID].type;
idT=Nodes[edge.targetID].type;
Edges[indice] = edge;
if(idS==catSoc && idT==catSoc){
// pr("anything here?")
edge.label = "nodes1";
if(isUndef(nodes1[source])) {
nodes1[source] = {
label: Nodes[source].label,
neighbours: []
};
nodes1[source].neighbours.push(target);
};
}
else nodes1[source].neighbours.push(target);
// if((typeof nodes1[target])=="undefined"){
// nodes1[target] = {
// label: Nodes[target].label,
// neighbours: []
// };
// nodes1[target].neighbours.push(source);
// }
// else nodes1[target].neighbours.push(source);
}
if(idS=="N" && idT=="N"){
edge.label="nodes2";
//pr("nodes2");
edge.hidden=true;
if((typeof nodes2[source])=="undefined"){
nodes2[source] = {
label: Nodes[source].label,
if(isUndef(nodes1[target])) {
nodes1[target] = {
label: Nodes[target].label,
neighbours: []
};
nodes2[source].neighbours.push(target);
}
else nodes2[source].neighbours.push(target);
};
}
nodes1[source].neighbours.push(target);
nodes1[target].neighbours.push(source);
// partialGraph.addEdge(indice,source,target,edge);
}
if((idS=="D" && idT=="N")||(idS=="N" && idT=="D")){
edge.label="bipartite";
//pr("bipartite");
edge.hidden=true;
// Document to NGram
if((typeof bipartiteD2N[source])=="undefined"){
bipartiteD2N[source] = {
if(idS==catSem && idT==catSem){
edge.label = "nodes2";
if(isUndef(nodes2[source])) {
nodes2[source] = {
label: Nodes[source].label,
neighbours: []
};
bipartiteD2N[source].neighbours.push(target);
};
}
else bipartiteD2N[source].neighbours.push(target);
// NGram to Document
if((typeof bipartiteN2D[target])=="undefined"){
bipartiteN2D[target] = {
if(isUndef(nodes2[target])) {
nodes2[target] = {
label: Nodes[target].label,
neighbours: []
};
};
}
nodes2[source].neighbours.push(target);
nodes2[target].neighbours.push(source);
// otherGraph.addEdge(indice,source,target,edge);
}
if((idS==catSoc && idT==catSem)||(idS==catSem && idT==catSoc)) {
edge.label = "bipartite";
s = edge.sourceID
// // Source is Document
if(Nodes[s].type == catSoc) {
if(isUndef(bipartiteD2N[source])) {
bipartiteD2N[source] = {
label: Nodes[source].label,
neighbours: []
};
}
if(isUndef(bipartiteN2D[target])) {
bipartiteN2D[target] = {
label: Nodes[target].label,
neighbours: []
};
}
bipartiteD2N[source].neighbours.push(target);
bipartiteN2D[target].neighbours.push(source);
// // Source is NGram
} else {
if(isUndef(bipartiteN2D[source])) {
bipartiteN2D[source] = {
label: Nodes[source].label,
neighbours: []
};
}
if(isUndef(bipartiteD2N[target])) {
bipartiteD2N[target] = {
label: Nodes[target].label,
neighbours: []
};
}
bipartiteN2D[source].neighbours.push(target);
bipartiteD2N[target].neighbours.push(source);
}
else bipartiteN2D[target].neighbours.push(source);
}
partialGraph.addEdge(indice,source,target,edge);
delete edge.hidden;
Edges[indice]=edge;
}
}
}
......@@ -662,7 +685,7 @@ function extractFromJson(data,seed){
var source = edgesNodes[i].s;
var target = edgesNodes[i].t;
var indice=source+";"+target;
if(indice.indexOf("D::593")!==-1) pr(indice)
// if(indice.indexOf("D::593")!==-1) pr(indice)
var edge = {
id: indice,
sourceID: source,
......@@ -765,5 +788,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