Commit 2cf9e030 authored by Romain Loth's avatar Romain Loth

removed most deprecated code fragments

NB: still need to rm old nodes1 nodes2
parent bc90228b
......@@ -11,9 +11,6 @@
margin: 2px 0;
}
#savesuggestion.btn {
}
#savesuggestion.btn[disabled], #savesuggestion.btn.disabled {
background-color: #B0B0B0 ;
background-image: none ;
......
......@@ -23,10 +23,13 @@
-->
<!-- <link href="https://fonts.googleapis.com/css?family=Ubuntu+Condensed" rel="stylesheet" type='text/css'> -->
<!-- Roboto
Good for tweets if Helvetica is not present
-->
<!-- <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type='text/css'> -->
<!-- Droid Sans -->
<link href="https://fonts.googleapis.com/css?family=Droid+Sans" rel="stylesheet">
<!-- Roboto
Good for tweets if Helvetica is not present
-->
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type='text/css'>
<!-- Crete Round
Original *and* informative :) -->
......@@ -42,7 +45,7 @@
<!-- Sahitya & Gurajada
"book" (beautiful quality roman) + devanagari support + telugu -->
<!-- <link href="https://fonts.googleapis.com/css?family=Gurajada" rel="stylesheet"> -->
<link href="https://fonts.googleapis.com/css?family=Gurajada" rel="stylesheet">
<!-- <link href="https://fonts.googleapis.com/css?family=Sahitya" rel="stylesheet"> -->
<!-- Itim
......
......@@ -2,12 +2,6 @@
* Customize as you want ;)
*/
function newPopup(url) {
popupWindow = window.open(url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no')
}
// = = = = = = = = = = = [ Clusters Plugin ] = = = = = = = = = = = //
// Execution: changeGraphAppearanceByFacets( true )
// It reads scanned node-attributes and prepared legends in TW.Clusters
......@@ -104,21 +98,6 @@ function changeGraphAppearanceByFacets( manualflag ) {
}
// creates TW.conf.legendsBins bins
// @sortedValues array, mandatory
function intervalsInventory(sortedValues) {
var binmins = []
var len = sortedValues.length
for (var l=0 ; l < TW.conf.legendsBins ; l++) {
let nthVal = Math.floor(len * l / TW.conf.legendsBins)
binmins.push(sortedValues[nthVal])
}
// console.info("legendRefTicks", binmins)
return binmins
}
function RunLouvain() {
var node_realdata = []
......@@ -139,8 +118,14 @@ function RunLouvain() {
}
var community = jLouvain().nodes(node_realdata).edges(edge_realdata);
var results = community();
for(var i in results)
TW.Nodes[i].attributes["clust_louvain"]=results[i]
for(var i in results) {
let n = TW.partialGraph.graph.nodes(i)
if (n) {
n.attributes["clust_louvain"] = results[i]
// TW.Nodes[i].attributes["clust_louvain"]=results[i]
}
}
}
......@@ -213,17 +198,6 @@ function SomeEffect( ValueclassCode ) {
}
}
// // force 3 first labels
// for(var j in nodes_2_label) {
// if(j==3)
// break
// var ID = nodes_2_label[j].key
// TW.partialGraph.graph.nodes(ID).customAttrs.forceLabel = true;
// }
// TW.gui.selectionActive=true;
TW.partialGraph.refresh()
}
......@@ -338,38 +312,6 @@ function set_ClustersLegend ( daclass, groupedByTicks ) {
// = = = = = = = = = = = [ / Clusters Plugin ] = = = = = = = = = = = //
//For CNRS
// function getTopPapers(type){
// if(TW.conf.getRelatedDocs){
// console.log("getTopPapers")
// jsonparams=JSON.stringify(getSelections());
// bi=(Object.keys(categories).length==2)?1:0;
// //jsonparams = jsonparams.replaceAll("&","__and__");
// jsonparams = jsonparams.split('&').join('__and__');
// //dbsPaths.push(getGlobalDBs());
// thisgexf=JSON.stringify(decodeURIComponent(getUrlParam.file));
// image='<img style="display:block; margin: 0px auto;" src="'+TW.conf.relatedDocsAPI+'img/ajax-loader.gif"></img>';
// $("#tab-container-top").show();
// $("#topPapers").show();
// $("#topPapers").html(image);
// $.ajax({
// type: 'GET',
// url: TW.conf.relatedDocsAPI+'info_div.php',
// data: "type="+nodetype+"&bi="+bi+"&query="+jsonparams+"&gexf="+thisgexf+"&index="+TW.field[getUrlParam.file],
// //contentType: "application/json",
// //dataType: 'json',
// success : function(data){
// console.log(TW.conf.relatedDocsAPI+'info_div.php?'+"type="+nodetype+"&bi="+bi+"&query="+jsonparams+"&gexf="+thisgexf+"&index="+TW.field[getUrlParam.file]);
// $("#topPapers").html(data);
// },
// error: function(){
// console.log('Page Not found: getTopPapers');
// }
// });
// }
// }
// a custom variant of twitter plugin written for politoscope
// NB: this variant only for nodetype semantic
function getTopPapers(nodetypeLegacy){
......@@ -516,60 +458,6 @@ function RenderTweet( tweet) {
return html;
}
//JUST ADEME
function camaraButton(){
$("#PhotoGraph").click(function (){
//canvas=TW.partialGraph._core.domElements.nodes;
var nodesCtx = TW.partialGraph._core.domElements.nodes;
/*
var edgesCtx = document.getElementById("sigma_edges_1").getContext('2d');
var edgesImg = edgesCtx.getImageData(0, 0, document.getElementById("sigma_edges_1").width, document.getElementById("sigma_edges_1").height)
nodesCtx.putImageData(edgesImg,0,0);
//ctx.drawImage(TW.partialGraph._core.domElements.edges,0,0)
//var oCanvas = ctx;
*/
//div = document.getElementById("sigma_nodes_1").getContext('2d');
//ctx = div.getContext("2d");
//oCanvas.drawImage(TW.partialGraph._core.domElements.edges,0,0);
Canvas2Image.saveAsPNG(nodesCtx);
/*
Canvas2Image.saveAsJPEG(oCanvas); // will prompt the user to save the image as JPEG.
// Only supported by Firefox.
Canvas2Image.saveAsBMP(oCanvas); // will prompt the user to save the image as BMP.
// returns an <img> element containing the converted PNG image
var oImgPNG = Canvas2Image.saveAsPNG(oCanvas, true);
// returns an <img> element containing the converted JPEG image (Only supported by Firefox)
var oImgJPEG = Canvas2Image.saveAsJPEG(oCanvas, true);
// returns an <img> element containing the converted BMP image
var oImgBMP = Canvas2Image.saveAsBMP(oCanvas, true);
// all the functions also takes width and height arguments.
// These can be used to scale the resulting image:
// saves a PNG image scaled to 100x100
Canvas2Image.saveAsPNG(oCanvas, false, 100, 100);
*/
});
}
function getTips(){
param='';
......@@ -601,21 +489,6 @@ function getTips(){
}
function draw1Circle(ctx , x , y , color) {
ctx.strokeStyle = '#000';
ctx.lineWidth = 1;
ctx.fillStyle = color;
ctx.globalAlpha = 0.5;
ctx.beginPath();
ctx.arc(x, y, 10, 0, Math.PI * 2, true);
ctx.closePath();
ctx.fill();
ctx.stroke();
}
// show Selector circle
// --------------------
// new sigma.js: could be replaced by default _moveHandler with bindings ?
......@@ -745,31 +618,6 @@ function circleLocalSubset(camX0, camY0 , camRay) {
}
// not used but useful to quickly make visible any nodes[]
function flashNodesArray (nodesArray) {
// for diagnostic
var minX = 1000000
var minY = 1000000
var maxX = 0
var maxY = 0
for (var j in nodesArray) {
var n = nodesArray[j]
if (minX > n.x) minX = n.x
if (minY > n.y) minY = n.y
if (maxX < n.x) maxX = n.x
if (maxY < n.y) maxY = n.y
n.size = 300
n.label = "> " + n.label + "< "
n.color = "yellow"
}
console.log("nodesArray encompassed by:", minX, minY,';', maxX, maxY)
TW.partialGraph.render()
}
// BASIC MODULARITY
// =================
// activateModules is for adding/removing features from TinawebJS
......
......@@ -89,36 +89,6 @@
}
/*.btn-sm[normal] {*/
/* background-image: -webkit-linear-gradient(#5f8ab9, #3e648d 50%, #385a7f);*/
/* background-image: linear-gradient(#5f8ab9, #3e648d 50%, #385a7f);*/
/* background-repeat: no-repeat;*/
/* filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5f8ab9', endColorstr='#ff385a7f', GradientType=0);*/
/* filter: none;*/
/* border: 1px solid #2e4b69;*/
/*}*/
.panel-heading a:before {
font-family:'Glyphicons Halflings';
content:"\e114 ";
float: right;
color: #E3A13D;
}
.panel-heading a {
text-decoration: none !important;
}
.panel-heading a.collapsed:before {
font-family:'Glyphicons Halflings';
content:"\e114 ";
float: right;
color:grey;
}
/* ZOOMBAR */
#ctlzoom {
......@@ -139,8 +109,6 @@
text-align: center;
}
#zoomSliderzone {
}
.zoombarbuttons {
position:relative; /* b/c they can contain absolute wait icon */
......@@ -150,12 +118,6 @@
opacity: .7;
}
#edgesButton {
display: block;
width: 24px;
height: 24px;
margin: 0 auto;
}
#zoomMinusButton, #zoomPlusButton {
display: block;
width: 24px;
......@@ -189,11 +151,6 @@
#aUnfold {
display: none; width: 12px; height: 12px; background-image: url("../img2/fleches-horiz.png"); margin: 0 auto;
}
/*
#saveAs {
display: block; width: 30px; height: 30px; background:url("../libs/img2/Save.png"); margin: 0 auto;
}
*/
#zoomSlider {
background:#fff;
......@@ -201,16 +158,6 @@
height: 90px; margin: 0 auto;
}
#showChat{
position: absolute; top: 16px; right: -14px; width: 20px; height: 100px; background: rgb(250, 250, 252); padding: 2px 2px 2px 0; border-top-left-radius: 5px; border-bottom-left-radius: 5px; box-shadow: 1px 1px 2px #808090;
}
#aShowChat {
float: right; width: 100%; height: 100%; background-image: url("../libs/img2/chat.png");
}
/* GESTION DES PAVES DE GAUCHE (conteneur encore vide)*/
#lefttopbox {
position:fixed;
......
......@@ -190,32 +190,6 @@ html.waiting {
-border-radius: 3px;
}
#topProposals{
display: none;
margin: 7px;
padding: 10px 0px 10px 10px;
border-style:solid;
background-color:white;
color:black;
margin: 7px;
border: 1px solid #666;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-border-radius: 3px;
-moz-box-shadow: 0px 2px 6px #000;
-webkit-box-shadow: 0px 2px 6px #000;
box-shadow: 0px 2px 6px #000;
}
.category1 {
display: none; /* initial display off but turned on when changetype */
}
.grey {
color: #cccccc; font-style: italic;
}
/* small messages */
p.micromessage{
font-size: 85%;
......
......@@ -82,11 +82,11 @@ function SelectionEngine() {
}
else {
var id_node = '';
var results = find(string)
var resultNids = find(string)
var coincd=[]
for(var i in results) {
coincd.push(results[i].id)
for(var i in resultNids) {
coincd.push(resultNids[i])
}
var targeted = this.SelectorEngine( {
addvalue:TW.gui.checkBox,
......
......@@ -1027,54 +1027,27 @@ function updateSearchLabels(id,name,type){
});
}
function extractContext(string, context) {
var matched = string.toLowerCase().indexOf(context.toLowerCase());
if (matched == -1)
return string.slice(0, 20) + '...';
var begin_pts = '...', end_pts = '...';
if (matched - 20 > 0) {
var begin = matched - 20;
} else {
var begin = 0;
begin_pts = '';
}
if (matched + context.length + 20 < string.length) {
var end = matched + context.length + 20;
} else {
var end = string.length;
end_pts = '';
}
//============================ < / SEARCH > ============================//
str = string.slice(begin, end);
if (str.indexOf(" ") != Math.max(str.lastIndexOf(" "), str.lastIndexOf(".")))
str = str.slice(str.indexOf(" "), Math.max(str.lastIndexOf(" "), str.lastIndexOf(".")));
//============================= < OTHER ACTIONS > =============================//
function createWaitIcon(idname, width) {
let icon = document.createElement('img')
return begin_pts + str + end_pts;
}
icon.src = TW.conf.libspath + '/img2/loader.gif'
icon.style.position = 'absolute'
icon.style.left = '0'
icon.style.width = width || '100%'
// TODO check duplicate function with sigmaUtils exactfind()
function searchLabel(string){
var id_node = '';
var n;
if (idname) {
icon.id = idname
}
nds = TW.partialGraph._core.graph.nodes.filter(function(x){return !x["hidden"]});
for(var i in nds){
n = nds[i]
if (n.label == string) {
return n;
}
}
return icon
}
//============================ < / SEARCH > ============================//
//============================= < OTHER ACTIONS > =============================//
function jsActionOnGexfSelector(gexfBasename){
let gexfPath = TW.gexfPaths[gexfBasename] || gexfBasename+".gexf"
let serverPrefix = ''
......
......@@ -52,17 +52,6 @@ var AjaxSync = function(args) {
return Result;
}
function getClientTime(){
var totalSec = new Date().getTime() / 1000;
var d = new Date();
var hours = d.getHours();
var minutes = parseInt( totalSec / 60 ) % 60;
var seconds = (totalSec % 60).toFixed(4);
var result = (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds);
return result;
}
function compareNumbers(a, b) {
return a - b;
}
......@@ -71,11 +60,6 @@ function isNumeric(a) {
return parseFloat(a) == a ;
}
// seconds since page load
function tstamp() {
return parseInt(performance.now()) ;
}
//python range(a,b) | range(a)
function calc_range(begin, end) {
if (typeof end === "undefined") {
......@@ -88,40 +72,40 @@ function calc_range(begin, end) {
return result;
}
//to general utils (not used btw)
function cloneObject(source) {
for (i in source) {
if (typeof source[i] == 'source') {
this[i] = new cloneObject(source[i]);
}
else{
this[i] = source[i];
}
}
}
function isUndef(variable){
if(typeof(variable)==="undefined") return true;
else return false;
}
$.fn.toggleClick = function(){
methods = arguments, // store the passed arguments for future reference
count = methods.length; // cache the number of methods
function stringToSomeInt (anyString) {
let charCodeSum = 0
for (let i = 0 ; i < anyString.length ; i++) {
charCodeSum += anyString.charCodeAt(i)
}
return charCodeSum
}
//use return this to maintain jQuery chainability
return this.each(function(i, item){
// for each element you bind to
index = 0; // create a local counter for that element
$(item).click(function(){ // bind a click handler to that element
return methods[index++ % count].apply(this,arguments); // that when called will apply the 'index'th method to that element
// the index % count means that we constrain our iterator between 0 and (count-1)
});
});
};
// shuffle algo from stackoverflow.com/a/6274398/2489184
function shuffle(array) {
var counter = array.length;
// While there are elements in the array
while (counter > 0) {
// Pick a random index
let index = Math.floor(Math.random() * counter);
// Decrease counter by 1
counter--;
// And swap the last element with it
let temp = array[counter];
array[counter] = array[index];
array[index] = temp;
}
return array;
}
getUrlParam = (function () {
var get = {
......@@ -207,24 +191,11 @@ function ArraySortByValue(array, sortFunc){
}
function is_empty(obj) {
// Assume if it has a length property with a non-zero value
// that that property is correct.
if (obj.length && obj.length > 0) return false;
if (obj.length && obj.length === 0) return true;
for (var key in obj) {
if (hasOwnProperty.call(obj, key)) return false;
}
return true;
}
function getByID(elem) {
return document.getElementById(elem);
}
// NB: check if we could use sigma.plugins.animate.parseColor instead
// hex can be RGB (3 or 6 chars after #) or RGBA (4 or 8 chars)
function hex2rgba(sent_hex) {
if (!sent_hex) {
......@@ -347,6 +318,7 @@ var linkCheck = function(url) {
/**
* function to load a given css file
* cf. activateModules()
*/
loadCSS = function(href) {
var cssLink = $("<link rel='stylesheet' type='text/css' href='"+href+"'>");
......@@ -355,6 +327,7 @@ var linkCheck = function(url) {
/**
* function to load a given js file
* cf. activateModules()
*/
loadJS = function(src) {
var jsLink = $("<script type='text/javascript' src='"+src+"'>");
......
This diff is collapsed.
......@@ -212,7 +212,6 @@ function scanGexf(gexfContent) {
// (current expected structure in 'categories' can only accomodate 2 types
// and the way it and catDict are used is not entirely coherent throughout
// the project, cf. among others: - the effect on 'typestring'
// - the effect on 'swclickActual'
// - the way default cat is handled as 0...)
// -------------------
// expected content: usually a just a few cats over all nodes
......@@ -982,103 +981,6 @@ function updateValueFacets(facetIdx, aNode, optionalFilter) {
}
// creates and updates nodes1 nodes2 and bipartiteN2D and bipartiteD2N
// but seems useless because all info is already in each nodes.type and edge.categ
// (especially when changeType uses a loop on all nodes anyway)
// (was previously done at the same time that updateRelations)
// (could be restored if we needed faster changeType)
function sortNodesByTypeDeprecated() {
// Doc <-> Doc
// if(srcType==categories[0] && tgtType==categories[0] ) {
//
// edge.label = "nodes1";
// if(isUndef(nodes1[source])) {
// nodes1[source] = {
// label: nodes[source].label,
// neighbours: []
// };
// }
// if(isUndef(nodes1[target])) {
// nodes1[target] = {
// label: nodes[target].label,
// neighbours: []
// };
// }
// nodes1[source].neighbours.push(target);
// nodes1[target].neighbours.push(source);
// }
//
// if(categories.length>1) {
//
// // Term <-> Term
// if(srcType==categories[1] && tgtType==categories[1]){
// edge.label = "nodes2";
//
// if(isUndef(nodes2[source])) {
// nodes2[source] = {
// label: nodes[source].label,
// neighbours: []
// };
// }
// if(isUndef(nodes2[target])) {
// nodes2[target] = {
// label: nodes[target].label,
// neighbours: []
// };
// }
// nodes2[source].neighbours.push(target);
// nodes2[target].neighbours.push(source);
// }
//
// // Doc <-> Term
// if((srcType==categories[0] && tgtType==categories[1]) ||
// (srcType==categories[1] && tgtType==categories[0])) {
// edge.label = "bipartite";
//
// // // Source is Document
// if(srcType == categories[0]) {
//
// 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);
// }
// }
// }
}
// Level-00
function scanJSON( data ) {
......
......@@ -574,89 +574,11 @@ var SigmaUtils = function () {
} // /SigmaUtils object
function createWaitIcon(idname, width) {
let icon = document.createElement('img')
icon.src = TW.conf.libspath + '/img2/loader.gif'
icon.style.position = 'absolute'
icon.style.left = '0'
icon.style.width = width || '100%'
if (idname) {
icon.id = idname
}
return icon
}
//
// //for socialgraph
// function showMeSomeLabels(N){
// // NB why is this not using methods.manualForceLabel ?!
//
// /*======= Show some labels at the beginning =======*/
// var minIn=50,
// maxIn=0,
// minOut=50,
// maxOut=0;
//
// // new sigma.js accessor
// var allNodes = TW.partialGraph.graph.nodes()
// for( j=0 ; j < allNodes.length ; j++ ) {
// n = allNodes[j]
// if(n.hidden==false){
// if(parseInt(n.inDegree) < minIn) minIn= n.inDegree;
// if(parseInt(n.inDegree) > maxIn) maxIn= n.inDegree;
// if(parseInt(n.outDegree) < minOut) minOut= n.outDegree;
// if(parseInt(n.outDegree) > maxOut) maxOut= n.outDegree;
// }
// }
// counter=0;
// n = getVisibleNodes();
// for(i=0;i<n.length;i++) {
// if(n[i].hidden==false){
// if(n[i].inDegree==minIn && n[i].customAttrs.forceLabel==false) {
// n[i].customAttrs.forceLabel=true;
// counter++;
// }
// if(n[i].inDegree==maxIn && n[i].customAttrs.forceLabel==false) {
// n[i].customAttrs.forceLabel=true;
// counter++;
// }
// if(n[i].outDegree==minOut && n[i].customAttrs.forceLabel==false) {
// n[i].customAttrs.forceLabel=true;
// counter++;
// }
// if(n[i].outDegree==maxOut && n[i].customAttrs.forceLabel==false) {
// n[i].customAttrs.forceLabel=true;
// counter++;
// }
// if(counter==N) break;
// }
// }
// // new sigma.js
// TW.partialGraph.render();
// /*======= Show some labels at the beginning =======*/
// }
// ===============================
// GLOBAL-SCOPE (window) variables
// (TODO REFA make them inside TW.- ns)
// getnodes => preferably use TW.partialGraph.graph.nodes(some_node_id) as accessor
// (not often necessary + costly in mem because is a clone)
function getnodes(){
// new sigma.js
return TW.partialGraph.graph.nodes();
}
// idem
function getedges(){
return TW.partialGraph.graph.edges();
}
// used for saving to gexf
function getVisibleEdges() {
// new sigma js POSS custom index to avoid loop
......@@ -673,29 +595,21 @@ function getVisibleNodes() {
});
}
function getNodesByAtt(att) {
return TW.partialGraph.graph.nodes().filter(function(n) {
return n['type']==att;
});
}
// fulltext search handler for #searchinput
function find(lquery){
var results=[];
if (typeof lquery == 'string' && lquery.length > 0) {
lquery=lquery.toLowerCase() ;
var nds = getnodes()
// console.log("FIND: looking among nodes", nds)
for(var i in nds){
var n=nds[i];
if(! n.hidden){
var possiblematch=n.label.toLowerCase()
// console.log("FIND: looking among TW.labels", TW.labels)
for(var i in TW.labels){
var labObj = TW.labels[i]
if(labObj && labObj.label){
var possiblematch = labObj.label.toLowerCase()
// ------------------
// substring search
// ------------------
if (possiblematch.indexOf(lquery)!==-1) {
results.push(n);
results.push(labObj.id);
}
}
}
......@@ -703,21 +617,6 @@ function find(lquery){
return results;
}
function exactfind(label) {
if (typeof lquery == 'string' && lquery.length > 0) {
for(var i in TW.nodeIds){
n=TW.partialGraph.graph.nodes(TW.nodeIds[i]);
if(!n.hidden){
if (n.label==label) {
return n;
}
}
}
}
return null;
}
function getNodeLabels(elems){
var labelss=[]
for(let i in elems){
......@@ -735,50 +634,6 @@ function getSelections(){
return selLabels;
}
//This receives an array not a dict!
// i added an excpt... why
function getNeighs(sels,arr) {
neighDict={};
for(var i in sels) {
id = sels[i]
if(!isUndef(arr[id])) {
A=arr[id].neighbours;
for(var j in A){
neighDict[A[j]]=1
}
neighDict[id]=1;
}
}
return Object.keys(neighDict);
}//It returns an array not a dict!
//Using bipartiteN2D or bipartiteD2N
//This receives an array not a dict!
function getNeighs2(sels,arr){
neighDict={};
for(var i in sels) {
id = sels[i]
if(!isUndef(arr[id])) {
A=arr[id].neighbours;
for(var j in A){
neighDict[A[j]]=1
}
// neighDict[id]=1;
}
}
return Object.keys(neighDict);
}//It returns an array not a dict!
//to general utils
function getArrSubkeys(arr,id) {
var result = []
for(var i in arr) {
result.push(arr[i][id])
}
return result;
}
// for logs
function edgeInfos(anEdge) {
return `${anEdge.id} (${TW.Nodes[anEdge.source].label} -> ${TW.Nodes[anEdge.target].label})` ;
......@@ -1090,41 +945,3 @@ function clusterColoring(daclass) {
set_ClustersLegend ( daclass )
TW.partialGraph.render();
}
function stringToSomeInt (anyString) {
let charCodeSum = 0
for (let i = 0 ; i < anyString.length ; i++) {
charCodeSum += anyString.charCodeAt(i)
}
return charCodeSum
}
//just for fun
function makeEdgeWeightUndef() {
for(var e in TW.partialGraph._core.graph.edges) {
TW.partialGraph._core.graph.edges[e].weight=1;
}
}
// shuffle algo from stackoverflow.com/a/6274398/2489184
function shuffle(array) {
var counter = array.length;
// While there are elements in the array
while (counter > 0) {
// Pick a random index
let index = Math.floor(Math.random() * counter);
// Decrease counter by 1
counter--;
// And swap the last element with it
let temp = array[counter];
array[counter] = array[index];
array[index] = temp;
}
return array;
}
......@@ -23,9 +23,6 @@ p.Tweet-text {
min-height: 90px !important;
}
.SandboxRoot { display: none !important; }
blockquote.Tweet a {
color: inherit !important;
font-weight: normal !important;
......
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