Commit ebe60432 authored by PkSM3's avatar PkSM3

changetomeso for monographs

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