Commit ebe60432 authored by PkSM3's avatar PkSM3

changetomeso for monographs

parent 9e96eeda
...@@ -31,7 +31,8 @@ if (mainfile) { ...@@ -31,7 +31,8 @@ if (mainfile) {
} else { } else {
window.location.href=window.location.origin+window.location.pathname+"?file="+mainfile; window.location.href=window.location.origin+window.location.pathname+"?file="+mainfile;
} }
} else { } //url-mode
else {
if(isUndef(getUrlParam.nodeidparam)) { if(isUndef(getUrlParam.nodeidparam)) {
pr("do nothing, 'cause don't wanna"); pr("do nothing, 'cause don't wanna");
......
...@@ -1203,6 +1203,43 @@ function createEdgesForExistingNodes (typeOfNodes) { ...@@ -1203,6 +1203,43 @@ function createEdgesForExistingNodes (typeOfNodes) {
existingNodes = partialGraph._core.graph.nodes; existingNodes = partialGraph._core.graph.nodes;
if( categoriesIndex.length==1 ) {
var pairdict = {}
for(var n in existingNodes) {
ID = existingNodes[n].id;
vois = nodes1[ID].neighbours;
for(var v in vois) {
pair = [ parseInt(ID) , parseInt(vois[v]) ].sort(compareNumbers)
pairdict [ pair[0]+";"+pair[1] ] = 1
}
}
for (var e in pairdict) {
edge = "";
if(isUndef(Edges[e])) {
E = e.split(";")
edge = E[1]+";"+E[0];
} else edge=e;
E = edge.split(";")
if( getn(E[0]) && getn(E[1]) )
unHide(edge)
// pr("antes:"+e+"\t|\tdespues:"+edge)
// pr("\t\t\t\t\t----- decision final "+edge)
// unHide(edge)
}
return;
}
if(typeOfNodes=="Bipartite"){ if(typeOfNodes=="Bipartite"){
for(i=0; i < existingNodes.length ; i++){ for(i=0; i < existingNodes.length ; i++){
for(j=0; j < existingNodes.length ; j++){ for(j=0; j < existingNodes.length ; j++){
...@@ -1427,6 +1464,7 @@ function unHideElem(id){ ...@@ -1427,6 +1464,7 @@ function unHideElem(id){
} }
function changeToMeso(iwannagraph) { function changeToMeso(iwannagraph) {
labels=[] labels=[]
iwantograph=iwannagraph;//just a mess iwantograph=iwannagraph;//just a mess
...@@ -1434,6 +1472,7 @@ function changeToMeso(iwannagraph) { ...@@ -1434,6 +1472,7 @@ function changeToMeso(iwannagraph) {
partialGraph.emptyGraph(); partialGraph.emptyGraph();
pr("changing to Meso-"+iwannagraph); pr("changing to Meso-"+iwannagraph);
if(iwannagraph=="social") { if(iwannagraph=="social") {
if(!is_empty(selections)){ if(!is_empty(selections)){
// hideEverything(); // hideEverything();
...@@ -1464,11 +1503,10 @@ function changeToMeso(iwannagraph) { ...@@ -1464,11 +1503,10 @@ function changeToMeso(iwannagraph) {
} }
} }
} }
for (var Nk in finalnodes) unHide(Nk); for (var Nk in finalnodes) unHide(Nk);
createEdgesForExistingNodes(iwannagraph);/**/ createEdgesForExistingNodes(iwannagraph);/**/
} }
if(swclickPrev=="semantic") { if(swclickPrev=="semantic") {
var finalnodes={} var finalnodes={}
...@@ -1494,6 +1532,7 @@ function changeToMeso(iwannagraph) { ...@@ -1494,6 +1532,7 @@ function changeToMeso(iwannagraph) {
for (var Nk in finalnodes) unHide(Nk); for (var Nk in finalnodes) unHide(Nk);
createEdgesForExistingNodes(iwannagraph);/**/ createEdgesForExistingNodes(iwannagraph);/**/
} }
if(swclickPrev=="sociosemantic") { if(swclickPrev=="sociosemantic") {
var finalnodes={} var finalnodes={}
......
...@@ -259,30 +259,41 @@ function onepartiteExtract(){ ...@@ -259,30 +259,41 @@ function onepartiteExtract(){
val:val val:val
}); });
} }
edge.label="nodes1"; edge.label="nodes1";
if((typeof nodes1[source])=="undefined"){ if(isUndef(nodes1[source])){
nodes1[source] = { nodes1[source] = {
label: Nodes[source].label, label: Nodes[source].label,
neighbours: [] neighbours: [],
neighboursIndex: {}
}; };
nodes1[source].neighbours.push(target); nodes1[source].neighboursIndex[target] = 1;
} else nodes1[source].neighbours.push(target); } else nodes1[source].neighboursIndex[target] = 1;
if((typeof nodes1[target])=="undefined"){
if( isUndef(nodes1[target]) ){
nodes1[target] = { nodes1[target] = {
label: Nodes[target].label, label: Nodes[target].label,
neighbours: [] neighbours: [],
neighboursIndex: {}
}; };
nodes1[target].neighbours.push(source); nodes1[target].neighboursIndex[source] = 1;
} else nodes1[target].neighbours.push(source); } else nodes1[target].neighboursIndex[source] = 1;
Edges[indice] = edge; Edges[indice] = edge;
if( (typeof partialGraph._core.graph.edgesIndex[target+";"+source])=="undefined" ){ if( isUndef(gete([target+";"+source])) ) partialGraph.addEdge(indice,source,target,edge);
partialGraph.addEdge(indice,source,target,edge);
}
} }
} }
for(var n in nodes1) {
nodes1[n].neighbours = Object.keys(nodes1[n].neighboursIndex)
nodes1[n].neighboursIndex = null;
delete nodes1[n].neighboursIndex
}
} }
function fullExtract(){ function fullExtract(){
var i, j, k; var i, j, k;
// Parse Attributes // Parse Attributes
......
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