Commit 98bf373c authored by Romain Loth's avatar Romain Loth

better sliders skeleton for bipartite case

faster NodeWeightFilter with the new index, harmonized calls and signatures for nodes and edges functions, TODO check lastFilter updating
parent 0c101924
......@@ -184,9 +184,8 @@
</a></li>
<li><a>
<!-- TODO fix: category0 -> category1 switching -->
Label size<br>
<div id="slidercat0nodessize" class="settingslider"></div>
<div id="sliderlabelsize" class="settingslider"></div>
</a></li>
<li class="dropdown">
......@@ -205,10 +204,8 @@
</li>
-->
<!-- TODO fix: category0 -> category1 switching -->
<li class="weight-selectors">
<!-- <a> -->
<!-- Create a subgraph -->
<li class="weight-selectors category0">
<!-- Create a subgraph over nodes from TW.categories[0] (docs or def nodes)-->
<table>
<tr>
<td class="slider-legend">
......@@ -226,7 +223,8 @@
</tr>
</table>
</li>
<!-- <li class="weight-selectors">
<li class="weight-selectors category1">
<!-- Create a subgraph over nodes from TW.categories[1] (terms)-->
<table>
<tr class="weight-selector">
<td class="slider-legend">
......@@ -243,7 +241,7 @@
</td>
</tr>
</table>
</li> -->
</li>
</ul>
......
......@@ -224,7 +224,9 @@ html, body {
box-shadow: 0px 2px 6px #000;
}
.category1 {
display: none; /* initial display off but turned on when changetype */
}
.grey {
color: #cccccc; font-style: italic;
......
......@@ -364,42 +364,45 @@ TinaWebJS = function ( sigmacanvas ) {
return this.edgesArray.length;
});
// register an index for nodes by size (<= origNode.size||origiNode.weight)
// register an index for nodes by type and size (<= origNode.size||origNode.weight)
sigmaModule.classes.graph.addIndex('nodesBySize', {
constructor: function() {
this.nodesBySize = {};
},
addNode: function(n) {
if (n.size) {
if (n.type && n.size) {
let sizekey = parseFloat(n.size)
if (!this.nodesBySize[sizekey])
this.nodesBySize[sizekey] = {}
this.nodesBySize[sizekey][n.id] = true
if (!this.nodesBySize[n.type])
this.nodesBySize[n.type] = {}
if (!this.nodesBySize[n.type][sizekey])
this.nodesBySize[n.type][sizekey] = {}
this.nodesBySize[n.type][sizekey][n.id] = true
}
},
dropNode: function(n) {
if (n.size) {
delete(this.nodesBySize[n.size][n.id])
if (n.type && n.size) {
delete(this.nodesBySize[n.type][n.size][n.id])
}
}
});
// @ntype: a node type from TW.categories
// @aSizeSelector can be:
// - a numeric value
// - a range (ordered array of 2 numeric values)
sigmaModule.classes.graph.addMethod('getNodesBySize', function(aSizeSelector) {
sigmaModule.classes.graph.addMethod('getNodesBySize', function(ntype, aSizeSelector) {
let res = []
// shortcut case for commodity: entire index if no arg
if (isUndef(aSizeSelector)) {
res = this.nodesBySize
res = this.nodesBySize[ntype]
}
// normal cases
else if (isNumeric(aSizeSelector)) {
let sizekey = parseFloat(aSizeSelector)
if (this.nodesBySize[sizekey]) {
res = Object.keys(this.nodesBySize[sizekey])
if (this.nodesBySize[ntype][sizekey]) {
res = Object.keys(this.nodesBySize[ntype][sizekey])
}
}
else if (Array.isArray(aSizeSelector)
......@@ -411,7 +414,7 @@ TinaWebJS = function ( sigmacanvas ) {
let sizeMax = parseFloat(aSizeSelector[1])
// the available sizes
let sortedSizes = Object.keys(this.nodesBySize).sort(function(a,b){return a-b})
let sortedSizes = Object.keys(this.nodesBySize[ntype]).sort(function(a,b){return a-b})
// the nodes with sizes in range
for (var k in sortedSizes) {
......@@ -420,7 +423,7 @@ TinaWebJS = function ( sigmacanvas ) {
break
}
if (val >= sizeMin) {
res = res.concat(Object.keys(this.nodesBySize[val]))
res = res.concat(Object.keys(this.nodesBySize[ntype][val]))
}
}
}
......@@ -457,7 +460,7 @@ TinaWebJS = function ( sigmacanvas ) {
// - additionnaly supports 'active/forcelabel' node property (magnify x 3)
sigmaModule.canvas.hovers.def = tempo.twRender.canvas.hovers.largerall
console.log('tw renderers registered in sigma module"')
console.log('tw renderers registered in sigma module')
}
this.SearchListeners = function () {
......@@ -725,6 +728,8 @@ TinaWebJS = function ( sigmacanvas ) {
}
});
// £TODO test if still needed
pushSWClick("social");
cancelSelection(false);
......@@ -965,18 +970,25 @@ TinaWebJS = function ( sigmacanvas ) {
if (TW.filterSliders) {
NodeWeightFilter ( categories , "#slidercat0nodesweight" , categories[0], "type" ,"size");
EdgeWeightFilter("#slidercat0edgesweight", "label" , "nodes1", "weight");
// args: for display: target div ,
// for context: family/type prop value,
// for values: the property to filter
NodeWeightFilter ( "#slidercat0nodesweight" ,
categories[0] ,
"size"
);
EdgeWeightFilter("#slidercat0edgesweight",
getCurrentTypeString(),
"weight"
);
}
$("#category1").hide();
//finished
var labelSizeTimeout = null
$("#slidercat0nodessize").freshslider({
$("#sliderlabelsize").freshslider({
step:.5,
min:0,
max:5,
......
......@@ -461,68 +461,66 @@ function changeLevel() {
//=========================== < FILTERS-SLIDERS > ===========================//
// census of edges by type and by size
// (replaces deprecated AlgorithmForSliders, but without the sqrt transform)
function edgeSizesLookup() {
var edgeweis = {}
for (let i in TW.edgeIds) {
let e = TW.partialGraph.graph.edges(TW.edgeIds[i])
if (e) {
if (!edgeweis[e.categ]) edgeweis[e.categ] = {}
if (!edgeweis[e.categ][e.weight]) edgeweis[e.categ][e.weight] = []
edgeweis[e.categ][e.weight].push(e.id)
}
}
return edgeweis
}
function edgeSizesSteps(eTypeStr) {
let esizesCensus = edgeSizesLookup()
var stepToIdsArray = []
if (esizesCensus[eTypeStr]) {
var sortedSizes = Object.keys(
esizesCensus[eTypeStr]
).sort(function(a,b){return a-b})
for (let l in sortedSizes) {
stepToIdsArray.push(esizesCensus[eTypeStr][sortedSizes[l]])
}
}
return stepToIdsArray
}
// Execution modes:
// EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
// EdgeWeightFilter("#sliderAEdgeWeight", "1", "weight");
// EdgeWeightFilter("#sliderAEdgeWeight", "1|0", "weight");
// EdgeWeightFilter("#sliderBEdgeWeight", "0|1", "weight");
// NB new sigma js: dropEdge is quite slow so we add a waiting cursor
function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
console.log("EdgeWeightFilter")
console.log("sliderDivID", sliderDivID)
console.log("type_attrb", type_attrb)
console.log("type", type)
console.log("criteria", criteria)
// if ($(sliderDivID).html()!="") {
// console.log("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]")
// return;
// }
// sliderDivID = "#sliderAEdgeWeight"
// type = "nodes1"
// type_attrb = "label"
// criteria = "weight"
// sliderDivID = "#sliderBNodeSize"
// type = "NGram"
// type_attrb = "type"
// criteria = "size"
if(TW.nEdges<3) {
$(sliderDivID).freshslider({
range: true,
step:1,
value:[10, 60],
enabled: false,
onchange:function(low, high){
console.log(low, high);
}
});
function EdgeWeightFilter(sliderDivID , typestr , criteria) {
if(TW.partialGraph.graph.nEdges()<2) {
console.warn('not enough edges for subsets: skipping GUI slider init')
showDisabledSlider(sliderDivID)
return;
}
var filterparams = AlgorithmForSliders ( TW.Edges , type_attrb , type , criteria) //OK
// TODO make an index
console.log("EdgeWeightFilter: "+type)
console.log(filterparams)
var stepToIdsArr = edgeSizesSteps(typestr)
var steps = stepToIdsArr.length
var steps = filterparams["steps"]
var finalarray = filterparams["finalarray"]
// if(steps<3) {
// $(sliderDivID).freshslider({
// range: true,
// step:1,
// value:[10, 60],
// enabled: false,
// onchange:function(low, high){
// console.log(low, high);
// }
// });
// return;
// }
if(steps<2) {
console.warn('no size steps for edges: skipping GUI slider init')
showDisabledSlider(sliderDivID)
return;
}
var lastvalue=("0-"+(steps-1));
......@@ -531,17 +529,21 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
var present = TW.partialGraph.states.slice(-1)[0];
console.log('init freshslider for edges, steps:', steps)
// console.log('init freshslider for edges, steps:', steps, sliderDivID)
var edgeSlideTimeout = null
if (steps == 0) {
return
}
//finished
$(sliderDivID).freshslider({
range: true,
step: 1,
min:0,
bgcolor: (type=="nodes1")?"#27c470":"#FFA500" ,
// green for docs, orange for terms
bgcolor: (typestr=="1|0" || typestr=="1")?"#27c470":"#FFA500" ,
max:steps-1,
value:[0,steps-1],
onchange:function(low, high) {
......@@ -564,7 +566,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
if(filtervalue!=lastFilter[sliderDivID]["last"]) {
// TODO memoize the last filter value
// £TODO better memoize the last filter value
// $.doTimeout(sliderDivID+"_"+lastFilter[sliderDivID]["last"]);
......@@ -611,11 +613,11 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// do the important stuff
// ex iterarr [0:0, 1:1...]
// ex finalarray [0: [eid1,eid2], 1:[eid3,eid4,eid5]...]
// ex stepToIdsArr [0: [eid1,eid2], 1:[eid3,eid4,eid5]...]
for( var c in iterarr ) {
var i = iterarr[c];
var eids = finalarray[i]
var eids = stepToIdsArr[i]
if(i>=low && i<=high) {
if(addflag) {
......@@ -635,7 +637,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// local level case
// finalarray is full of edges that don't really exist at this point
// stepToIdsArr is full of edges that don't really exist at this point
else {
// NB we assume the sigma convention eid = "nid1;nid2"
......@@ -696,16 +698,18 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// console.log("\t\tedgesfilter:")
// console.log("\t\t[ Starting FA2 ]")
// [ Starting FA2 ]
if (!TW.partialGraph.isForceAtlas2Running())
TW.partialGraph.startForceAtlas2();
setTimeout(function(){
if (TW.partialGraph.isForceAtlas2Running())
TW.partialGraph.stopForceAtlas2();
},
3000);
// [ / Starting FA2 ]
setTimeout(function() {
if (!TW.partialGraph.isForceAtlas2Running()
&& TW.partialGraph.graph.nNodes() > 8) {
TW.partialGraph.startForceAtlas2();
setTimeout(function(){
if (TW.partialGraph.isForceAtlas2Running())
TW.partialGraph.stopForceAtlas2();
},
2000) // shorter FA2 sufficient
}
}, 10)
// [ / Starting FA2 ]
lastvalue = filtervalue;
pushFilterValue( sliderDivID , filtervalue )
......@@ -729,64 +733,40 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// Execution modes:
// NodeWeightFilter ( "#sliderANodeWeight" , "Document" , "type" , "size")
// NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size")
function NodeWeightFilter( categories , sliderDivID , type_attrb , type , criteria) {
// if ($(sliderDivID).html()!="") {
// console.log("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]")
// return;
// }
// sliderDivID = "#sliderAEdgeWeight"
// type = "nodes1"
// type_attrb = "label"
// criteria = "weight"
// sliderDivID = "#sliderBNodeSize"
// type = "NGram"
// type_attrb = "type"
// criteria = "size"
if(TW.partialGraph.graph.nNodes() < 3) {
$(sliderDivID).freshslider({
range: true,
step:1,
value:[10, 60],
enabled: false,
onchange:function(low, high){
console.log(low, high);
}
});
return;
// NodeWeightFilter ( "#sliderANodeWeight" , "Document" , "size")
// NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "size")
function NodeWeightFilter( sliderDivID , tgtNodeType , criteria) {
if(TW.partialGraph.graph.nNodes() < 2) {
console.warn('not enough nodes for subsets: skipping GUI slider init')
showDisabledSlider(sliderDivID)
return;
}
// ids per weight level
// we use live index from prepareSigmaCustomIndices
let nodesBySize = TW.partialGraph.graph.getNodesBySize()
let nodesBySize = TW.partialGraph.graph.getNodesBySize(tgtNodeType)
var sortedSizes = Object.keys(nodesBySize).sort(function(a,b){return a-b})
var steps = sortedSizes.length
var finalarray = []
var stepToIdsArr = []
for (let l in sortedSizes) {
finalarray.push(TW.partialGraph.graph.getNodesBySize(sortedSizes[l]))
var nidsWithThatSize = TW.partialGraph.graph.getNodesBySize(tgtNodeType, sortedSizes[l])
if (nidsWithThatSize.length) {
stepToIdsArr.push(nidsWithThatSize)
}
}
var steps = stepToIdsArr.length
// console.warn('NodeWeightFilter: steps', steps)
if(steps<3) {
$(sliderDivID).freshslider({
range: true,
step:1,
value:[10, 60],
enabled: false,
onchange:function(low, high){
console.log(low, high);
}
});
return;
if(steps<2) {
console.warn('no size steps for nodes: skipping GUI slider init')
showDisabledSlider(sliderDivID)
return;
}
var nodeSlideTimeout = null
......@@ -797,7 +777,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
step: 1,
min:0,
max:steps-1,
bgcolor:( type_attrb==categories[0] )?"#27c470":"#FFA500" ,
bgcolor:( tgtNodeType==TW.categories[0] )?"#27c470":"#FFA500" ,
value:[0,steps-1],
onchange:function(low, high){
var filtervalue = low+"-"+high
......@@ -822,8 +802,8 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
// scheduled: graph rm nodes
nodeSlideTimeout = setTimeout ( function () {
for(var i in finalarray) {
ids = finalarray[i]
for(var i in stepToIdsArr) {
ids = stepToIdsArr[i]
if(i>=low && i<=high){
for(var id in ids) {
ID = ids[id]
......@@ -846,15 +826,18 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
// [ Starting FA2 ]
setTimeout(function() {
if (!TW.partialGraph.isForceAtlas2Running())
TW.partialGraph.startForceAtlas2()
// duration = settings_explorerjs.fa2milliseconds
setTimeout(function() {
if (TW.partialGraph.isForceAtlas2Running())
TW.partialGraph.stopForceAtlas2()
}, parseInt(fa2milliseconds) || 5000)
if (!TW.partialGraph.isForceAtlas2Running()
&& TW.partialGraph.graph.nNodes() > 8) {
TW.partialGraph.startForceAtlas2();
setTimeout(function(){
if (TW.partialGraph.isForceAtlas2Running())
TW.partialGraph.stopForceAtlas2();
},
2000) // shorter FA2 sufficient
}
}, 10)
// [ / Starting FA2 ]
// [ / Starting FA2 ]
}, 300)
}
......@@ -862,113 +845,18 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
});
}
// new sigma.js nodesIndex and edgesIndex are private attributes so we use getters
function getGraphElement(elemId) {
if(elemId.split(";").length==1) return TW.partialGraph.graph.nodes(elemId);
else return TW.partialGraph.graph.edges(elemId)
function showDisabledSlider(someDivId) {
$(someDivId).freshslider({
range: true,
step:1,
min: 0,
max: 1,
value:[0, 1],
enabled: false
});
$(someDivId).css('cursor', 'not-allowed')
}
// creates graph subsets
// ---------------------
// TODO use a type-based index for elems subset
// TODO use a size/weight-based index for elem_attrb
// 4 Execution modes:
// AlgorithmForSliders ( TW.partialGraph._core.graph.edges , "label" , "nodes1" , "weight")
// AlgorithmForSliders ( TW.partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
// AlgorithmForSliders ( TW.partialGraph._core.graph.nodes , "type" , "Document" , "size")
// AlgorithmForSliders ( TW.partialGraph._core.graph.nodes , "type" , "NGram" , "size")
function AlgorithmForSliders( elements , type_attrb , type , criteria) {
// // ( 1 )
// // get visible sigma nodes|edges
if(isUndef(elements)) return {"steps":0 , "finalarray":[]};
var elems = [];
for(var e in elements) {
if( elements[e][type_attrb]==type ) {
if(getGraphElement(e)) {
elems.push(elements[e])
}
}
}
if(elems.length==0)
return { "steps":0 , "finalarray":[] };
// identifying if you received nodes or edges
var edgeflag = (elems[0].id.split(";").length>1);
console.log("AlgorithmForSliders edgeflag", edgeflag)
// // ( 2 )
// // extract [ "edgeID" : edgeWEIGHT ] | [ "nodeID" : nodeSIZE ]
// // and save this into edges_weight | nodes_size
var elem_attrb=[]
for (var i in elems) {
e = elems[i]
id = e.id
elem_attrb[id]=e[criteria]
// console.log(id+"\t:\t"+e[criteria])
}
// console.log("{ id : size|weight } ")
// console.log(elem_attrb)
// // ( 3 )
// // order dict edges_weight by edge weight | nodes_size by node size
var result = ArraySortByValue(elem_attrb, function(a,b){
return a-b
//ASCENDENT
});
// console.log(result.length)
// // ( 4 )
// // printing ordered ASC by weigth
// for (var i in result) {
// r = result[i]
// idid = r.key
// elemattrb = r.value
// console.log(idid+"\t:\t"+elemattrb)
// // e = result[i]
// // console.log(e[criteria])
// }
var N = result.length
// var magnitude = (""+N).length //order of magnitude of edges|nodes
// var exponent = magnitude - 1
// var steps = Math.pow(10,exponent) // #(10 ^ magnit-1) steps
// var stepsize = Math.round(N/steps)// ~~(visibledges / #steps)
//var roundsqrtN = Math.round( Math.sqrt( N ) );
var steps = Math.round( Math.sqrt( N ) );
var stepsize = Math.round( N / steps );
// console.log("-----------------------------------")
// console.log("number of visible nodes|edges: "+N);
// console.log("number of steps : "+steps)
// console.log("size of one step : "+stepsize)
// console.log("-----------------------------------")
var finalarray = []
var counter=0
for(var i = 0; i < steps*2; i++) {
// console.log(i)
var IDs = []
for(var j = 0; j < stepsize; j++) {
if(!isUndef(result[counter])) {
k = result[counter].key
// w = result[counter].value
// console.log("\t["+counter+"] : "+w)
IDs.push(k)
}
counter++;
}
if(IDs.length==0) break;
finalarray[i] = IDs
}
// console.log("finalarray: ")
return {"steps":finalarray.length,"finalarray":finalarray}
}
//=========================== </ FILTERS-SLIDERS > ===========================//
......
......@@ -368,11 +368,6 @@ else {
console.error("== currently unhandled categorization of node types ==", TW.categories)
}
for(var i in TW.categories) {
TW.Filters[i] = {}
TW.Filters[i]["#slidercat"+i+"edgesweight"] = true;
}
// [ Initiating Sigma-Canvas ]
// POSS: ideally this should take a TW.settings as parameter
......@@ -508,6 +503,10 @@ else {
// here 'type' means: the categorie(s) that is (are) currently displayed
TW.partialGraph.states[1].type = initialState;
TW.partialGraph.states[1].LouvainFait = false;
// by default category0 is the initial type
$(".category1").hide();
// [ / Poblating the Sigma-Graph ]
......@@ -570,51 +569,38 @@ else {
if (TW.filterSliders) {
// £TODO test with comex2
if(typestring=="0|1") {
$("#category0").hide();
$("#category1").show();
if($("#slidercat1nodesweight").html()=="")
NodeWeightFilter( this.categories , "#slidercat1nodesweight" , this.categories[1], "type" ,"size");
// recreate sliders after perimeter changes
// £TODO fix conditions (was if #slider.html == '' or if level changed)
// atm on any state change
if($("#slidercat1edgesweight").html()=="")
EdgeWeightFilter("#slidercat1edgesweight", "label" , "nodes2", "weight");
// terms
if(typestring=="0|1") {
$(".category0").hide();
$(".category1").show();
if(present.level!=past.level) {
NodeWeightFilter( this.categories , "#slidercat1nodesweight" , this.categories[1], "type" ,"size");
EdgeWeightFilter("#slidercat1edgesweight", "label" , "nodes2", "weight");
}
set_ClustersLegend ( "clust_default" )
NodeWeightFilter( "#slidercat1nodesweight" , TW.categories[1], "size");
EdgeWeightFilter("#slidercat1edgesweight", typestring, "weight");
}
// docs
if(typestring=="1|0") {
$("#category0").show();
$("#category1").hide();
if($("#slidercat0nodesweight").html()=="")
NodeWeightFilter( this.categories , "#slidercat0nodesweight" , this.categories[0], "type" ,"size");
$(".category0").show();
$(".category1").hide();
if($("#slidercat0edgesweight").html()=="")
EdgeWeightFilter("#slidercat0edgesweight", "label" , "nodes1", "weight");
if(present.level!=past.level) {
NodeWeightFilter( this.categories , "#slidercat0nodesweight" , this.categories[0], "type" ,"size");
EdgeWeightFilter("#slidercat0edgesweight", "label" , "nodes1", "weight");
}
set_ClustersLegend ( "clust_default" )
NodeWeightFilter( "#slidercat0nodesweight" , TW.categories[0], "size");
EdgeWeightFilter("#slidercat0edgesweight", typestring, "weight");
}
// terms and docs
if(typestring=="1|1") {
$("#category0").show();
$("#category1").show();
// if(present.level!=past.level) {
NodeWeightFilter ( this.categories , "#slidercat0nodesweight" , this.categories[0], "type" ,"size");
EdgeWeightFilter("#slidercat0edgesweight", "label" , "nodes1", "weight");
NodeWeightFilter( this.categories , "#slidercat1nodesweight" , this.categories[1], "type" ,"size");
EdgeWeightFilter("#slidercat1edgesweight", "label" , "nodes2", "weight");
// }
$(".category0").show();
$(".category1").show();
NodeWeightFilter( "#slidercat0nodesweight" , TW.categories[0], "size");
NodeWeightFilter( "#slidercat1nodesweight" , TW.categories[1], "size");
EdgeWeightFilter("#slidercat0edgesweight", "1|0", "weight");
EdgeWeightFilter("#slidercat1edgesweight", "0|1", "weight");
}
}
......@@ -628,10 +614,6 @@ else {
for (var k in filterEls) {
if (filterEls[k] && filterEls[k].style) filterEls[k].style.display="none"
}
// document.getElementById('slidercat0nodesweight').style.display="none"
// document.getElementById('slidercat0edgesweight').style.display="none"
// document.getElementById('slidercat1nodesweight').style.display="none"
// document.getElementById('slidercat1edgesweight').style.display="none"
}
TW.FA2Params = {
......@@ -688,6 +670,8 @@ else {
);
}
// adapt the enviroment to monopartite vs. bipartite cases
if( TW.categories.length==1 ) {
$("#changetype").hide();
$("#taboppos").remove();
......
......@@ -106,6 +106,12 @@ function getCurrentType() {
return currentTypes.join('-')
}
function getCurrentTypeString() {
let lastState = TW.partialGraph.states.slice(-1)[0]
return lastState.type.map(Number).join('|')
}
function highlightSelectedNodes(flag){
console.log("\t***methods.js:highlightSelectedNodes(flag)"+flag+" selEmpty:"+is_empty(selections))
......@@ -201,8 +207,8 @@ function RefreshState(newNOW){
$("#semLoader").hide();
$("#category-B").show();
setTimeout(function(){
EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
NodeWeightFilter ( "#sliderBNodeWeight" , "NGram", "type" , "size");
EdgeWeightFilter("#sliderBEdgeWeight", "0|1", "weight");
NodeWeightFilter ( "#sliderBNodeWeight" , "NGram", "size");
},30)
} else {
$("#semLoader").css('visibility', 'visible');
......
......@@ -948,7 +948,7 @@ function dictfyJSON( data , categories ) {
let typestring = findEdgeType(nodes, source, target)
// save edge property
// save edge "type" in categ property
edge.categ = typestring
TW.Relations = updateRelations( TW.Relations,
typestring,
......
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