Commit b8123669 authored by Romain Loth's avatar Romain Loth

remove only trailing spaces

parent e1b6143a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// ==================== // ====================
// Allows suggestions from search box // Allows suggestions from search box
// Our module_name is simultaneously 3 things: // Our module_name is simultaneously 3 things:
// - a DivsFlag for settings_explorerjs // - a DivsFlag for settings_explorerjs
// - our current dir for this module's files (and this init.js) // - our current dir for this module's files (and this init.js)
// - the class of module's html elements // - the class of module's html elements
......
...@@ -24,7 +24,7 @@ $("#searchinput").on("tw:eraseNodeSet", function(e) { ...@@ -24,7 +24,7 @@ $("#searchinput").on("tw:eraseNodeSet", function(e) {
// emptyNodeSet event when Tinawab had a search but with no matches // emptyNodeSet event when Tinawab had a search but with no matches
$("#searchinput").on("tw:emptyNodeSet", function(e) { $("#searchinput").on("tw:emptyNodeSet", function(e) {
$('#savesuggestion').prop('disabled', false) ; $('#savesuggestion').prop('disabled', false) ;
// when query has no match // when query has no match
if (e.nodeIds == null || e.nodeIds.length == 0) { if (e.nodeIds == null || e.nodeIds.length == 0) {
...@@ -59,12 +59,12 @@ function save_suggestions(term) { ...@@ -59,12 +59,12 @@ function save_suggestions(term) {
"data" : term, "data" : term,
"date" : (new Date()).toISOString(), "date" : (new Date()).toISOString(),
} }
// sqlite columns in new table 'terms' // sqlite columns in new table 'terms'
// 0|source|CHAR(250)|0||0 // 0|source|CHAR(250)|0||0
// 1|suggestion|CHAR(250)|0||0 // 1|suggestion|CHAR(250)|0||0
// 2|time|CHAR(30)|0||0 // 2|time|CHAR(30)|0||0
// console.log( "SAVE INFO:" + info ) // console.log( "SAVE INFO:" + info )
$.ajax({ $.ajax({
type: "POST", type: "POST",
...@@ -84,21 +84,21 @@ function save_suggestions(term) { ...@@ -84,21 +84,21 @@ function save_suggestions(term) {
p.append(i); p.append(i);
p.append(' was saved as a suggestion'); p.append(' was saved as a suggestion');
$("#crowdsourcing_answer").html(p) ; $("#crowdsourcing_answer").html(p) ;
// show "saved" icon // show "saved" icon
$("#saveicon").removeClass("glyphicon-save"); $("#saveicon").removeClass("glyphicon-save");
$("#saveicon").addClass("glyphicon-saved"); $("#saveicon").addClass("glyphicon-saved");
// reset state after 3 secs // reset state after 3 secs
setTimeout(function() { setTimeout(function() {
clean_crowdsourcingzone() ; clean_crowdsourcingzone() ;
// if we want to reset the input value too // if we want to reset the input value too
// $("#proposed_terms").val('') ; // $("#proposed_terms").val('') ;
}, 3000); }, 3000);
}, },
error: function(exception) { error: function(exception) {
console.log(exception) console.log(exception)
console.log("exception!:"+exception.status) console.log("exception!:"+exception.status)
} }
...@@ -134,11 +134,11 @@ function clean_crowdsourcingzone() { ...@@ -134,11 +134,11 @@ function clean_crowdsourcingzone() {
//~ }, 3000); //~ }, 3000);
//~ }, 1000); //~ }, 1000);
//~ }, //~ },
//~ //~
//~ error: function(exception) { //~ error: function(exception) {
//~ console.log(exception) //~ console.log(exception)
//~ console.log("exception!:"+exception.status) //~ console.log("exception!:"+exception.status)
//~ } //~ }
//~ //~
//~ }) //~ })
//~ } //~ }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<title>Mapping risk research</title> <title>Mapping risk research</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="libs/jquery/jquery-ui.css" media="screen"> <link rel="stylesheet" href="libs/jquery/jquery-ui.css" media="screen">
<link rel="stylesheet" href="libs/bootstrap/css/bootstrap.css" media="screen"> <link rel="stylesheet" href="libs/bootstrap/css/bootstrap.css" media="screen">
<link rel="stylesheet" href="libs/css2/freshslider.css" media="screen"> <link rel="stylesheet" href="libs/css2/freshslider.css" media="screen">
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<span id="network" ></span> <span id="network" ></span>
</a> </a>
</li> </li>
<li> <li>
<div id="log"></div> <div id="log"></div>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<div id="left" class="col-sm-8 col-md-8 col-lg-6" > <div id="left" class="col-sm-8 col-md-8 col-lg-6" >
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<!-- <!--
<li> <li>
<a> <a>
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
<button type="button" id="changetype" class="btn btn-success btn-sm">Change Type</button> <button type="button" id="changetype" class="btn btn-success btn-sm">Change Type</button>
</a> </a>
</li> </li>
<li> <li>
<a> <a>
<button type="button" id="changelevel" class="btn btn-info btn-sm" disabled>Change Level</button> <button type="button" id="changelevel" class="btn btn-info btn-sm" disabled>Change Level</button>
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
Selector size<br> Selector size<br>
<div id="unranged-value" class="settingslider"></div> <div id="unranged-value" class="settingslider"></div>
</a></li> </a></li>
<li><a> <li><a>
<!-- TODO fix: category0 -> category1 switching --> <!-- TODO fix: category0 -> category1 switching -->
Label size<br> Label size<br>
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
</ul> </ul>
</a></li> </a></li>
</ul> </ul>
</div><!-- /div#left --> </div><!-- /div#left -->
<div id="right" class="col-sm-3 col-md-4 col-lg-6" > <div id="right" class="col-sm-3 col-md-4 col-lg-6" >
...@@ -150,37 +150,37 @@ ...@@ -150,37 +150,37 @@
<button id="savesuggestion" <button id="savesuggestion"
disabled disabled
title="Save this topic as a new suggestion" title="Save this topic as a new suggestion"
class="btn btn-default" class="btn btn-default"
type="button"> type="button">
<span class="glyphicon glyphicon-save" <span class="glyphicon glyphicon-save"
id="saveicon"> id="saveicon">
</span> </span>
</button> </button>
</span> </span>
<span class="input-group-btn"> <span class="input-group-btn">
<button id="searchbutton" <button id="searchbutton"
title="Search the topic in the map" title="Search the topic in the map"
class="btn btn-info" class="btn btn-info"
type="button"> type="button">
<span class="glyphicon glyphicon-search"> <span class="glyphicon glyphicon-search">
</span> </span>
</button> </button>
</span> </span>
<!-- ########## THE SEARCH BAR ########## --> <!-- ########## THE SEARCH BAR ########## -->
<input id="searchinput" <input id="searchinput"
type="text" type="text"
class="form-control" class="form-control"
placeholder="Select node(s)" /> placeholder="Select node(s)" />
<!-- strSearchBar will replace placeholder value --> <!-- strSearchBar will replace placeholder value -->
<!-- #################################### --> <!-- #################################### -->
</div> </div>
<!-- messages below the search bar --> <!-- messages below the search bar -->
<!-- say thanks for the suggestion, etc. --> <!-- say thanks for the suggestion, etc. -->
<div id="crowdsourcing_answer" class="crowdsourcingModule"></div> <div id="crowdsourcing_answer" class="crowdsourcingModule"></div>
...@@ -189,11 +189,11 @@ ...@@ -189,11 +189,11 @@
<div class="col-sm-3 col-md-3 col-lg-5"> <div class="col-sm-3 col-md-3 col-lg-5">
<input id="checkboxdiv" onclick="alertCheckBox(this);" <input id="checkboxdiv" onclick="alertCheckBox(this);"
title="Add next search results to current selection" title="Add next search results to current selection"
class="btn btn-info" class="btn btn-info"
type="checkbox"></input> type="checkbox"></input>
<p style="font-size:75%; line-height:90%">Add to selection</p> <p style="font-size:75%; line-height:90%">Add to selection</p>
</div> </div>
</div> </div>
<!-- <!--
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
</ul> </ul>
--> -->
</div> </div>
</div><!-- /.row#defaultop --> </div><!-- /.row#defaultop -->
</div><!-- /.container.fluid --> </div><!-- /.container.fluid -->
<!-- £TODO wtf </div> --> <!-- £TODO wtf </div> -->
...@@ -224,14 +224,14 @@ ...@@ -224,14 +224,14 @@
<!-- selected nodes --> <!-- selected nodes -->
<div class="row"> <div class="row">
<button id="unselectbutton" <button id="unselectbutton"
style="color: #900;font-weight: bold;font-size: 70%;text-transform: uppercase;float:right;margin-right:.5em" style="color: #900;font-weight: bold;font-size: 70%;text-transform: uppercase;float:right;margin-right:.5em"
onClick='cancelSelection(false);' onClick='cancelSelection(false);'
title="Unselect these terms"> title="Unselect these terms">
<span class="glyphicon glyphicon-remove" alt="X"></span> <span class="glyphicon glyphicon-remove" alt="X"></span>
</button> </button>
<div id="names"></div> <div id="names"></div>
</div> </div>
<!-- histogram of selected nodes --> <!-- histogram of selected nodes -->
<div class="row histogramModule"> <div class="row histogramModule">
<!-- filled by query (user search value) to wos api --> <!-- filled by query (user search value) to wos api -->
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
<div id="zonecentre"> <div id="zonecentre">
<!-- Page content --> <!-- Page content -->
<div id="sigma-example"></div> <div id="sigma-example"></div>
...@@ -266,14 +266,14 @@ ...@@ -266,14 +266,14 @@
<div id="unfold"> <div id="unfold">
<a href="#" id="aUnfold" class="rightarrow"></a> <a href="#" id="aUnfold" class="rightarrow"></a>
</div> </div>
</li> </li>
<!-- <!--
<li> <li>
<a href="#" id="geomapicon" onclick="$('#geomapmodal').modal('show'); callGeomapADEME();"> <a href="#" id="geomapicon" onclick="$('#geomapmodal').modal('show'); callGeomapADEME();">
<img title="World Map Distribution" width="34px" src="libs/img2/world.png"></img> <img title="World Map Distribution" width="34px" src="libs/img2/world.png"></img>
</a> </a>
</li> </li>
--> -->
<li> <li>
...@@ -281,13 +281,13 @@ ...@@ -281,13 +281,13 @@
<img title="Take a photo!" width="34px" src="libs/img2/camera.png"></img> <img title="Take a photo!" width="34px" src="libs/img2/camera.png"></img>
</a> </a>
</li> </li>
<li> <li>
<a href="#" id="saveAs"> <a href="#" id="saveAs">
<img width="30px" title="Save As..." src="libs/img2/save.png"></img> <img width="30px" title="Save As..." src="libs/img2/save.png"></img>
</a> </a>
</li> </li>
<li> <li>
<a href="#" id="zoomPlusButton" title="S'approcher"> </a> <a href="#" id="zoomPlusButton" title="S'approcher"> </a>
</li> </li>
...@@ -334,21 +334,21 @@ ...@@ -334,21 +334,21 @@
</div> </div>
<div id="topPapers" style="display: none;"></div> <div id="topPapers" style="display: none;"></div>
<div id="information"></div> <div id="information"></div>
<!-- <!--
bottom right column as panels bottom right column as panels
open/close panel from: jsfiddle.net/KyleMit/kcpma open/close panel from: jsfiddle.net/KyleMit/kcpma
--> -->
<div class="panel-group" id="accordion"> <div class="panel-group" id="accordion">
<div class="panel panel-default" id="video_explanation"> <div class="panel panel-default" id="video_explanation">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<a data-toggle="collapse" data-target="#le_tutorial" <a data-toggle="collapse" data-target="#le_tutorial"
href="#"> href="#">
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
&nbsp;Tutorial video &nbsp;Tutorial video
...@@ -358,7 +358,7 @@ ...@@ -358,7 +358,7 @@
<div class="panel-collapse collapse" id="le_tutorial"> <div class="panel-collapse collapse" id="le_tutorial">
<!-- TODO: outcloud the video for better stream+player --> <!-- TODO: outcloud the video for better stream+player -->
<video width="100%" <video width="100%"
src="video/AXA2015.mp4" controls="" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></video> src="video/AXA2015.mp4" controls="" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></video>
</div> </div>
</div> </div>
...@@ -366,7 +366,7 @@ ...@@ -366,7 +366,7 @@
<div class="panel panel-default" id="tips_panel"> <div class="panel panel-default" id="tips_panel">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<a data-toggle="collapse" data-target="#tips" <a data-toggle="collapse" data-target="#tips"
href="#"> href="#">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
&nbsp;Tips &nbsp;Tips
...@@ -380,7 +380,7 @@ ...@@ -380,7 +380,7 @@
<div class="panel panel-default" id="credits_panel"> <div class="panel panel-default" id="credits_panel">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<a data-toggle="collapse" data-target="#credits" <a data-toggle="collapse" data-target="#credits"
href="#"> href="#">
<span class="glyphicon glyphicon-flag" aria-hidden="true"></span> <span class="glyphicon glyphicon-flag" aria-hidden="true"></span>
&nbsp;Credits &nbsp;Credits
...@@ -400,13 +400,13 @@ ...@@ -400,13 +400,13 @@
style="width:85%; "> style="width:85%; ">
</a> </a>
</div> </div>
</div> </div>
</div> </div>
<br><br><br><br><br><br> <br><br><br><br><br><br>
</div> </div>
<div id="savemodal" class="modal fade"> <div id="savemodal" class="modal fade">
...@@ -468,7 +468,7 @@ ...@@ -468,7 +468,7 @@
</div> </div>
</div> </div>
</div> </div>
<div id="modalloader" class="modal fade"> <div id="modalloader" class="modal fade">
...@@ -491,12 +491,12 @@ ...@@ -491,12 +491,12 @@
</div> </div>
<!-- </div> --> <!-- </div> -->
<!-- <div class="geomapCont"></div> --> <!-- <div class="geomapCont"></div> -->
<div id="closegeomap" data-dismiss="modal"></div> <div id="closegeomap" data-dismiss="modal"></div>
</div> </div>
<div id="heatgraph"></div> <div id="heatgraph"></div>
<!-- <div id="twittertimeline_div"></div> --> <!-- <div id="twittertimeline_div"></div> -->
<script src="libs/jquery/jquery-1.10.2.js" type="text/javascript"></script> <script src="libs/jquery/jquery-1.10.2.js" type="text/javascript"></script>
<script src="libs/jquery/jquery-ui.js" type="text/javascript"></script> <script src="libs/jquery/jquery-ui.js" type="text/javascript"></script>
<script src="libs/jquery/jquery.ba-dotimeout.min.js" type="text/javascript"></script> <script src="libs/jquery/jquery.ba-dotimeout.min.js" type="text/javascript"></script>
...@@ -505,12 +505,12 @@ ...@@ -505,12 +505,12 @@
<script type="text/javascript" src="libs/freshslider.1.0.js"></script> <script type="text/javascript" src="libs/freshslider.1.0.js"></script>
<script src="libs/readmore.js" type="text/javascript"></script> <script src="libs/readmore.js" type="text/javascript"></script>
<script src="libs/jquery/jquery.easytabs.min.js" type="text/javascript"></script> <script src="libs/jquery/jquery.easytabs.min.js" type="text/javascript"></script>
<script src="libs/bootstrap/js/bootstrap.min.js"></script> <script src="libs/bootstrap/js/bootstrap.min.js"></script>
<script src="libs/bootswatch/js/bootswatch.js"></script> <script src="libs/bootswatch/js/bootswatch.js"></script>
<script src="libs/bootstrap/js/bootstrap-modal.js" type="text/javascript"></script> <script src="libs/bootstrap/js/bootstrap-modal.js" type="text/javascript"></script>
<script src="libs/bootstrap/js/bootstrap-hover-dropdown.min.js" type="text/javascript"></script> <script src="libs/bootstrap/js/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="tinawebJS/globalUtils.js" type="text/javascript"></script> <script src="tinawebJS/globalUtils.js" type="text/javascript"></script>
...@@ -522,7 +522,7 @@ ...@@ -522,7 +522,7 @@
<link rel="stylesheet" type="text/css" href="geomap/css/geo.css" /> <link rel="stylesheet" type="text/css" href="geomap/css/geo.css" />
--> -->
<!--<script src="geomap/js/countries_iso3166.js" charset="utf-8" ></script>--> <!--<script src="geomap/js/countries_iso3166.js" charset="utf-8" ></script>-->
<script type="text/javascript" src="tinawebJS/jLouvain.js"></script> <script type="text/javascript" src="tinawebJS/jLouvain.js"></script>
<script src="tinawebJS/sigma.min.js" type="text/javascript" language="javascript"></script> <script src="tinawebJS/sigma.min.js" type="text/javascript" language="javascript"></script>
<script src="tinawebJS/sigma.forceatlas2.js" type="text/javascript" language="javascript"></script> <script src="tinawebJS/sigma.forceatlas2.js" type="text/javascript" language="javascript"></script>
...@@ -535,7 +535,7 @@ ...@@ -535,7 +535,7 @@
<script src="tinawebJS/asyncFA2.js" type="text/javascript" language="javascript"></script> <script src="tinawebJS/asyncFA2.js" type="text/javascript" language="javascript"></script>
<script src="tinawebJS/Tinaweb.js" type="text/javascript" language="javascript"></script> <script src="tinawebJS/Tinaweb.js" type="text/javascript" language="javascript"></script>
<script src="tinawebJS/main.js" type="text/javascript" language="javascript"></script> <script src="tinawebJS/main.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
$('#tab-container').easytabs({updateHash:false}); $('#tab-container').easytabs({updateHash:false});
$('#tab-container-top').easytabs({updateHash:false}); $('#tab-container-top').easytabs({updateHash:false});
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// ================= // =================
// Presents a histogram from WOS API // Presents a histogram from WOS API
// Our module_name is simultaneously 3 things: // Our module_name is simultaneously 3 things:
// - a DivsFlag for settings_explorerjs // - a DivsFlag for settings_explorerjs
// - our current dir for this module's files (and this init.js) // - our current dir for this module's files (and this init.js)
// - the class of module's html elements // - the class of module's html elements
......
...@@ -52,7 +52,7 @@ var TW = {} ...@@ -52,7 +52,7 @@ var TW = {}
TW.SystemStates.opposites = []; TW.SystemStates.opposites = [];
TW.catSoc = "Document"; TW.catSoc = "Document";
TW.catSem = "NGram"; TW.catSem = "NGram";
TW.strSearchBar = "Select or suggest topics"; TW.strSearchBar = "Select or suggest topics";
var ParseCustom = function () {}; var ParseCustom = function () {};
...@@ -85,7 +85,7 @@ var desirableScholarSize=6; //Remember that all scholars have the same size! ...@@ -85,7 +85,7 @@ var desirableScholarSize=6; //Remember that all scholars have the same size!
*Three states: *Three states:
* - true: fa2 running at start * - true: fa2 running at start
* - false: fa2 stopped at start, button exists * - false: fa2 stopped at start, button exists
* - "off": button doesn't exist, fa2 stopped forever * - "off": button doesn't exist, fa2 stopped forever
**/ var fa2enabled=false;//"off"; **/ var fa2enabled=false;//"off";
var stopcriteria = false; var stopcriteria = false;
var iterationsFA2=1000; var iterationsFA2=1000;
...@@ -120,7 +120,7 @@ var sigmaJsMouseProperties = { ...@@ -120,7 +120,7 @@ var sigmaJsMouseProperties = {
maxRatio: 50 maxRatio: 50
}; };
// ============ < / SIGMA.JS PROPERTIES > ============ // ============ < / SIGMA.JS PROPERTIES > ============
// ============ < / DEVELOPER OPTIONS > ============ // ============ < / DEVELOPER OPTIONS > ============
...@@ -165,15 +165,15 @@ var overviewScale = 0.25; ...@@ -165,15 +165,15 @@ var overviewScale = 0.25;
var overviewHover=false; var overviewHover=false;
var moveDelay = 80, zoomDelay = 2; var moveDelay = 80, zoomDelay = 2;
//var Vecindad; //var Vecindad;
TW.partialGraph; TW.partialGraph;
var otherGraph; var otherGraph;
TW.Nodes = []; TW.Nodes = [];
TW.Edges = []; TW.Edges = [];
TW.Clusters = []; TW.Clusters = [];
var nodeslength=0; var nodeslength=0;
var labels = []; var labels = [];
var numberOfDocs=0; var numberOfDocs=0;
var numberOfNGrams=0; var numberOfNGrams=0;
...@@ -232,4 +232,3 @@ var RVUniformC = function(seed){ ...@@ -232,4 +232,3 @@ var RVUniformC = function(seed){
}; };
} }
//unifCont = new RVUniformC(100000000) //unifCont = new RVUniformC(100000000)
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
); );
// for new SigmaUtils // for new SigmaUtils
function sigmaLimits( sigmacanvas ) { function sigmaLimits( sigmacanvas ) {
pw=$( sigmacanvas ).width(); pw=$( sigmacanvas ).width();
ph=$( sigmacanvas ).height(); ph=$( sigmacanvas ).height();
sidebar=$('#rightcolumn').width(); sidebar=$('#rightcolumn').width();
anchototal=$('#fixedtop').width(); anchototal=$('#fixedtop').width();
altototal=$('#rightcolumn').height(); altototal=$('#rightcolumn').height();
...@@ -33,14 +33,14 @@ function sigmaLimits( sigmacanvas ) { ...@@ -33,14 +33,14 @@ function sigmaLimits( sigmacanvas ) {
altodeftop=$('#defaultop').height() altodeftop=$('#defaultop').height()
$( sigmacanvas ).width(anchototal-sidebar); $( sigmacanvas ).width(anchototal-sidebar);
$( sigmacanvas ).height(altototal-altofixtop-altodeftop-4); $( sigmacanvas ).height(altototal-altofixtop-altodeftop-4);
// todo take into account leftcolumn // todo take into account leftcolumn
//sidebar_left=$('#leftcolumn').width(); //sidebar_left=$('#leftcolumn').width();
//sidebar_right=$('#rightcolumn').width(); //sidebar_right=$('#rightcolumn').width();
//$( sigmacanvas ).width(anchototal-sidebar_right-sidebar_left); //$( sigmacanvas ).width(anchototal-sidebar_right-sidebar_left);
pw=$( sigmacanvas ).width(); pw=$( sigmacanvas ).width();
ph=$( sigmacanvas ).height(); ph=$( sigmacanvas ).height();
return "new canvas! w:"+pw+" , h:"+ph; return "new canvas! w:"+pw+" , h:"+ph;
...@@ -52,7 +52,7 @@ function sigmaLimits( sigmacanvas ) { ...@@ -52,7 +52,7 @@ function sigmaLimits( sigmacanvas ) {
// will be instanciated as SelInst // will be instanciated as SelInst
SelectionEngine = function() { SelectionEngine = function() {
// Selection Engine!! finally... // Selection Engine!! finally...
this.SelectorEngine_part01 = (function(cursorsize, area ) { this.SelectorEngine_part01 = (function(cursorsize, area ) {
var clickedNodes = [] var clickedNodes = []
...@@ -65,12 +65,12 @@ SelectionEngine = function() { ...@@ -65,12 +65,12 @@ SelectionEngine = function() {
return n.id; return n.id;
}); });
} }
return clickedNodes.map(Number); return clickedNodes.map(Number);
}).index(); }).index();
this.SelectorEngine_part02 = (function( addvalue , clicktype , prevsels , currsels ) { this.SelectorEngine_part02 = (function( addvalue , clicktype , prevsels , currsels ) {
console.log("Add[]:") console.log("Add[]:")
console.log(addvalue) console.log(addvalue)
console.log("clicktype:") console.log("clicktype:")
...@@ -85,7 +85,7 @@ SelectionEngine = function() { ...@@ -85,7 +85,7 @@ SelectionEngine = function() {
var targeted = currsels.map(Number).sort(this.sortNumber); var targeted = currsels.map(Number).sort(this.sortNumber);
if(clicktype=="double" && targeted.length==0) return []; if(clicktype=="double" && targeted.length==0) return [];
// if(targeted.length>0) { // if(targeted.length>0) {
if(buffer.length>0) { if(buffer.length>0) {
if(JSON.stringify(buffer)==JSON.stringify(targeted)) { if(JSON.stringify(buffer)==JSON.stringify(targeted)) {
...@@ -112,13 +112,13 @@ SelectionEngine = function() { ...@@ -112,13 +112,13 @@ SelectionEngine = function() {
} }
targeted = Object.keys(whitelist).map(Number); targeted = Object.keys(whitelist).map(Number);
} else {// inter = 0 ==> click in other portion of the graph (!= current selection) } else {// inter = 0 ==> click in other portion of the graph (!= current selection)
// Union! // Union!
if(addvalue) { if(addvalue) {
targeted = targeted.concat(buffer.filter(function (item) { targeted = targeted.concat(buffer.filter(function (item) {
return targeted.indexOf(item) < 0; return targeted.indexOf(item) < 0;
})); }));
} }
return targeted; return targeted;
} }
} else return targeted; } else return targeted;
// } // }
...@@ -129,7 +129,7 @@ SelectionEngine = function() { ...@@ -129,7 +129,7 @@ SelectionEngine = function() {
this.SelectorEngine = (function( cursorsize , area , addvalue , clicktype , prevsels , currsels ) { this.SelectorEngine = (function( cursorsize , area , addvalue , clicktype , prevsels , currsels ) {
var targeted = [] var targeted = []
var buffer = Object.keys(prevsels).map(Number).sort(this.sortNumber); var buffer = Object.keys(prevsels).map(Number).sort(this.sortNumber);
if( isUndef(currsels) ) { // bunch of nodes from a click in the map if( isUndef(currsels) ) { // bunch of nodes from a click in the map
if(cursorsize>0) { if(cursorsize>0) {
targeted = this.SelectThis2( area ) targeted = this.SelectThis2( area )
...@@ -146,14 +146,14 @@ SelectionEngine = function() { ...@@ -146,14 +146,14 @@ SelectionEngine = function() {
targeted = currsels.concat(buffer.filter(function (item) { targeted = currsels.concat(buffer.filter(function (item) {
return currsels.indexOf(item) < 0; return currsels.indexOf(item) < 0;
})); }));
} else targeted = currsels; } else targeted = currsels;
return targeted; return targeted;
} }
targeted = targeted.map(Number) targeted = targeted.map(Number)
if(clicktype=="double" && targeted.length==0) return []; if(clicktype=="double" && targeted.length==0) return [];
targeted = targeted.sort(this.sortNumber); targeted = targeted.sort(this.sortNumber);
if(targeted.length>0) { if(targeted.length>0) {
...@@ -182,13 +182,13 @@ SelectionEngine = function() { ...@@ -182,13 +182,13 @@ SelectionEngine = function() {
} }
targeted = Object.keys(whitelist).map(Number); targeted = Object.keys(whitelist).map(Number);
} else {// inter = 0 ==> click in other portion of the graph (!= current selection) } else {// inter = 0 ==> click in other portion of the graph (!= current selection)
// Union! // Union!
if(addvalue) { if(addvalue) {
targeted = targeted.concat(buffer.filter(function (item) { targeted = targeted.concat(buffer.filter(function (item) {
return targeted.indexOf(item) < 0; return targeted.indexOf(item) < 0;
})); }));
} }
return targeted; return targeted;
} }
} else return targeted; } else return targeted;
} }
...@@ -219,8 +219,8 @@ SelectionEngine = function() { ...@@ -219,8 +219,8 @@ SelectionEngine = function() {
coincd.push(results[i].id) coincd.push(results[i].id)
} }
var targeted = this.SelectorEngine( { var targeted = this.SelectorEngine( {
addvalue:checkBox, addvalue:checkBox,
clicktype:"simple", clicktype:"simple",
prevsels:selections, prevsels:selections,
currsels:coincd currsels:coincd
} ) } )
...@@ -293,17 +293,17 @@ SelectionEngine = function() { ...@@ -293,17 +293,17 @@ SelectionEngine = function() {
); );
if(parseInt(distance)<=cursor_size) { if(parseInt(distance)<=cursor_size) {
counter++; counter++;
actualSel.push(n.id); actualSel.push(n.id);
} }
} }
}); });
return actualSel; return actualSel;
} }
/** /**
* Main function for any selecting action * Main function for any selecting action
* *
* @nodes: eg targeted array * @nodes: eg targeted array
*/ */
// external usage : partialGraph , updateLeftPanel_fix(); // external usage : partialGraph , updateLeftPanel_fix();
...@@ -312,7 +312,7 @@ SelectionEngine = function() { ...@@ -312,7 +312,7 @@ SelectionEngine = function() {
console.log("IN SelectionEngine.MultipleSelection2:") console.log("IN SelectionEngine.MultipleSelection2:")
// console.log(nodes) // console.log(nodes)
greyEverything(); greyEverything();
// TW.partialGraph.states.slice(-1)[0] is the present graph state // TW.partialGraph.states.slice(-1)[0] is the present graph state
var typeNow = TW.partialGraph.states.slice(-1)[0].type.map(Number).join("|") var typeNow = TW.partialGraph.states.slice(-1)[0].type.map(Number).join("|")
// console.log ("console.loging the Type:") // console.log ("console.loging the Type:")
...@@ -376,9 +376,9 @@ SelectionEngine = function() { ...@@ -376,9 +376,9 @@ SelectionEngine = function() {
var the_new_sels = Object.keys(selections).map(Number) var the_new_sels = Object.keys(selections).map(Number)
TW.partialGraph.states.slice(-1)[0].selections = the_new_sels; TW.partialGraph.states.slice(-1)[0].selections = the_new_sels;
TW.partialGraph.states.slice(-1)[0].setState( { sels: the_new_sels} ) TW.partialGraph.states.slice(-1)[0].setState( { sels: the_new_sels} )
// alert("MultipleSelection2=======\nthe_new_sels:" + JSON.stringify(the_new_sels)) // alert("MultipleSelection2=======\nthe_new_sels:" + JSON.stringify(the_new_sels))
// we send our "gotNodeSet" event // we send our "gotNodeSet" event
// (signal for plugins that a search-selection was done or a new hand picked selection) // (signal for plugins that a search-selection was done or a new hand picked selection)
$('#searchinput').trigger({ $('#searchinput').trigger({
...@@ -387,7 +387,7 @@ SelectionEngine = function() { ...@@ -387,7 +387,7 @@ SelectionEngine = function() {
nodeIds: the_new_sels nodeIds: the_new_sels
}); });
// console.log("Event [gotNodeSet] sent from Tinaweb MultipleSelection2") // console.log("Event [gotNodeSet] sent from Tinaweb MultipleSelection2")
var neighsDict = {} var neighsDict = {}
if(TW.Relations["1|1"]) { if(TW.Relations["1|1"]) {
...@@ -398,21 +398,21 @@ SelectionEngine = function() { ...@@ -398,21 +398,21 @@ SelectionEngine = function() {
neighsDict[neighs[n]] = 0; neighsDict[neighs[n]] = 0;
neighsDict[neighs[n]]++; neighsDict[neighs[n]]++;
} }
} }
} }
var oppos = ArraySortByValue(neighsDict, function(a,b){ var oppos = ArraySortByValue(neighsDict, function(a,b){
return b-a return b-a
}); });
overNodes=true; overNodes=true;
TW.partialGraph.draw(); TW.partialGraph.draw();
updateLeftPanel_fix( selections , oppos ); updateLeftPanel_fix( selections , oppos );
for(var n in neighsDict) for(var n in neighsDict)
delete neighsDict[n] delete neighsDict[n]
}).index() }).index()
...@@ -438,7 +438,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -438,7 +438,7 @@ TinaWebJS = function ( sigmacanvas ) {
} }
this.SearchListeners = function () { this.SearchListeners = function () {
var SelInst = new SelectionEngine(); var SelInst = new SelectionEngine();
//~ $.ui.autocomplete.prototype._renderItem = function(ul, item) { //~ $.ui.autocomplete.prototype._renderItem = function(ul, item) {
...@@ -453,7 +453,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -453,7 +453,7 @@ TinaWebJS = function ( sigmacanvas ) {
$('input#searchinput').autocomplete({ $('input#searchinput').autocomplete({
source: function(request, response) { source: function(request, response) {
// console.log("in autocomplete:") // console.log("in autocomplete:")
// labels initialized in settings, filled in updateSearchLabels // labels initialized in settings, filled in updateSearchLabels
// console.log(labels.length) // console.log(labels.length)
// console.log(" - - - - - - - - - ") // console.log(" - - - - - - - - - ")
...@@ -463,7 +463,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -463,7 +463,7 @@ TinaWebJS = function ( sigmacanvas ) {
var results = $.grep(labels, function(e) { var results = $.grep(labels, function(e) {
return matcher.test(e.label); //|| matcher.test(e.desc); return matcher.test(e.label); //|| matcher.test(e.desc);
}); });
if (!results.length) { if (!results.length) {
$("#noresults").text("Pas de résultats"); $("#noresults").text("Pas de résultats");
} else { } else {
...@@ -471,11 +471,11 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -471,11 +471,11 @@ TinaWebJS = function ( sigmacanvas ) {
} }
matches = results.slice(0, maxSearchResults); matches = results.slice(0, maxSearchResults);
response(matches); response(matches);
}, },
minLength: minLengthAutoComplete, minLength: minLengthAutoComplete,
// ----------------------->8--------------------- // ----------------------->8---------------------
// send a "no more suggestions event" // send a "no more suggestions event"
response: function (event, ui_response_array) { response: function (event, ui_response_array) {
...@@ -485,7 +485,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -485,7 +485,7 @@ TinaWebJS = function ( sigmacanvas ) {
// ... // ...
// ] // ]
// } // }
if (ui_response_array.content.length == 0) { if (ui_response_array.content.length == 0) {
// we send our "noAutocomplete" event // we send our "noAutocomplete" event
$('#searchinput').trigger("tw:noAutocomplete"); $('#searchinput').trigger("tw:noAutocomplete");
...@@ -501,8 +501,8 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -501,8 +501,8 @@ TinaWebJS = function ( sigmacanvas ) {
} }
} }
// ----------------------->8--------------------- // ----------------------->8---------------------
}); });
// is_open flag for keydown choice // is_open flag for keydown choice
$('#searchinput').bind('autocompleteopen', function(event, ui) { $('#searchinput').bind('autocompleteopen', function(event, ui) {
$(this).data('is_open',true); $(this).data('is_open',true);
...@@ -510,7 +510,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -510,7 +510,7 @@ TinaWebJS = function ( sigmacanvas ) {
$('#searchinput').bind('autocompleteclose', function(event, ui) { $('#searchinput').bind('autocompleteclose', function(event, ui) {
$(this).data('is_open',false); $(this).data('is_open',false);
}); });
// default search value now handled through input/@placeholder // default search value now handled through input/@placeholder
// $("#searchinput").focus(function () { }); // $("#searchinput").focus(function () { });
// $("#searchinput").blur(function () { }); // $("#searchinput").blur(function () { });
...@@ -520,11 +520,11 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -520,11 +520,11 @@ TinaWebJS = function ( sigmacanvas ) {
$("#searchbutton").click(function() { $("#searchbutton").click(function() {
var query = normalizeString($("#searchinput").val()) var query = normalizeString($("#searchinput").val())
// console.log('===\nyour query was: "'+query+'"'); // console.log('===\nyour query was: "'+query+'"');
// --- SelectionEngine.search() ------------------- // --- SelectionEngine.search() -------------------
// -> will call sigmaUtils.find() // -> will call sigmaUtils.find()
// over sigmaUtils.getnodesIndex() // over sigmaUtils.getnodesIndex()
// -> then call this.SelectorEngine // -> then call this.SelectorEngine
// and this.MultipleSelection2 // and this.MultipleSelection2
SelInst.search_n_select(query) SelInst.search_n_select(query)
// ------------------------------------------------ // ------------------------------------------------
...@@ -534,17 +534,17 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -534,17 +534,17 @@ TinaWebJS = function ( sigmacanvas ) {
// i've a list of coincidences and i press enter like a boss >:D // i've a list of coincidences and i press enter like a boss >:D
// external usage: partialGraph, SelectorEngine() , MultipleSelection2() // external usage: partialGraph, SelectorEngine() , MultipleSelection2()
$("#searchinput").keydown(function (e) { $("#searchinput").keydown(function (e) {
if (e.keyCode == 13 && $("input#searchinput").data('is_open') === true) { if (e.keyCode == 13 && $("input#searchinput").data('is_open') === true) {
// Search has several results and you pressed ENTER // Search has several results and you pressed ENTER
if(!is_empty(matches)) { if(!is_empty(matches)) {
var coincidences = [] var coincidences = []
for(j=0;j<matches.length;j++){ for(j=0;j<matches.length;j++){
coincidences.push(matches[j].id) coincidences.push(matches[j].id)
} }
$.doTimeout(30,function (){ $.doTimeout(30,function (){
targeted = SelInst.SelectorEngine( { targeted = SelInst.SelectorEngine( {
addvalue:checkBox, addvalue:checkBox,
clicktype:"double", clicktype:"double",
prevsels:selections, prevsels:selections,
currsels:coincidences currsels:coincidences
} ) } )
...@@ -565,7 +565,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -565,7 +565,7 @@ TinaWebJS = function ( sigmacanvas ) {
}); });
//$("input#searchinput").trigger('autocompleteclose'); //$("input#searchinput").trigger('autocompleteclose');
} }
// alert("matches[].id\n" + JSON.stringify(matches.map(function(n) {return n.id}))) // alert("matches[].id\n" + JSON.stringify(matches.map(function(n) {return n.id})))
} }
else if (e.keyCode == 13 && $("input#searchinput").data('is_open') !== true) { else if (e.keyCode == 13 && $("input#searchinput").data('is_open') !== true) {
...@@ -577,7 +577,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -577,7 +577,7 @@ TinaWebJS = function ( sigmacanvas ) {
SelInst.search_n_select(query) SelInst.search_n_select(query)
} }
}); });
// i was navigating (with the up|down) sur the coincidences-list and i pressed enter! // i was navigating (with the up|down) sur the coincidences-list and i pressed enter!
// external usage: partialGraph, SelectorEngine() , MultipleSelection2() // external usage: partialGraph, SelectorEngine() , MultipleSelection2()
$("#searchinput").keyup(function (e) { $("#searchinput").keyup(function (e) {
...@@ -589,8 +589,8 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -589,8 +589,8 @@ TinaWebJS = function ( sigmacanvas ) {
$.doTimeout(30,function (){ $.doTimeout(30,function (){
targeted = SelInst.SelectorEngine( { targeted = SelInst.SelectorEngine( {
addvalue:checkBox, addvalue:checkBox,
clicktype:"double", clicktype:"double",
prevsels:selections, prevsels:selections,
currsels:[exfnd.id] currsels:[exfnd.id]
} ) } )
...@@ -599,7 +599,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -599,7 +599,7 @@ TinaWebJS = function ( sigmacanvas ) {
SelInst.MultipleSelection2({nodes:targeted}); SelInst.MultipleSelection2({nodes:targeted});
} }
TW.partialGraph.draw(); TW.partialGraph.draw();
$("input#searchinput").val(""); $("input#searchinput").val("");
$("input#searchinput").autocomplete( "close" ); $("input#searchinput").autocomplete( "close" );
}); });
...@@ -608,10 +608,10 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -608,10 +608,10 @@ TinaWebJS = function ( sigmacanvas ) {
}); });
} }
// external usage: SelectorEngine*() , MultipleSelection2() , // external usage: SelectorEngine*() , MultipleSelection2() ,
// enviroment.js:changeType()|changeLevel()|NodeWeightFilter()|EdgeWeightFilter // enviroment.js:changeType()|changeLevel()|NodeWeightFilter()|EdgeWeightFilter
this.initListeners = function (categories, partialGraph) { this.initListeners = function (categories, partialGraph) {
var SelInst = new SelectionEngine(); var SelInst = new SelectionEngine();
$("#semLoader").hide(); $("#semLoader").hide();
...@@ -623,8 +623,8 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -623,8 +623,8 @@ TinaWebJS = function ( sigmacanvas ) {
$('.etabs').click(function(){ $('.etabs').click(function(){
$.doTimeout(500,function () { $.doTimeout(500,function () {
$("#opossiteNodes").readmore({maxHeight:200}); $("#opossiteNodes").readmore({maxHeight:200});
$("#sameNodes").readmore({maxHeight:200}); $("#sameNodes").readmore({maxHeight:200});
}); });
}); });
...@@ -660,25 +660,25 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -660,25 +660,25 @@ TinaWebJS = function ( sigmacanvas ) {
fullwidth=$('#fixedtop').width(); fullwidth=$('#fixedtop').width();
e.preventDefault(); e.preventDefault();
// $("#wrapper").toggleClass("active"); // $("#wrapper").toggleClass("active");
if(parseFloat(sidebar.css("right"))<0){ if(parseFloat(sidebar.css("right"))<0){
$("#aUnfold").attr("class","rightarrow"); $("#aUnfold").attr("class","rightarrow");
sidebar.animate({ sidebar.animate({
"right" : sidebar.width()+"px" "right" : sidebar.width()+"px"
}, { duration: 400, queue: false }); }, { duration: 400, queue: false });
$("#ctlzoom").animate({ $("#ctlzoom").animate({
"right": (sidebar.width()+10)+"px" "right": (sidebar.width()+10)+"px"
}, { duration: 400, queue: false }); }, { duration: 400, queue: false });
// $('#sigma-example').width(fullwidth-sidebar.width()); // $('#sigma-example').width(fullwidth-sidebar.width());
$('#sigma-example').animate({ $('#sigma-example').animate({
"width": fullwidth-sidebar.width()+"px" "width": fullwidth-sidebar.width()+"px"
}, { duration: 400, queue: false }); }, { duration: 400, queue: false });
setTimeout(function() { setTimeout(function() {
partialGraph.resize(); partialGraph.resize();
partialGraph.refresh(); partialGraph.refresh();
}, 400); }, 400);
} }
else { else {
//HIDE rightcolumn //HIDE rightcolumn
$("#aUnfold").attr("class","leftarrow"); $("#aUnfold").attr("class","leftarrow");
...@@ -688,7 +688,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -688,7 +688,7 @@ TinaWebJS = function ( sigmacanvas ) {
$("#ctlzoom").animate({ $("#ctlzoom").animate({
"right": "0px" "right": "0px"
}, { duration: 400, queue: false }); }, { duration: 400, queue: false });
// $('#sigma-example').width(fullwidth); // $('#sigma-example').width(fullwidth);
$('#sigma-example').animate({ $('#sigma-example').animate({
...@@ -697,8 +697,8 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -697,8 +697,8 @@ TinaWebJS = function ( sigmacanvas ) {
setTimeout(function() { setTimeout(function() {
partialGraph.resize(); partialGraph.resize();
partialGraph.refresh(); partialGraph.refresh();
}, 400); }, 400);
} }
}); });
pushSWClick("social"); pushSWClick("social");
...@@ -708,10 +708,10 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -708,10 +708,10 @@ TinaWebJS = function ( sigmacanvas ) {
$("#tips").html(getTips()); $("#tips").html(getTips());
showMeSomeLabels(6); showMeSomeLabels(6);
// updateDownNodeEvent(false); // updateDownNodeEvent(false);
$("#saveAs").click(function() { $("#saveAs").click(function() {
$('#savemodal').modal('show'); $('#savemodal').modal('show');
}); });
...@@ -734,17 +734,17 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -734,17 +734,17 @@ TinaWebJS = function ( sigmacanvas ) {
area.y1 = partialGraph._core.mousecaptor.mouseY; area.y1 = partialGraph._core.mousecaptor.mouseY;
targeted = SelInst.SelectorEngine_part01({ targeted = SelInst.SelectorEngine_part01({
cursorsize:cursor_size, cursorsize:cursor_size,
area:area area:area
}) })
if(targeted.length>0) { if(targeted.length>0) {
var finalSelection = SelInst.SelectorEngine_part02( { var finalSelection = SelInst.SelectorEngine_part02( {
addvalue:checkBox , addvalue:checkBox ,
clicktype:(checkBox)?"simple":"double", clicktype:(checkBox)?"simple":"double",
prevsels:selections, prevsels:selections,
currsels:targeted currsels:targeted
}); });
cancelSelection(false); cancelSelection(false);
SelInst.MultipleSelection2( {nodes:finalSelection} ) SelInst.MultipleSelection2( {nodes:finalSelection} )
...@@ -777,10 +777,10 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -777,10 +777,10 @@ TinaWebJS = function ( sigmacanvas ) {
area.x1 = partialGraph._core.mousecaptor.mouseX; area.x1 = partialGraph._core.mousecaptor.mouseX;
area.y1 = partialGraph._core.mousecaptor.mouseY; area.y1 = partialGraph._core.mousecaptor.mouseY;
var targeted = SelInst.SelectorEngine( { var targeted = SelInst.SelectorEngine( {
cursorsize:cursor_size, cursorsize:cursor_size,
area:area, area:area,
addvalue:checkBox, addvalue:checkBox,
clicktype:"simple", clicktype:"simple",
prevsels:selections prevsels:selections
} ) } )
if(targeted.length>0) { if(targeted.length>0) {
...@@ -807,8 +807,8 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -807,8 +807,8 @@ TinaWebJS = function ( sigmacanvas ) {
// console.log(sigmaJsMouseProperties.minRatio) // console.log(sigmaJsMouseProperties.minRatio)
// console.log(sigmaJsMouseProperties.maxRatio) // console.log(sigmaJsMouseProperties.maxRatio)
partialGraph.zoomTo( partialGraph.zoomTo(
partialGraph._core.width / 2, partialGraph._core.width / 2,
partialGraph._core.height / 2, partialGraph._core.height / 2,
ui.value); ui.value);
} }
}); });
...@@ -841,9 +841,9 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -841,9 +841,9 @@ TinaWebJS = function ( sigmacanvas ) {
} else { } else {
partialGraph.startForceAtlas2(); partialGraph.startForceAtlas2();
return; return;
} }
}); });
NodeWeightFilter ( categories , "#slidercat0nodesweight" , categories[0], "type" ,"size"); NodeWeightFilter ( categories , "#slidercat0nodesweight" , categories[0], "type" ,"size");
EdgeWeightFilter("#slidercat0edgesweight", "label" , "nodes1", "weight"); EdgeWeightFilter("#slidercat0edgesweight", "label" , "nodes1", "weight");
...@@ -872,7 +872,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -872,7 +872,7 @@ TinaWebJS = function ( sigmacanvas ) {
partialGraph.draw(); partialGraph.draw();
}); });
} }
}); });
//finished //finished
$("#slidercat1nodessize").freshslider({ $("#slidercat1nodessize").freshslider({
...@@ -893,7 +893,7 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -893,7 +893,7 @@ TinaWebJS = function ( sigmacanvas ) {
partialGraph.draw(); partialGraph.draw();
}); });
} }
}); });
//Cursor Size slider //Cursor Size slider
$("#unranged-value").freshslider({ $("#unranged-value").freshslider({
...@@ -911,4 +911,3 @@ TinaWebJS = function ( sigmacanvas ) { ...@@ -911,4 +911,3 @@ TinaWebJS = function ( sigmacanvas ) {
} }
}; };
...@@ -237,7 +237,7 @@ var ForceAtlas2 = function(graph) { ...@@ -237,7 +237,7 @@ var ForceAtlas2 = function(graph) {
totalSwinging += n.fa2.mass * swinging; totalSwinging += n.fa2.mass * swinging;
swingingSum += swinging; swingingSum += swinging;
promdxdy += (Math.abs(n.fa2.dx)+Math.abs(n.fa2.dy))/2; /**/ promdxdy += (Math.abs(n.fa2.dx)+Math.abs(n.fa2.dy))/2; /**/
totalEffectiveTraction += n.fa2.mass * totalEffectiveTraction += n.fa2.mass *
0.5 * 0.5 *
Math.sqrt( Math.sqrt(
...@@ -246,15 +246,15 @@ var ForceAtlas2 = function(graph) { ...@@ -246,15 +246,15 @@ var ForceAtlas2 = function(graph) {
); );
} }
}); });
self.p.totalSwinging = totalSwinging; self.p.totalSwinging = totalSwinging;
var convg= ((Math.pow(nodes.length,2))/promdxdy); /**/ var convg= ((Math.pow(nodes.length,2))/promdxdy); /**/
var swingingVSnodes_length = swingingSum/nodes.length; /**/ var swingingVSnodes_length = swingingSum/nodes.length; /**/
// if(convg > swingingVSnodes_length){ // if(convg > swingingVSnodes_length){
// self.p.banderita=true; // self.p.banderita=true;
// } // }
self.p.totalEffectiveTraction = totalEffectiveTraction; self.p.totalEffectiveTraction = totalEffectiveTraction;
// We want that swingingMovement < tolerance * convergenceMovement // We want that swingingMovement < tolerance * convergenceMovement
...@@ -880,7 +880,7 @@ var Region = function(nodes, depth) { ...@@ -880,7 +880,7 @@ var Region = function(nodes, depth) {
massCenterX: 0, massCenterX: 0,
massCenterY: 0 massCenterY: 0
}; };
console.log("updating mass and geometry"); console.log("updating mass and geometry");
this.updateMassAndGeometry(); this.updateMassAndGeometry();
} }
...@@ -960,7 +960,7 @@ var applyForce = function(n, Force, theta) { ...@@ -960,7 +960,7 @@ var applyForce = function(n, Force, theta) {
// [ NEW STUFF FOR WORKERS ] // [ NEW STUFF FOR WORKERS ]
// 01. Return the values to MainContext when spatialization is finished // 01. Return the values to MainContext when spatialization is finished
var startForceAtlas2 = function(graph,limit_it) { var startForceAtlas2 = function(graph,limit_it) {
...@@ -987,7 +987,7 @@ var applyForce = function(n, Force, theta) { ...@@ -987,7 +987,7 @@ var applyForce = function(n, Force, theta) {
forceatlas2 = new ForceAtlas2(graph); forceatlas2 = new ForceAtlas2(graph);
forceatlas2.setAutoSettings(); forceatlas2.setAutoSettings();
forceatlas2.init(); forceatlas2.init();
count=0; count=0;
flag=false; flag=false;
while(true){ while(true){
...@@ -1000,13 +1000,13 @@ var applyForce = function(n, Force, theta) { ...@@ -1000,13 +1000,13 @@ var applyForce = function(n, Force, theta) {
} }
count++; count++;
if(flag||count>limit_it) break; if(flag||count>limit_it) break;
} }
// pr(forceatlas2.graph.nodes[0].x) // pr(forceatlas2.graph.nodes[0].x)
// pr(forceatlas2.graph.nodes[0].y) // pr(forceatlas2.graph.nodes[0].y)
// console.log("\titerations: "+count) // console.log("\titerations: "+count)
result={ result={
"nodes":forceatlas2.graph.nodes, "nodes":forceatlas2.graph.nodes,
"it":count "it":count
} }
return result; return result;
}; };
...@@ -1024,8 +1024,8 @@ var applyForce = function(n, Force, theta) { ...@@ -1024,8 +1024,8 @@ var applyForce = function(n, Force, theta) {
"nodes":result.nodes, "nodes":result.nodes,
"it":result.it "it":result.it
}); });
}, false); }, false);
// [ / NEW STUFF FOR WORKERS ] // [ / NEW STUFF FOR WORKERS ]
\ No newline at end of file
...@@ -13,18 +13,18 @@ function changeType() { ...@@ -13,18 +13,18 @@ function changeType() {
var level = present.level; var level = present.level;
var sels = present.selections var sels = present.selections
var catDict = present.categoriesDict; var catDict = present.categoriesDict;
var type_t0 = present.type; var type_t0 = present.type;
var str_type_t0 = type_t0.map(Number).join("|") var str_type_t0 = type_t0.map(Number).join("|")
var selsbackup = present.selections.slice(); var selsbackup = present.selections.slice();
// Complement of the received state ~[X\Y] ) // Complement of the received state ~[X\Y] )
var type_t1 = [] var type_t1 = []
for(var i in type_t0) type_t1[i] = !type_t0[i] for(var i in type_t0) type_t1[i] = !type_t0[i]
var str_type_t1 = type_t1.map(Number).join("|") var str_type_t1 = type_t1.map(Number).join("|")
var binSumCats = [] var binSumCats = []
for(var i in type_t0) for(var i in type_t0)
binSumCats[i] = (type_t0[i]||type_t1[i]) binSumCats[i] = (type_t0[i]||type_t1[i])
var str_binSumCats = binSumCats.map(Number).join("|") var str_binSumCats = binSumCats.map(Number).join("|")
...@@ -40,7 +40,7 @@ function changeType() { ...@@ -40,7 +40,7 @@ function changeType() {
console.log(past.type) console.log(past.type)
if(sum_past>1) { if(sum_past>1) {
nextState = past.type; nextState = past.type;
} }
} }
var str_nextState = nextState.map(Number).join("|") var str_nextState = nextState.map(Number).join("|")
...@@ -73,14 +73,14 @@ function changeType() { ...@@ -73,14 +73,14 @@ function changeType() {
pr("CHanging the TYpE!!: "+present.level) pr("CHanging the TYpE!!: "+present.level)
if(present.level) { //If level=Global, fill all {X}-component if(present.level) { //If level=Global, fill all {X}-component
for(var n in TW.Nodes) { for(var n in TW.Nodes) {
if(type_t1[catDict[TW.Nodes[n].type]]) if(type_t1[catDict[TW.Nodes[n].type]])
add1Elem(n) add1Elem(n)
} }
for(var e in TW.Edges) { for(var e in TW.Edges) {
if(TW.Edges[e].categ==str_type_t1) if(TW.Edges[e].categ==str_type_t1)
add1Elem(e) add1Elem(e)
} }
} else /* Local level, change to previous or alter component*/ { } else /* Local level, change to previous or alter component*/ {
...@@ -134,7 +134,7 @@ function changeType() { ...@@ -134,7 +134,7 @@ function changeType() {
nextState = type_t1; nextState = type_t1;
} }
if(sumpastcat==2) { if(sumpastcat==2) {
...@@ -207,7 +207,7 @@ function changeType() { ...@@ -207,7 +207,7 @@ function changeType() {
for(var i in sels) for(var i in sels)
nodes_2_colour[sels[i]]=true; nodes_2_colour[sels[i]]=true;
// output: nodes_2_colour and edges_2_colour // output: nodes_2_colour and edges_2_colour
} }
if(sumNextState==2) { // we're moving to bipartite subgraph if(sumNextState==2) { // we're moving to bipartite subgraph
for(var i in TW.Edges) { for(var i in TW.Edges) {
...@@ -242,7 +242,7 @@ function changeType() { ...@@ -242,7 +242,7 @@ function changeType() {
TW.partialGraph.states[avantlastpos].LouvainFait = false; TW.partialGraph.states[avantlastpos].LouvainFait = false;
TW.partialGraph.states[avantlastpos].level = present.level; TW.partialGraph.states[avantlastpos].level = present.level;
TW.partialGraph.states[avantlastpos].selections = selsbackup; TW.partialGraph.states[avantlastpos].selections = selsbackup;
TW.partialGraph.states[avantlastpos].type = present.type; TW.partialGraph.states[avantlastpos].type = present.type;
TW.partialGraph.states[avantlastpos].opposites = present.opposites; TW.partialGraph.states[avantlastpos].opposites = present.opposites;
TW.partialGraph.states[avantlastpos].categories = present.categories;//to_del TW.partialGraph.states[avantlastpos].categories = present.categories;//to_del
TW.partialGraph.states[avantlastpos].categoriesDict = present.categoriesDict;//to_del TW.partialGraph.states[avantlastpos].categoriesDict = present.categoriesDict;//to_del
...@@ -256,7 +256,7 @@ function changeType() { ...@@ -256,7 +256,7 @@ function changeType() {
TW.partialGraph.states[lastpos].categories = present.categories;//to_del TW.partialGraph.states[lastpos].categories = present.categories;//to_del
TW.partialGraph.states[lastpos].categoriesDict = catDict;//to_del TW.partialGraph.states[lastpos].categoriesDict = catDict;//to_del
fa2enabled=true; TW.partialGraph.zoomTo(TW.partialGraph._core.width / 2, TW.partialGraph._core.height / 2, 0.8).draw();//.startForceAtlas2(); fa2enabled=true; TW.partialGraph.zoomTo(TW.partialGraph._core.width / 2, TW.partialGraph._core.height / 2, 0.8).draw();//.startForceAtlas2();
} }
...@@ -271,17 +271,17 @@ function changeLevel() { ...@@ -271,17 +271,17 @@ function changeLevel() {
var sels = present.selections;//[144, 384, 543]//TW.partialGraph.states.selections; var sels = present.selections;//[144, 384, 543]//TW.partialGraph.states.selections;
var catDict = present.categoriesDict; var catDict = present.categoriesDict;
var type_t0 = present.type; var type_t0 = present.type;
var str_type_t0 = type_t0.map(Number).join("|") var str_type_t0 = type_t0.map(Number).join("|")
// [X|Y]-change (NOT operation over the received state [X\Y] ) // [X|Y]-change (NOT operation over the received state [X\Y] )
var type_t1 = [] var type_t1 = []
for(var i in type_t0) type_t1[i] = !type_t0[i] for(var i in type_t0) type_t1[i] = !type_t0[i]
var str_type_t1 = type_t1.map(Number).join("|") var str_type_t1 = type_t1.map(Number).join("|")
// //
var binSumCats = [] var binSumCats = []
for(var i in type_t0) for(var i in type_t0)
binSumCats[i] = (type_t0[i]||type_t1[i]) binSumCats[i] = (type_t0[i]||type_t1[i])
var str_binSumCats = binSumCats.map(Number).join("|") var str_binSumCats = binSumCats.map(Number).join("|")
...@@ -292,7 +292,7 @@ function changeLevel() { ...@@ -292,7 +292,7 @@ function changeLevel() {
var sum_past = past.type.map(Number).reduce(function(a, b){return a+b;}) var sum_past = past.type.map(Number).reduce(function(a, b){return a+b;})
if(sum_past>1) { if(sum_past>1) {
nextState = past.type; nextState = past.type;
} }
} }
var str_nextState = nextState.map(Number).join("|") var str_nextState = nextState.map(Number).join("|")
...@@ -311,7 +311,7 @@ function changeLevel() { ...@@ -311,7 +311,7 @@ function changeLevel() {
nodes_2_colour[t]=false; nodes_2_colour[t]=false;
edges_2_colour[s+";"+t]=true; edges_2_colour[s+";"+t]=true;
edges_2_colour[t+";"+s]=true; edges_2_colour[t+";"+s]=true;
if( !selections[t] ) if( !selections[t] )
voisinage[ Number(t) ] = true; voisinage[ Number(t) ] = true;
} }
} }
...@@ -337,18 +337,18 @@ function changeLevel() { ...@@ -337,18 +337,18 @@ function changeLevel() {
// console.log( "\t" + voisinage[i] + " vs " + voisinage[j] ) // console.log( "\t" + voisinage[i] + " vs " + voisinage[j] )
add1Elem( voisinage[i]+";"+voisinage[j] ) add1Elem( voisinage[i]+";"+voisinage[j] )
} }
} }
} }
futurelevel = false; futurelevel = false;
} else { // [Change to Global] when level=Local(0) } else { // [Change to Global] when level=Local(0)
for(var n in TW.Nodes) { for(var n in TW.Nodes) {
if(type_t0[catDict[TW.Nodes[n].type]]) if(type_t0[catDict[TW.Nodes[n].type]])
add1Elem(n) add1Elem(n)
} }
for(var e in TW.Edges) { for(var e in TW.Edges) {
if(TW.Edges[e].categ==str_type_t0) if(TW.Edges[e].categ==str_type_t0)
add1Elem(e) add1Elem(e)
} }
futurelevel = true; futurelevel = true;
...@@ -370,7 +370,7 @@ function changeLevel() { ...@@ -370,7 +370,7 @@ function changeLevel() {
TW.partialGraph.states[avantlastpos] = {}; TW.partialGraph.states[avantlastpos] = {};
TW.partialGraph.states[avantlastpos].level = present.level; TW.partialGraph.states[avantlastpos].level = present.level;
TW.partialGraph.states[avantlastpos].selections = present.selections; TW.partialGraph.states[avantlastpos].selections = present.selections;
TW.partialGraph.states[avantlastpos].type = present.type; TW.partialGraph.states[avantlastpos].type = present.type;
TW.partialGraph.states[avantlastpos].opposites = present.opposites; TW.partialGraph.states[avantlastpos].opposites = present.opposites;
TW.partialGraph.states[avantlastpos].categories = present.categories;//to_del TW.partialGraph.states[avantlastpos].categories = present.categories;//to_del
TW.partialGraph.states[avantlastpos].categoriesDict = present.categoriesDict;//to_del TW.partialGraph.states[avantlastpos].categoriesDict = present.categoriesDict;//to_del
...@@ -440,12 +440,12 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -440,12 +440,12 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
}); });
return; return;
} }
var lastvalue=("0-"+(steps-1)); var lastvalue=("0-"+(steps-1));
pushFilterValue( sliderDivID , lastvalue ) pushFilterValue( sliderDivID , lastvalue )
var present = TW.partialGraph.states.slice(-1)[0]; var present = TW.partialGraph.states.slice(-1)[0];
//finished //finished
...@@ -506,14 +506,14 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -506,14 +506,14 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// do the important stuff // do the important stuff
for( var c in iterarr ) { for( var c in iterarr ) {
var i = iterarr[c]; var i = iterarr[c];
ids = finalarray[i] ids = finalarray[i]
if(i>=low && i<=high) { if(i>=low && i<=high) {
if(addflag) { if(addflag) {
// pr("adding "+ids.join()) // pr("adding "+ids.join())
for(var id in ids) { for(var id in ids) {
ID = ids[id] ID = ids[id]
TW.Edges[ID].lock = false; TW.Edges[ID].lock = false;
...@@ -535,7 +535,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -535,7 +535,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
} }
} }
} }
} }
} }
...@@ -551,7 +551,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -551,7 +551,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// n = ID.split(";") // n = ID.split(";")
// if(n.length>1) // if(n.length>1)
// pr("\t\tsource:("+TW.Nodes[n[0]].x+","+TW.Nodes[n[0]].y+") ||| target:("+TW.Nodes[n[1]].x+","+TW.Nodes[n[1]].y+")") // pr("\t\tsource:("+TW.Nodes[n[0]].x+","+TW.Nodes[n[0]].y+") ||| target:("+TW.Nodes[n[1]].x+","+TW.Nodes[n[1]].y+")")
} }
} }
} }
} }
...@@ -575,21 +575,21 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) { ...@@ -575,21 +575,21 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
}); });
pushFilterValue( sliderDivID , filtervalue ) pushFilterValue( sliderDivID , filtervalue )
} }
} }
}); });
} }
// Execution modes: // Execution modes:
// NodeWeightFilter ( "#sliderANodeWeight" , "Document" , "type" , "size") // NodeWeightFilter ( "#sliderANodeWeight" , "Document" , "type" , "size")
// NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size") // NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size")
function NodeWeightFilter( categories , sliderDivID , type_attrb , type , criteria) { function NodeWeightFilter( categories , sliderDivID , type_attrb , type , criteria) {
// if ($(sliderDivID).html()!="") { // if ($(sliderDivID).html()!="") {
// pr("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]") // pr("\t\t\t\t\t\t[[ algorithm not applied "+sliderDivID+" ]]")
// return; // return;
// } // }
// sliderDivID = "#sliderAEdgeWeight" // sliderDivID = "#sliderAEdgeWeight"
// type = "nodes1" // type = "nodes1"
// type_attrb = "label" // type_attrb = "label"
...@@ -618,7 +618,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit ...@@ -618,7 +618,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
var filterparams = AlgorithmForSliders ( TW.Nodes , type , type_attrb , criteria) var filterparams = AlgorithmForSliders ( TW.Nodes , type , type_attrb , criteria)
pr("NodeWeightFilter: "+type) pr("NodeWeightFilter: "+type)
pr(filterparams) pr(filterparams)
var steps = filterparams["steps"] var steps = filterparams["steps"]
var finalarray = filterparams["finalarray"] var finalarray = filterparams["finalarray"]
if(steps<3) { if(steps<3) {
...@@ -633,7 +633,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit ...@@ -633,7 +633,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
}); });
return; return;
} }
//finished //finished
$(sliderDivID).freshslider({ $(sliderDivID).freshslider({
range: true, range: true,
...@@ -642,9 +642,9 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit ...@@ -642,9 +642,9 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
max:steps-1, max:steps-1,
bgcolor:( type_attrb==categories[0] )?"#27c470":"#FFA500" , bgcolor:( type_attrb==categories[0] )?"#27c470":"#FFA500" ,
value:[0,steps-1], value:[0,steps-1],
onchange:function(low, high){ onchange:function(low, high){
var filtervalue = low+"-"+high var filtervalue = low+"-"+high
if(filtervalue!=lastFilter[sliderDivID]["last"]) { if(filtervalue!=lastFilter[sliderDivID]["last"]) {
if(lastFilter[sliderDivID]["orig"]=="-") { if(lastFilter[sliderDivID]["orig"]=="-") {
pushFilterValue( sliderDivID , filtervalue ) pushFilterValue( sliderDivID , filtervalue )
...@@ -670,7 +670,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit ...@@ -670,7 +670,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
TW.Nodes[ID].lock = true; TW.Nodes[ID].lock = true;
if(TW.partialGraph._core.graph.nodesIndex[ID]) if(TW.partialGraph._core.graph.nodesIndex[ID])
TW.partialGraph._core.graph.nodesIndex[ID].hidden = true; TW.partialGraph._core.graph.nodesIndex[ID].hidden = true;
} }
} }
} }
pushFilterValue(sliderDivID,filtervalue) pushFilterValue(sliderDivID,filtervalue)
...@@ -687,7 +687,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit ...@@ -687,7 +687,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
}); });
// [ / Starting FA2 ] // [ / Starting FA2 ]
} }
} }
}); });
} }
...@@ -697,30 +697,30 @@ function getGraphElement(elem) { ...@@ -697,30 +697,30 @@ function getGraphElement(elem) {
else return TW.partialGraph._core.graph.edgesIndex[elem] else return TW.partialGraph._core.graph.edgesIndex[elem]
} }
// Execution modes: // Execution modes:
// AlgorithmForSliders ( TW.partialGraph._core.graph.edges , "label" , "nodes1" , "weight") // AlgorithmForSliders ( TW.partialGraph._core.graph.edges , "label" , "nodes1" , "weight")
// AlgorithmForSliders ( TW.partialGraph._core.graph.edges , "label" , "nodes2" , "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" , "Document" , "size")
// AlgorithmForSliders ( TW.partialGraph._core.graph.nodes , "type" , "NGram" , "size") // AlgorithmForSliders ( TW.partialGraph._core.graph.nodes , "type" , "NGram" , "size")
function AlgorithmForSliders( elements , type_attrb , type , criteria) { function AlgorithmForSliders( elements , type_attrb , type , criteria) {
// // ( 1 ) // // ( 1 )
// // get visible sigma nodes|edges // // get visible sigma nodes|edges
if(isUndef(elements)) return {"steps":0 , "finalarray":[]}; if(isUndef(elements)) return {"steps":0 , "finalarray":[]};
var elems = []; var elems = [];
for(var e in elements) { for(var e in elements) {
if( elements[e][type_attrb]==type ) { if( elements[e][type_attrb]==type ) {
if(getGraphElement(e)) { if(getGraphElement(e)) {
elems.push(elements[e]) elems.push(elements[e])
} }
} }
} }
if(elems.length==0) if(elems.length==0)
return { "steps":0 , "finalarray":[] }; return { "steps":0 , "finalarray":[] };
// identifying if you received nodes or edges // identifying if you received nodes or edges
var edgeflag = ( !isNaN(elems.slice(-1)[0].id) || elems.slice(-1)[0].id.split(";").length>1)? true : false; var edgeflag = ( !isNaN(elems.slice(-1)[0].id) || elems.slice(-1)[0].id.split(";").length>1)? true : false;
// // ( 2 ) // // ( 2 )
// // extract [ "edgeID" : edgeWEIGHT ] | [ "nodeID" : nodeSIZE ] // // extract [ "edgeID" : edgeWEIGHT ] | [ "nodeID" : nodeSIZE ]
// // and save this into edges_weight | nodes_size // // and save this into edges_weight | nodes_size
var elem_attrb=[] var elem_attrb=[]
for (var i in elems) { for (var i in elems) {
...@@ -761,12 +761,12 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) { ...@@ -761,12 +761,12 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) {
var stepsize = Math.round( N / steps ); var stepsize = Math.round( N / steps );
// pr("-----------------------------------") // pr("-----------------------------------")
// pr("number of visible nodes|edges: "+N); // pr("number of visible nodes|edges: "+N);
// pr("number of steps : "+steps) // pr("number of steps : "+steps)
// pr("size of one step : "+stepsize) // pr("size of one step : "+stepsize)
// pr("-----------------------------------") // pr("-----------------------------------")
var finalarray = [] var finalarray = []
var counter=0 var counter=0
...@@ -783,7 +783,7 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) { ...@@ -783,7 +783,7 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) {
counter++; counter++;
} }
if(IDs.length==0) break; if(IDs.length==0) break;
finalarray[i] = (edgeflag)? IDs : IDs.map(Number); finalarray[i] = (edgeflag)? IDs : IDs.map(Number);
} }
// pr("finalarray: ") // pr("finalarray: ")
...@@ -795,10 +795,10 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) { ...@@ -795,10 +795,10 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) {
//============================= < SEARCH > =============================// //============================= < SEARCH > =============================//
function updateSearchLabels(id,name,type){ function updateSearchLabels(id,name,type){
labels.push({ labels.push({
'id' : id, 'id' : id,
'label' : name, 'label' : name,
'desc': type 'desc': type
}); });
} }
...@@ -806,7 +806,7 @@ function updateSearchLabels(id,name,type){ ...@@ -806,7 +806,7 @@ function updateSearchLabels(id,name,type){
function extractContext(string, context) { function extractContext(string, context) {
var matched = string.toLowerCase().indexOf(context.toLowerCase()); var matched = string.toLowerCase().indexOf(context.toLowerCase());
if (matched == -1) if (matched == -1)
return string.slice(0, 20) + '...'; return string.slice(0, 20) + '...';
var begin_pts = '...', end_pts = '...'; var begin_pts = '...', end_pts = '...';
...@@ -835,10 +835,10 @@ function extractContext(string, context) { ...@@ -835,10 +835,10 @@ function extractContext(string, context) {
// TODO check duplicate function with sigmaUtils exactfind() // TODO check duplicate function with sigmaUtils exactfind()
function searchLabel(string){ function searchLabel(string){
var id_node = ''; var id_node = '';
var n; var n;
nds = TW.partialGraph._core.graph.nodes.filter(function(x){return !x["hidden"]}); nds = TW.partialGraph._core.graph.nodes.filter(function(x){return !x["hidden"]});
for(var i in nds){ for(var i in nds){
n = nds[i] n = nds[i]
......
...@@ -51,7 +51,7 @@ function isUndef(variable){ ...@@ -51,7 +51,7 @@ function isUndef(variable){
$.fn.toggleClick = function(){ $.fn.toggleClick = function(){
methods = arguments, // store the passed arguments for future reference methods = arguments, // store the passed arguments for future reference
count = methods.length; // cache the number of methods count = methods.length; // cache the number of methods
//use return this to maintain jQuery chainability //use return this to maintain jQuery chainability
return this.each(function(i, item){ return this.each(function(i, item){
...@@ -101,7 +101,7 @@ function ArraySortByValue(array, sortFunc){ ...@@ -101,7 +101,7 @@ function ArraySortByValue(array, sortFunc){
for (var k in array) { for (var k in array) {
if (array.hasOwnProperty(k)) { if (array.hasOwnProperty(k)) {
tmp.push({ tmp.push({
key: k, key: k,
value: array[k] value: array[k]
}); });
if((array[k]) > oposMAX) oposMAX= array[k]; if((array[k]) > oposMAX) oposMAX= array[k];
...@@ -110,8 +110,8 @@ function ArraySortByValue(array, sortFunc){ ...@@ -110,8 +110,8 @@ function ArraySortByValue(array, sortFunc){
tmp.sort(function(o1, o2) { tmp.sort(function(o1, o2) {
return sortFunc(o1.value, o2.value); return sortFunc(o1.value, o2.value);
}); });
return tmp; return tmp;
} }
...@@ -121,7 +121,7 @@ function ArraySortByKey(array, sortFunc){ ...@@ -121,7 +121,7 @@ function ArraySortByKey(array, sortFunc){
for (var k in array) { for (var k in array) {
if (array.hasOwnProperty(k)) { if (array.hasOwnProperty(k)) {
tmp.push({ tmp.push({
key: k, key: k,
value: array[k] value: array[k]
}); });
} }
...@@ -129,10 +129,10 @@ function ArraySortByKey(array, sortFunc){ ...@@ -129,10 +129,10 @@ function ArraySortByKey(array, sortFunc){
tmp.sort(function(o1, o2) { tmp.sort(function(o1, o2) {
return sortFunc(o1.key, o2.key); return sortFunc(o1.key, o2.key);
}); });
return tmp; return tmp;
} }
function is_empty(obj) { function is_empty(obj) {
// Assume if it has a length property with a non-zero value // Assume if it has a length property with a non-zero value
...@@ -214,7 +214,7 @@ normalizeString = function(string, escapeHtml) { ...@@ -214,7 +214,7 @@ normalizeString = function(string, escapeHtml) {
// (or use jquery .text()) // (or use jquery .text())
saferString = function(string) { saferString = function(string) {
// TODO table in an outer scope // TODO table in an outer scope
conversions = { conversions = {
'&' : '&amp;' , '&' : '&amp;' ,
'<' : '&lt;' , '<' : '&lt;' ,
'>' : '&gt;' , '>' : '&gt;' ,
...@@ -222,17 +222,17 @@ saferString = function(string) { ...@@ -222,17 +222,17 @@ saferString = function(string) {
"'" : '&apos;' , "'" : '&apos;' ,
"{" : '&lcub;' , "{" : '&lcub;' ,
"}" : '&rcub;' , "}" : '&rcub;' ,
'%' : '&percnt;' '%' : '&percnt;'
} ; } ;
matchables = /[&<>"'{}%]/g ; matchables = /[&<>"'{}%]/g ;
if (! typeof string == "string") { if (! typeof string == "string") {
return "" ; return "" ;
} }
else { else {
return string.replace( return string.replace(
matchables, matchables,
function(char) { function(char) {
return conversions[char] return conversions[char]
} }
...@@ -243,17 +243,17 @@ saferString = function(string) { ...@@ -243,17 +243,17 @@ saferString = function(string) {
/** /**
* function to load a given css file * function to load a given css file
*/ */
loadCSS = function(href) { loadCSS = function(href) {
var cssLink = $("<link rel='stylesheet' type='text/css' href='"+href+"'>"); var cssLink = $("<link rel='stylesheet' type='text/css' href='"+href+"'>");
$("head").append(cssLink); $("head").append(cssLink);
}; };
/** /**
* function to load a given js file * function to load a given js file
*/ */
loadJS = function(src) { loadJS = function(src) {
var jsLink = $("<script type='text/javascript' src='"+src+"'>"); var jsLink = $("<script type='text/javascript' src='"+src+"'>");
$("head").append(jsLink); $("head").append(jsLink);
}; };
/* /*
Author: Corneliu S. (github.com/upphiminn) Author: Corneliu S. (github.com/upphiminn)
This is a javascript implementation of the Louvain This is a javascript implementation of the Louvain
community detection algorithm (http://arxiv.org/abs/0803.0476) community detection algorithm (http://arxiv.org/abs/0803.0476)
Based on https://bitbucket.org/taynaud/python-louvain/overview Based on https://bitbucket.org/taynaud/python-louvain/overview
*/ */
(function(){ (function(){
...@@ -48,16 +48,16 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -48,16 +48,16 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
}); });
return weight; return weight;
}; };
function get_neighbours_of_node(graph, node){ function get_neighbours_of_node(graph, node){
if(typeof graph._assoc_mat[node] == 'undefined') if(typeof graph._assoc_mat[node] == 'undefined')
return []; return [];
var neighbours = Object.keys(graph._assoc_mat[node]); var neighbours = Object.keys(graph._assoc_mat[node]);
return neighbours; return neighbours;
} }
function get_edge_weight(graph, node1, node2){ function get_edge_weight(graph, node1, node2){
return graph._assoc_mat[node1] ? graph._assoc_mat[node1][node2] : undefined; return graph._assoc_mat[node1] ? graph._assoc_mat[node1][node2] : undefined;
} }
...@@ -113,7 +113,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -113,7 +113,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
return temp; return temp;
} }
//Core-Algorithm Related //Core-Algorithm Related
function init_status(graph, status, part){ function init_status(graph, status, part){
status['nodes_to_com'] = {}; status['nodes_to_com'] = {};
status['total_weight'] = 0; status['total_weight'] = 0;
...@@ -184,13 +184,13 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -184,13 +184,13 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
var weights = {}; var weights = {};
var neighboorhood = get_neighbours_of_node(graph, node);//make iterable; var neighboorhood = get_neighbours_of_node(graph, node);//make iterable;
neighboorhood.forEach(function(neighbour, i){ neighboorhood.forEach(function(neighbour, i){
if(neighbour != node){ if(neighbour != node){
var weight = graph._assoc_mat[node][neighbour] || 1; var weight = graph._assoc_mat[node][neighbour] || 1;
var neighbourcom = status.nodes_to_com[neighbour]; var neighbourcom = status.nodes_to_com[neighbour];
weights[neighbourcom] = (weights[neighbourcom] || 0) + weight; weights[neighbourcom] = (weights[neighbourcom] || 0) + weight;
} }
}); });
return weights; return weights;
...@@ -212,7 +212,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -212,7 +212,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
function __renumber(dict){ function __renumber(dict){
var count = 0; var count = 0;
var ret = clone(dict); //deep copy :) var ret = clone(dict); //deep copy :)
var new_values = {}; var new_values = {};
var dict_keys = Object.keys(dict); var dict_keys = Object.keys(dict);
dict_keys.forEach(function(key){ dict_keys.forEach(function(key){
...@@ -255,7 +255,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -255,7 +255,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
best_increase = incr; best_increase = incr;
best_com = com; best_com = com;
} }
}); });
__insert(node, best_com, neigh_communities[best_com] || 0, status); __insert(node, best_com, neigh_communities[best_com] || 0, status);
...@@ -278,7 +278,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -278,7 +278,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
weight = edge.weight || 1; weight = edge.weight || 1;
var com1 = partition[edge.source]; var com1 = partition[edge.source];
var com2 = partition[edge.target]; var com2 = partition[edge.target];
w_prec = (get_edge_weight(ret, com1, com2) || 0); w_prec = (get_edge_weight(ret, com1, com2) || 0);
var new_weight = (w_prec + weight); var new_weight = (w_prec + weight);
add_edge_to_graph(ret, {'source': com1, 'target': com2, 'weight': new_weight}); add_edge_to_graph(ret, {'source': com1, 'target': com2, 'weight': new_weight});
}); });
...@@ -298,7 +298,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -298,7 +298,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
function generate_dendogram(graph, part_init){ function generate_dendogram(graph, part_init){
if(graph.edges.length == 0){ if(graph.edges.length == 0){
var part = {}; var part = {};
graph.nodes.forEach(function(node,i){ graph.nodes.forEach(function(node,i){
...@@ -326,14 +326,14 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -326,14 +326,14 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
break; break;
partition = __renumber(status.nodes_to_com); partition = __renumber(status.nodes_to_com);
status_list.push(partition); status_list.push(partition);
mod = new_mod; mod = new_mod;
current_graph = induced_graph(partition, current_graph); current_graph = induced_graph(partition, current_graph);
init_status(current_graph, status); init_status(current_graph, status);
} }
return status_list; return status_list;
} }
var core = function(){ var core = function(){
...@@ -361,7 +361,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -361,7 +361,7 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
'_assoc_mat': assoc_mat }; '_assoc_mat': assoc_mat };
} }
return core; return core;
}; };
core.partition_init = function(prttn){ core.partition_init = function(prttn){
...@@ -373,4 +373,4 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview ...@@ -373,4 +373,4 @@ Based on https://bitbucket.org/taynaud/python-louvain/overview
return core; return core;
} }
})(); })();
\ No newline at end of file
...@@ -47,13 +47,13 @@ var AjaxSync = (function(TYPE, URL, DATA, CT , DT) { ...@@ -47,13 +47,13 @@ var AjaxSync = (function(TYPE, URL, DATA, CT , DT) {
} }
Result = { "OK":true , "format":format , "data":data }; Result = { "OK":true , "format":format , "data":data };
}, },
error: function(exception) { error: function(exception) {
Result = { "OK":false , "format":false , "data":exception.status }; Result = { "OK":false , "format":false , "data":exception.status };
} }
}); });
return Result; return Result;
}).index(); }).index();
function getGexfPath(v){ function getGexfPath(v){
var gexfpath=(TW.gexfDictReverse[v])?TW.gexfDictReverse[v]:v; var gexfpath=(TW.gexfDictReverse[v])?TW.gexfDictReverse[v]:v;
return gexfpath; return gexfpath;
...@@ -73,7 +73,7 @@ var file ="" ...@@ -73,7 +73,7 @@ var file =""
if(!isUndef(getUrlParam.mode)) { // if {db|api}.json if(!isUndef(getUrlParam.mode)) { // if {db|api}.json
file = getUrlParam.mode file = getUrlParam.mode
} else { } else {
if( !isUndef(getUrlParam.file) ) if( !isUndef(getUrlParam.file) )
TW.mainfile.unshift( getUrlParam.file ); TW.mainfile.unshift( getUrlParam.file );
var unique_mainfile = TW.mainfile.filter(function(item, pos) { var unique_mainfile = TW.mainfile.filter(function(item, pos) {
...@@ -87,7 +87,7 @@ if(RES["OK"]) { ...@@ -87,7 +87,7 @@ if(RES["OK"]) {
var fileparam;// = { db|api.json , somefile.json|gexf } var fileparam;// = { db|api.json , somefile.json|gexf }
var the_data = RES["data"]; var the_data = RES["data"];
var the_file = ""; var the_file = "";
if ( !isUndef(getUrlParam.mode) && getUrlParam.mode=="db.json") { if ( !isUndef(getUrlParam.mode) && getUrlParam.mode=="db.json") {
...@@ -141,7 +141,7 @@ if(RES["OK"]) { ...@@ -141,7 +141,7 @@ if(RES["OK"]) {
fileparam = sub_RES["format"] fileparam = sub_RES["format"]
pr(the_data.length) pr(the_data.length)
pr(fileparam) pr(fileparam)
getUrlParam.file=the_file; getUrlParam.file=the_file;
console.log(" . .. . -. - .- . - -.") console.log(" . .. . -. - .- . - -.")
console.log(getUrlParam.file) console.log(getUrlParam.file)
...@@ -161,7 +161,7 @@ if(RES["OK"]) { ...@@ -161,7 +161,7 @@ if(RES["OK"]) {
if ( file!="db.json" && file!="api.json" ) if ( file!="db.json" && file!="api.json" )
fileparam = RES["format"]; fileparam = RES["format"];
start = new ParseCustom( fileparam , the_data ); start = new ParseCustom( fileparam , the_data );
categories = start.scanFile(); //user should choose the order of categories categories = start.scanFile(); //user should choose the order of categories
pr("Categories: ") pr("Categories: ")
...@@ -186,11 +186,11 @@ if(RES["OK"]) { ...@@ -186,11 +186,11 @@ if(RES["OK"]) {
for(var i in categories) { for(var i in categories) {
TW.Filters[i] = {} TW.Filters[i] = {}
TW.Filters[i]["#slidercat"+i+"edgesweight"] = true; TW.Filters[i]["#slidercat"+i+"edgesweight"] = true;
} }
// [ Initiating Sigma-Canvas ] // [ Initiating Sigma-Canvas ]
var twjs_ = new TinaWebJS('#sigma-example'); var twjs_ = new TinaWebJS('#sigma-example');
console.log( twjs_.AdjustSigmaCanvas() ); console.log( twjs_.AdjustSigmaCanvas() );
$( window ).resize(function() { console.log(twjs_.AdjustSigmaCanvas()) }); $( window ).resize(function() { console.log(twjs_.AdjustSigmaCanvas()) });
// [ / Initiating Sigma-Canvas ] // [ / Initiating Sigma-Canvas ]
...@@ -242,7 +242,7 @@ if(RES["OK"]) { ...@@ -242,7 +242,7 @@ if(RES["OK"]) {
var past = TW.partialGraph.states.slice(-2)[0] // avant Last var past = TW.partialGraph.states.slice(-2)[0] // avant Last
console.log("previous level: "+past.level) console.log("previous level: "+past.level)
console.log("new level: "+present.level) console.log("new level: "+present.level)
console.log(" % % % % % % % % % % ") console.log(" % % % % % % % % % % ")
console.log("") console.log("")
...@@ -270,7 +270,7 @@ if(RES["OK"]) { ...@@ -270,7 +270,7 @@ if(RES["OK"]) {
$("#category0").hide(); $("#category0").hide();
$("#category1").show(); $("#category1").show();
if($("#slidercat1nodesweight").html()=="") if($("#slidercat1nodesweight").html()=="")
NodeWeightFilter( this.categories , "#slidercat1nodesweight" , this.categories[1], "type" ,"size"); NodeWeightFilter( this.categories , "#slidercat1nodesweight" , this.categories[1], "type" ,"size");
if($("#slidercat1edgesweight").html()=="") if($("#slidercat1edgesweight").html()=="")
...@@ -288,7 +288,7 @@ if(RES["OK"]) { ...@@ -288,7 +288,7 @@ if(RES["OK"]) {
$("#category0").show(); $("#category0").show();
$("#category1").hide(); $("#category1").hide();
if($("#slidercat0nodesweight").html()=="") if($("#slidercat0nodesweight").html()=="")
NodeWeightFilter( this.categories , "#slidercat0nodesweight" , this.categories[0], "type" ,"size"); NodeWeightFilter( this.categories , "#slidercat0nodesweight" , this.categories[0], "type" ,"size");
if($("#slidercat0edgesweight").html()=="") if($("#slidercat0edgesweight").html()=="")
...@@ -300,7 +300,7 @@ if(RES["OK"]) { ...@@ -300,7 +300,7 @@ if(RES["OK"]) {
} }
set_ClustersLegend ( "clust_default" ) set_ClustersLegend ( "clust_default" )
} else { } else {
//finished //finished
$("#slidercat1nodessize").freshslider({ $("#slidercat1nodessize").freshslider({
step:1, step:1,
...@@ -320,7 +320,7 @@ if(RES["OK"]) { ...@@ -320,7 +320,7 @@ if(RES["OK"]) {
TW.partialGraph.draw(); TW.partialGraph.draw();
}); });
} }
}); });
} }
...@@ -370,6 +370,3 @@ ProcessDivsFlags() ; ...@@ -370,6 +370,3 @@ ProcessDivsFlags() ;
$("#searchinput").attr('placeholder', TW.strSearchBar) ; $("#searchinput").attr('placeholder', TW.strSearchBar) ;
console.log("finish") console.log("finish")
...@@ -10,7 +10,7 @@ function cancelSelection (fromTagCloud) { ...@@ -10,7 +10,7 @@ function cancelSelection (fromTagCloud) {
TW.partialGraph.refresh(); TW.partialGraph.refresh();
TW.partialGraph.states.slice(-1)[0].selections=[] TW.partialGraph.states.slice(-1)[0].selections=[]
//Nodes colors go back to normal //Nodes colors go back to normal
overNodes=false; overNodes=false;
e = TW.partialGraph._core.graph.edges; e = TW.partialGraph._core.graph.edges;
...@@ -19,18 +19,18 @@ function cancelSelection (fromTagCloud) { ...@@ -19,18 +19,18 @@ function cancelSelection (fromTagCloud) {
e[i].attr['grey'] = 0; e[i].attr['grey'] = 0;
} }
TW.partialGraph.draw(2,1,2); TW.partialGraph.draw(2,1,2);
TW.partialGraph.iterNodes(function(n){ TW.partialGraph.iterNodes(function(n){
n.active=false; n.active=false;
n.color = n.attr['grey'] ? n.attr['true_color'] : n.color; n.color = n.attr['grey'] ? n.attr['true_color'] : n.color;
n.attr['grey'] = 0; n.attr['grey'] = 0;
}).draw(2,1,2); }).draw(2,1,2);
//Nodes colors go back to normal //Nodes colors go back to normal
if(fromTagCloud==false){ if(fromTagCloud==false){
$("#names").html(""); $("#names").html("");
$("#topPapers").html(""); $("#topPapers").hide(); $("#topPapers").html(""); $("#topPapers").hide();
$("#opossiteNodes").html(""); $("#tab-container").hide(); $("#opossiteNodes").html(""); $("#tab-container").hide();
$("#information").html(""); $("#information").html("");
...@@ -38,11 +38,11 @@ function cancelSelection (fromTagCloud) { ...@@ -38,11 +38,11 @@ function cancelSelection (fromTagCloud) {
$("#unselectbutton").hide(); $("#unselectbutton").hide();
$("#tips").html(getTips()); $("#tips").html(getTips());
} }
// we send our "eraseNodeSet" event // we send our "eraseNodeSet" event
// (signal for plugins that any selection behavior is finished) // (signal for plugins that any selection behavior is finished)
$('#searchinput').trigger("tw:eraseNodeSet"); $('#searchinput').trigger("tw:eraseNodeSet");
for(var i in deselections){ for(var i in deselections){
if( !isUndef(TW.partialGraph._core.graph.nodesIndex[i]) ) { if( !isUndef(TW.partialGraph._core.graph.nodesIndex[i]) ) {
TW.partialGraph._core.graph.nodesIndex[i].forceLabel=false; TW.partialGraph._core.graph.nodesIndex[i].forceLabel=false;
...@@ -57,9 +57,9 @@ function cancelSelection (fromTagCloud) { ...@@ -57,9 +57,9 @@ function cancelSelection (fromTagCloud) {
TW.partialGraph.draw(); TW.partialGraph.draw();
} }
function highlightSelectedNodes(flag){ function highlightSelectedNodes(flag){
pr("\t***methods.js:highlightSelectedNodes(flag)"+flag+" selEmpty:"+is_empty(selections)) pr("\t***methods.js:highlightSelectedNodes(flag)"+flag+" selEmpty:"+is_empty(selections))
if(!is_empty(selections)){ if(!is_empty(selections)){
for(var i in selections) { for(var i in selections) {
if(TW.Nodes[i].type==TW.catSoc && swclickActual=="social"){ if(TW.Nodes[i].type==TW.catSoc && swclickActual=="social"){
node = TW.partialGraph._core.graph.nodesIndex[i]; node = TW.partialGraph._core.graph.nodesIndex[i];
...@@ -73,13 +73,13 @@ function highlightSelectedNodes(flag){ ...@@ -73,13 +73,13 @@ function highlightSelectedNodes(flag){
node = TW.partialGraph._core.graph.nodesIndex[i]; node = TW.partialGraph._core.graph.nodesIndex[i];
node.active = flag; node.active = flag;
} }
else break; else break;
} }
} }
} }
function alertCheckBox(eventCheck){ function alertCheckBox(eventCheck){
if(!isUndef(eventCheck.checked)) checkBox=eventCheck.checked; if(!isUndef(eventCheck.checked)) checkBox=eventCheck.checked;
} }
...@@ -98,7 +98,7 @@ function RefreshState(newNOW){ ...@@ -98,7 +98,7 @@ function RefreshState(newNOW){
if (newNOW!="") { if (newNOW!="") {
PAST = NOW; PAST = NOW;
NOW = newNOW; NOW = newNOW;
// if(NOW=="a" || NOW=="A" || NOW=="AaBb") { // if(NOW=="a" || NOW=="A" || NOW=="AaBb") {
// $("#category-A").show(); // $("#category-A").show();
// } // }
...@@ -108,7 +108,7 @@ function RefreshState(newNOW){ ...@@ -108,7 +108,7 @@ function RefreshState(newNOW){
} }
$("#category-A").hide(); $("#category-A").hide();
$("#category-B").hide(); $("#category-B").hide();
// i=0; for(var s in selections) { i++; break;} // i=0; for(var s in selections) { i++; break;}
// if(is_empty(selections) || i==0) LevelButtonDisable(true); // if(is_empty(selections) || i==0) LevelButtonDisable(true);
// else LevelButtonDisable(false); // else LevelButtonDisable(false);
...@@ -137,7 +137,7 @@ function RefreshState(newNOW){ ...@@ -137,7 +137,7 @@ function RefreshState(newNOW){
$("#semLoader").hide(); $("#semLoader").hide();
$("#category-A").show(); $("#category-A").show();
$("#colorGraph").show(); $("#colorGraph").show();
} }
if(NOW=="B" || NOW=="b") { if(NOW=="B" || NOW=="b") {
var N=( Object.keys(TW.Nodes).filter(function(n){return TW.Nodes[n].type==TW.catSem}) ).length var N=( Object.keys(TW.Nodes).filter(function(n){return TW.Nodes[n].type==TW.catSem}) ).length
...@@ -160,7 +160,7 @@ function RefreshState(newNOW){ ...@@ -160,7 +160,7 @@ function RefreshState(newNOW){
$.doTimeout(30,function (){ $.doTimeout(30,function (){
EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight"); EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
NodeWeightFilter ( "#sliderBNodeWeight" , "NGram", "type" , "size"); NodeWeightFilter ( "#sliderBNodeWeight" , "NGram", "type" , "size");
}); });
} else { } else {
$("#semLoader").css('visibility', 'visible'); $("#semLoader").css('visibility', 'visible');
...@@ -261,7 +261,7 @@ function htmlfied_nodesatts(elems){ ...@@ -261,7 +261,7 @@ function htmlfied_nodesatts(elems){
} }
} else { } else {
information += '<li>' + $("<div/>").html(node.htmlCont).text() + '</li>'; information += '<li>' + $("<div/>").html(node.htmlCont).text() + '</li>';
} }
socnodes.push(information) socnodes.push(information)
} }
...@@ -330,7 +330,7 @@ function updateLeftPanel_fix( sels , oppos ) { ...@@ -330,7 +330,7 @@ function updateLeftPanel_fix( sels , oppos ) {
if(oppos.length>0) { if(oppos.length>0) {
alterNodesDIV+='<div id="opossitesBox">';//tagcloud alterNodesDIV+='<div id="opossitesBox">';//tagcloud
alterNodesDIV+= htmlfied_alternodes( oppos ).join("\n") alterNodesDIV+= htmlfied_alternodes( oppos ).join("\n")
alterNodesDIV+= '</div>'; alterNodesDIV+= '</div>';
} }
...@@ -362,18 +362,18 @@ function updateLeftPanel_fix( sels , oppos ) { ...@@ -362,18 +362,18 @@ function updateLeftPanel_fix( sels , oppos ) {
//using the readmore.js //using the readmore.js
// ive put a limit for nodes-name div // ive put a limit for nodes-name div
// and opposite-nodes div aka tagcloud div // and opposite-nodes div aka tagcloud div
// and im commenting now because github is not // and im commenting now because github is not
// pushing my commit // pushing my commit
// because i need more lines, idk // because i need more lines, idk
$("#names").html(namesDIV).readmore({maxHeight:100}); $("#names").html(namesDIV).readmore({maxHeight:100});
$("#tab-container").show(); $("#tab-container").show();
$("#opossiteNodes").html(alterNodesDIV).readmore({maxHeight:200}); $("#opossiteNodes").html(alterNodesDIV).readmore({maxHeight:200});
$("#sameNodes").html(sameNodesDIV).readmore({maxHeight:200}); $("#sameNodes").html(sameNodesDIV).readmore({maxHeight:200});
$("#information").html(informationDIV); $("#information").html(informationDIV);
$("#tips").html(""); $("#tips").html("");
if(TW.categoriesIndex.length==1) getTopPapers("semantic"); if(TW.categoriesIndex.length==1) getTopPapers("semantic");
else getTopPapers(swclickActual); else getTopPapers(swclickActual);
} }
function printStates() { function printStates() {
...@@ -437,7 +437,7 @@ function graphTagCloudElem(nodes) { ...@@ -437,7 +437,7 @@ function graphTagCloudElem(nodes) {
nodes_2_colour[t]=false; nodes_2_colour[t]=false;
edges_2_colour[s+";"+t]=true; edges_2_colour[s+";"+t]=true;
edges_2_colour[t+";"+s]=true; edges_2_colour[t+";"+s]=true;
if( !selections[t] ) if( !selections[t] )
voisinage[ Number(t) ] = true; voisinage[ Number(t) ] = true;
} }
} }
...@@ -461,10 +461,10 @@ function graphTagCloudElem(nodes) { ...@@ -461,10 +461,10 @@ function graphTagCloudElem(nodes) {
// console.log( "\t" + voisinage[i] + " vs " + voisinage[j] ) // console.log( "\t" + voisinage[i] + " vs " + voisinage[j] )
add1Elem( voisinage[i]+";"+voisinage[j] ) add1Elem( voisinage[i]+";"+voisinage[j] )
} }
} }
} }
futurelevel = false; futurelevel = false;
...@@ -481,7 +481,7 @@ function graphTagCloudElem(nodes) { ...@@ -481,7 +481,7 @@ function graphTagCloudElem(nodes) {
TW.partialGraph.states[avantlastpos] = {}; TW.partialGraph.states[avantlastpos] = {};
TW.partialGraph.states[avantlastpos].level = present.level; TW.partialGraph.states[avantlastpos].level = present.level;
TW.partialGraph.states[avantlastpos].selections = present.selections; TW.partialGraph.states[avantlastpos].selections = present.selections;
TW.partialGraph.states[avantlastpos].type = present.type; TW.partialGraph.states[avantlastpos].type = present.type;
TW.partialGraph.states[avantlastpos].opposites = present.opposites; TW.partialGraph.states[avantlastpos].opposites = present.opposites;
TW.partialGraph.states[avantlastpos].categories = present.categories;//to_del TW.partialGraph.states[avantlastpos].categories = present.categories;//to_del
TW.partialGraph.states[avantlastpos].categoriesDict = present.categoriesDict;//to_del TW.partialGraph.states[avantlastpos].categoriesDict = present.categoriesDict;//to_del
...@@ -503,7 +503,7 @@ function graphTagCloudElem(nodes) { ...@@ -503,7 +503,7 @@ function graphTagCloudElem(nodes) {
} }
function greyEverything(){ function greyEverything(){
nds = TW.partialGraph._core.graph.nodes.filter(function(n) { nds = TW.partialGraph._core.graph.nodes.filter(function(n) {
return !n['hidden']; return !n['hidden'];
}); });
...@@ -515,7 +515,7 @@ function greyEverything(){ ...@@ -515,7 +515,7 @@ function greyEverything(){
} }
nds[i].attr['grey'] = 1; nds[i].attr['grey'] = 1;
} }
eds = TW.partialGraph._core.graph.edges.filter(function(e) { eds = TW.partialGraph._core.graph.edges.filter(function(e) {
return !e['hidden']; return !e['hidden'];
}); });
...@@ -535,18 +535,18 @@ function graphResetColor(){ ...@@ -535,18 +535,18 @@ function graphResetColor(){
eds = TW.partialGraph._core.graph.edges.filter(function(x) { eds = TW.partialGraph._core.graph.edges.filter(function(x) {
return !x['hidden']; return !x['hidden'];
}); });
for(var x in nds){ for(var x in nds){
n=nds[x]; n=nds[x];
n.attr["grey"] = 0; n.attr["grey"] = 0;
n.color = n.attr["true_color"]; n.color = n.attr["true_color"];
} }
for(var x in eds){ for(var x in eds){
e=eds[x]; e=eds[x];
e.attr["grey"] = 0; e.attr["grey"] = 0;
e.color = e.attr["true_color"]; e.color = e.attr["true_color"];
} }
} }
function hideEverything(){ function hideEverything(){
...@@ -595,7 +595,7 @@ function add1Elem(id) { ...@@ -595,7 +595,7 @@ function add1Elem(id) {
} else { // It's an edge! } else { // It's an edge!
if(!isUndef(gete(id))) return; if(!isUndef(gete(id))) return;
if(TW.Edges[id] && !TW.Edges[id].lock){ if(TW.Edges[id] && !TW.Edges[id].lock){
// var present = TW.partialGraph.states.slice(-1)[0]; // var present = TW.partialGraph.states.slice(-1)[0];
var anedge = { var anedge = {
id: id, id: id,
sourceID: TW.Edges[id].source, sourceID: TW.Edges[id].source,
...@@ -625,7 +625,7 @@ function pushFilterValue(filtername,arg){ ...@@ -625,7 +625,7 @@ function pushFilterValue(filtername,arg){
} }
function saveGraph() { function saveGraph() {
size = getByID("check_size").checked size = getByID("check_size").checked
color = getByID("check_color").checked color = getByID("check_color").checked
atts = {"size":size,"color":color} atts = {"size":size,"color":color}
...@@ -657,15 +657,15 @@ function saveGEXF(nodes,edges,atts){ ...@@ -657,15 +657,15 @@ function saveGEXF(nodes,edges,atts){
gexf += '</attributes>\n'; gexf += '</attributes>\n';
gexf += "<nodes>\n"; gexf += "<nodes>\n";
for(var n in nodes){ for(var n in nodes){
gexf += '<node id="'+nodes[n].id+'" label="'+nodes[n].label+'">\n'; gexf += '<node id="'+nodes[n].id+'" label="'+nodes[n].label+'">\n';
gexf += ' <viz:position x="'+nodes[n].x+'" y="'+nodes[n].y+'" z="0" />\n'; gexf += ' <viz:position x="'+nodes[n].x+'" y="'+nodes[n].y+'" z="0" />\n';
if(atts["color"]) gexf += ' <viz:size value="'+nodes[n].size+'" />\n'; if(atts["color"]) gexf += ' <viz:size value="'+nodes[n].size+'" />\n';
if(atts["color"]) { if(atts["color"]) {
col = hex2rga(nodes[n].color); col = hex2rga(nodes[n].color);
gexf += ' <viz:color r="'+col[0]+'" g="'+col[1]+'" b="'+col[2]+'" a="1"/>\n'; gexf += ' <viz:color r="'+col[0]+'" g="'+col[1]+'" b="'+col[2]+'" a="1"/>\n';
} }
gexf += ' <attvalues>\n'; gexf += ' <attvalues>\n';
gexf += ' <attvalue for="0" value="'+nodes[n].type+'"/>\n'; gexf += ' <attvalue for="0" value="'+nodes[n].type+'"/>\n';
gexf += ' <attvalue for="1" value="'+TW.Nodes[nodes[n].id].CC+'"/>\n'; gexf += ' <attvalue for="1" value="'+TW.Nodes[nodes[n].id].CC+'"/>\n';
...@@ -673,7 +673,7 @@ function saveGEXF(nodes,edges,atts){ ...@@ -673,7 +673,7 @@ function saveGEXF(nodes,edges,atts){
gexf += '</node>\n'; gexf += '</node>\n';
} }
gexf += "\n</nodes>\n"; gexf += "\n</nodes>\n";
gexf += "<edges>\n"; gexf += "<edges>\n";
cont = 1; cont = 1;
for(var e in edges){ for(var e in edges){
gexf += '<edge id="'+cont+'" source="'+edges[e].source.id+'" target="'+edges[e].target.id+'" weight="'+edges[e].weight+'">\n'; gexf += '<edge id="'+cont+'" source="'+edges[e].source.id+'" target="'+edges[e].target.id+'" weight="'+edges[e].weight+'">\n';
...@@ -687,9 +687,9 @@ function saveGEXF(nodes,edges,atts){ ...@@ -687,9 +687,9 @@ function saveGEXF(nodes,edges,atts){
} }
function saveGraphIMG(){ function saveGraphIMG(){
var strDownloadMime = "image/octet-stream" var strDownloadMime = "image/octet-stream"
var nodesDiv = TW.partialGraph._core.domElements.nodes; var nodesDiv = TW.partialGraph._core.domElements.nodes;
var nodesCtx = nodesDiv.getContext("2d"); var nodesCtx = nodesDiv.getContext("2d");
......
...@@ -149,7 +149,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -149,7 +149,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
} }
} else { } else {
if( self.firstit ) { if( self.firstit ) {
n.x = self.Ox + self.R*Math.cos(Math.PI*self.stepDeg*mult); n.x = self.Ox + self.R*Math.cos(Math.PI*self.stepDeg*mult);
n.y = self.Oy + self.R*Math.sin(Math.PI*self.stepDeg*mult); n.y = self.Oy + self.R*Math.sin(Math.PI*self.stepDeg*mult);
...@@ -158,7 +158,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -158,7 +158,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
} }
} }
}); });
self.firstit = false ; self.firstit = false ;
...@@ -274,21 +274,21 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -274,21 +274,21 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
if (self.p.edgeWeightInfluence == 0) { if (self.p.edgeWeightInfluence == 0) {
while (i < edges.length && i < self.state.index + cInt) { while (i < edges.length && i < self.state.index + cInt) {
var e = edges[i++]; var e = edges[i++];
if(!e.hidden) { if(!e.hidden) {
Attraction.apply_nn(e.source, e.target, 1); Attraction.apply_nn(e.source, e.target, 1);
} }
} }
} else if (self.p.edgeWeightInfluence == 1) { } else if (self.p.edgeWeightInfluence == 1) {
while (i < edges.length && i < self.state.index + cInt) { while (i < edges.length && i < self.state.index + cInt) {
var e = edges[i++]; var e = edges[i++];
if(!e.hidden) { if(!e.hidden) {
Attraction.apply_nn(e.source, e.target, e.weight || 1); Attraction.apply_nn(e.source, e.target, e.weight || 1);
} }
} }
} else { } else {
while (i < edges.length && i < self.state.index + cInt) { while (i < edges.length && i < self.state.index + cInt) {
var e = edges[i++]; var e = edges[i++];
if(!e.hidden) { if(!e.hidden) {
Attraction.apply_nn( Attraction.apply_nn(
e.source, e.target, e.source, e.target,
Math.pow(e.weight || 1, self.p.edgeWeightInfluence) Math.pow(e.weight || 1, self.p.edgeWeightInfluence)
...@@ -325,7 +325,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -325,7 +325,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
totalSwinging += n.fa2.mass * swinging; totalSwinging += n.fa2.mass * swinging;
swingingSum += swinging; swingingSum += swinging;
promdxdy += (Math.abs(n.fa2.dx)+Math.abs(n.fa2.dy))/2; /**/ promdxdy += (Math.abs(n.fa2.dx)+Math.abs(n.fa2.dy))/2; /**/
totalEffectiveTraction += n.fa2.mass * totalEffectiveTraction += n.fa2.mass *
0.5 * 0.5 *
Math.sqrt( Math.sqrt(
...@@ -334,16 +334,16 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -334,16 +334,16 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
); );
} }
}); });
self.p.totalSwinging = totalSwinging; self.p.totalSwinging = totalSwinging;
var convg= ((Math.pow(nodes.length,2))/promdxdy); /**/ var convg= ((Math.pow(nodes.length,2))/promdxdy); /**/
var swingingVSnodes_length = swingingSum/nodes.length; /**/ var swingingVSnodes_length = swingingSum/nodes.length; /**/
if(stopcriteria && (convg > swingingVSnodes_length)){ if(stopcriteria && (convg > swingingVSnodes_length)){
pr("i've applied the stopcriteria: "+self.count) pr("i've applied the stopcriteria: "+self.count)
TW.partialGraph.stopForceAtlas2(); TW.partialGraph.stopForceAtlas2();
} }
self.p.totalEffectiveTraction = totalEffectiveTraction; self.p.totalEffectiveTraction = totalEffectiveTraction;
// We want that swingingMovement < tolerance * convergenceMovement // We want that swingingMovement < tolerance * convergenceMovement
...@@ -362,7 +362,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -362,7 +362,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
// Save old coordinates // Save old coordinates
nodes.forEach(function(n) { nodes.forEach(function(n) {
if(!n.hidden && n.degree>0) { if(!n.hidden && n.degree>0) {
n.old_x = +n.x; n.old_x = +n.x;
n.old_y = +n.y; n.old_y = +n.y;
} }
...@@ -403,7 +403,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) { ...@@ -403,7 +403,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
} }
} }
if(self.isolated>0 && self.count%50 == 0) { if(self.isolated>0 && self.count%50 == 0) {
nodes.forEach(function(n) { nodes.forEach(function(n) {
if(n.degree>0) { if(n.degree>0) {
...@@ -994,7 +994,7 @@ sigma.forceatlas2.Region = function(nodes, depth) { ...@@ -994,7 +994,7 @@ sigma.forceatlas2.Region = function(nodes, depth) {
massCenterX: 0, massCenterX: 0,
massCenterY: 0 massCenterY: 0
}; };
this.updateMassAndGeometry(); this.updateMassAndGeometry();
} }
...@@ -1130,7 +1130,7 @@ sigma.publicPrototype.startForceAtlas2 = function() { ...@@ -1130,7 +1130,7 @@ sigma.publicPrototype.startForceAtlas2 = function() {
if(isolatedBCauseFilter==ene) { if(isolatedBCauseFilter==ene) {
TW.partialGraph.stopForceAtlas2(); TW.partialGraph.stopForceAtlas2();
return; return;
} }
$("#overviewzone").hide(); $("#overviewzone").hide();
...@@ -1148,7 +1148,7 @@ sigma.publicPrototype.startForceAtlas2 = function() { ...@@ -1148,7 +1148,7 @@ sigma.publicPrototype.startForceAtlas2 = function() {
return; return;
} }
}); });
} }
}; };
......
...@@ -487,7 +487,7 @@ sigma.classes.Cascade = function() { ...@@ -487,7 +487,7 @@ sigma.classes.Cascade = function() {
drawHover(); drawHover();
drawActive(); drawActive();
// if(cursor_size>0){ // if(cursor_size>0){
// pr("moving with mouse-circle ON"); // pr("moving with mouse-circle ON");
// } // }
...@@ -1074,9 +1074,9 @@ sigma.classes.Cascade = function() { ...@@ -1074,9 +1074,9 @@ sigma.classes.Cascade = function() {
var s = 'Edge\'s target "' + target + '" does not exist yet.'; var s = 'Edge\'s target "' + target + '" does not exist yet.';
throw new Error(s); throw new Error(s);
} }
// var ident = params.sourceID.charAt(0)+params.targetID.charAt(0); // var ident = params.sourceID.charAt(0)+params.targetID.charAt(0);
//edge color will be the combination of the 2 node colors //edge color will be the combination of the 2 node colors
var a = self.nodesIndex[source]['color']; var a = self.nodesIndex[source]['color'];
var b = self.nodesIndex[target]['color']; var b = self.nodesIndex[target]['color'];
...@@ -1098,7 +1098,7 @@ sigma.classes.Cascade = function() { ...@@ -1098,7 +1098,7 @@ sigma.classes.Cascade = function() {
var b = (a[2] + b[2]) >> 1; var b = (a[2] + b[2]) >> 1;
// var color = '#'+sigma.tools.rgbToHex(parseFloat(r),parseFloat(g),parseFloat(b)) // var color = '#'+sigma.tools.rgbToHex(parseFloat(r),parseFloat(g),parseFloat(b))
var color = "rgba( "+r+", "+g+" , "+b+" ,0.5)"; var color = "rgba( "+r+", "+g+" , "+b+" ,0.5)";
//pr(params.label); //pr(params.label);
// if(params.label=="nodes1") { // if(params.label=="nodes1") {
// color = "#cedc75"; // color = "#cedc75";
...@@ -1127,7 +1127,7 @@ sigma.classes.Cascade = function() { ...@@ -1127,7 +1127,7 @@ sigma.classes.Cascade = function() {
e['source']['outDegree']++; e['source']['outDegree']++;
e['target']['degree']++; e['target']['degree']++;
e['target']['inDegree']++; e['target']['inDegree']++;
for (var k in params) { for (var k in params) {
switch (k) { switch (k) {
case 'id': case 'id':
...@@ -1271,7 +1271,7 @@ sigma.classes.Cascade = function() { ...@@ -1271,7 +1271,7 @@ sigma.classes.Cascade = function() {
* Deletes every nodes and edges from the graph. * Deletes every nodes and edges from the graph.
* @return {Graph} Returns itself. * @return {Graph} Returns itself.
*/ */
function empty() { function empty() {
if(TW.partialGraph) { if(TW.partialGraph) {
if(TW.partialGraph.forceatlas2) { if(TW.partialGraph.forceatlas2) {
...@@ -1297,7 +1297,7 @@ sigma.classes.Cascade = function() { ...@@ -1297,7 +1297,7 @@ sigma.classes.Cascade = function() {
self.edges.splice(0, self.edges.length); self.edges.splice(0, self.edges.length);
} }
self.edgesIndex = {}; self.edgesIndex = {};
if(self.edgesIndex.length>0) { if(self.edgesIndex.length>0) {
pr("splicing edgesIndex") pr("splicing edgesIndex")
self.edgesIndex.splice(0, self.edgesIndex.length); self.edgesIndex.splice(0, self.edgesIndex.length);
...@@ -1773,7 +1773,7 @@ sigma.classes.Cascade = function() { ...@@ -1773,7 +1773,7 @@ sigma.classes.Cascade = function() {
return self; return self;
}; };
this.emptyGraph = function() { this.emptyGraph = function() {
s.graph.empty(); s.graph.empty();
return self; return self;
...@@ -2223,13 +2223,13 @@ sigma.classes.Cascade = function() { ...@@ -2223,13 +2223,13 @@ sigma.classes.Cascade = function() {
shape = self.p.defaultNodeShape; shape = self.p.defaultNodeShape;
} }
ctx = nodesCtx; ctx = nodesCtx;
ctx.fillStyle = node['color']; ctx.fillStyle = node['color'];
// Node border: // Node border:
ctx.beginPath(); ctx.beginPath();
switch(shape) { switch(shape) {
case 'square': case 'square':
wh=(node['displaySize'] * 2) + self.p.borderSize; wh=(node['displaySize'] * 2) + self.p.borderSize;
...@@ -2237,7 +2237,7 @@ sigma.classes.Cascade = function() { ...@@ -2237,7 +2237,7 @@ sigma.classes.Cascade = function() {
node['displayY']-wh/2, node['displayY']-wh/2,
wh, wh,
wh); wh);
// ctx.strokeRect(node['displayX']-size-(1.3), // ctx.strokeRect(node['displayX']-size-(1.3),
// node['displayY']-size-(1.3), // node['displayY']-size-(1.3),
// (node['displaySize'] * 2) + self.p.borderSize, // (node['displaySize'] * 2) + self.p.borderSize,
...@@ -2257,15 +2257,15 @@ sigma.classes.Cascade = function() { ...@@ -2257,15 +2257,15 @@ sigma.classes.Cascade = function() {
} }
ctx.closePath(); ctx.closePath();
ctx.fill(); ctx.fill();
// Node: // Node:
ctx.beginPath(); ctx.beginPath();
switch(shape) { switch(shape) {
case 'square': case 'square':
wh=size*2; wh=size*2;
ctx.fillRect(node['displayX']-wh/2, ctx.fillRect(node['displayX']-wh/2,
node['displayY']-wh/2, node['displayY']-wh/2,
wh, wh,
wh); wh);
...@@ -2309,12 +2309,12 @@ sigma.classes.Cascade = function() { ...@@ -2309,12 +2309,12 @@ sigma.classes.Cascade = function() {
* @param {Object} edge The edge to draw. * @param {Object} edge The edge to draw.
* @return {Plotter} Returns itself. * @return {Plotter} Returns itself.
*/ */
function drawEdge(edge) { function drawEdge(edge) {
var x1 = edge['source']['displayX']; var x1 = edge['source']['displayX'];
var y1 = edge['source']['displayY']; var y1 = edge['source']['displayY'];
var x2 = edge['target']['displayX']; var x2 = edge['target']['displayX'];
var y2 = edge['target']['displayY']; var y2 = edge['target']['displayY'];
var color = edge['color']; var color = edge['color'];
if(!color) { if(!color) {
var a = edge['source']['color']; var a = edge['source']['color'];
...@@ -2354,7 +2354,7 @@ sigma.classes.Cascade = function() { ...@@ -2354,7 +2354,7 @@ sigma.classes.Cascade = function() {
} }
else { else {
ctx.lineWidth = edge['displaySize'] / 3;/**/ ctx.lineWidth = edge['displaySize'] / 3;/**/
} }
} }
else { else {
//overNodes = TRUE //overNodes = TRUE
...@@ -2402,7 +2402,7 @@ sigma.classes.Cascade = function() { ...@@ -2402,7 +2402,7 @@ sigma.classes.Cascade = function() {
var fontSize;/* = self.p.labelSize == 'fixed' ? var fontSize;/* = self.p.labelSize == 'fixed' ?
self.p.defaultLabelSize : self.p.defaultLabelSize :
self.p.labelSizeRatio * node['displaySize'];*/ self.p.labelSizeRatio * node['displaySize'];*/
fontSize=(self.p.labelSizeRatio*node['displaySize'])<self.p.defaultLabelSize ? fontSize=(self.p.labelSizeRatio*node['displaySize'])<self.p.defaultLabelSize ?
self.p.defaultLabelSize: self.p.defaultLabelSize:
self.p.labelSizeRatio*node['displaySize']; self.p.labelSizeRatio*node['displaySize'];
...@@ -2430,7 +2430,7 @@ sigma.classes.Cascade = function() { ...@@ -2430,7 +2430,7 @@ sigma.classes.Cascade = function() {
function drawHoverNode(node) { function drawHoverNode(node) {
size = Math.round(node['displaySize'] * 10) / 10; size = Math.round(node['displaySize'] * 10) / 10;
ctx = hoverCtx; ctx = hoverCtx;
nodeShape = node['shape']; nodeShape = node['shape'];
if(!nodeShape) { if(!nodeShape) {
nodeShape = self.p.defaultNodeShape; nodeShape = self.p.defaultNodeShape;
...@@ -2439,7 +2439,7 @@ sigma.classes.Cascade = function() { ...@@ -2439,7 +2439,7 @@ sigma.classes.Cascade = function() {
/*var fontSize = self.p.labelSize == 'fixed' ? /*var fontSize = self.p.labelSize == 'fixed' ?
self.p.defaultLabelSize : self.p.defaultLabelSize :
self.p.labelSizeRatio * node['displaySize'];*/ self.p.labelSizeRatio * node['displaySize'];*/
fontSize=(self.p.labelSizeRatio*node['displaySize'])<self.p.defaultLabelSize ? fontSize=(self.p.labelSizeRatio*node['displaySize'])<self.p.defaultLabelSize ?
self.p.defaultLabelSize: self.p.defaultLabelSize:
self.p.labelSizeRatio*node['displaySize']; self.p.labelSizeRatio*node['displaySize'];
...@@ -2485,7 +2485,7 @@ sigma.classes.Cascade = function() { ...@@ -2485,7 +2485,7 @@ sigma.classes.Cascade = function() {
ctx.fillStyle = self.p.nodeBorderColor == 'node' ? ctx.fillStyle = self.p.nodeBorderColor == 'node' ?
(node['color'] || self.p.defaultNodeColor) : (node['color'] || self.p.defaultNodeColor) :
self.p.defaultNodeBorderColor; self.p.defaultNodeBorderColor;
switch(nodeShape) { switch(nodeShape) {
case 'square': case 'square':
ctx.lineWidth = 2; ctx.lineWidth = 2;
...@@ -2553,7 +2553,7 @@ sigma.classes.Cascade = function() { ...@@ -2553,7 +2553,7 @@ sigma.classes.Cascade = function() {
function drawActiveNode(node) { function drawActiveNode(node) {
size = Math.round(node['displaySize'] * 10) / 10; size = Math.round(node['displaySize'] * 10) / 10;
ctx = hoverCtx; ctx = hoverCtx;
if (!isOnScreen(node)) { if (!isOnScreen(node)) {
return self; return self;
} }
...@@ -2562,15 +2562,15 @@ sigma.classes.Cascade = function() { ...@@ -2562,15 +2562,15 @@ sigma.classes.Cascade = function() {
if(!nodeShape) { if(!nodeShape) {
nodeShape = self.p.defaultNodeShape; nodeShape = self.p.defaultNodeShape;
} }
/*var fontSize = self.p.labelSize == 'fixed' ? /*var fontSize = self.p.labelSize == 'fixed' ?
self.p.defaultLabelSize : self.p.defaultLabelSize :
self.p.labelSizeRatio * node['displaySize'];*/ self.p.labelSizeRatio * node['displaySize'];*/
fontSize=(self.p.labelSizeRatio*node['displaySize'])<self.p.defaultLabelSize ? fontSize=(self.p.labelSizeRatio*node['displaySize'])<self.p.defaultLabelSize ?
self.p.defaultLabelSize: self.p.defaultLabelSize:
self.p.labelSizeRatio*node['displaySize']; self.p.labelSizeRatio*node['displaySize'];
ctx.font = (self.p.activeFontStyle || self.p.fontStyle || '') + ' ' + ctx.font = (self.p.activeFontStyle || self.p.fontStyle || '') + ' ' +
fontSize + 'px ' + fontSize + 'px ' +
(self.p.activeFont || self.p.font || ''); (self.p.activeFont || self.p.font || '');
...@@ -2578,13 +2578,13 @@ sigma.classes.Cascade = function() { ...@@ -2578,13 +2578,13 @@ sigma.classes.Cascade = function() {
ctx.fillStyle = self.p.labelHoverBGColor == 'node' ? ctx.fillStyle = self.p.labelHoverBGColor == 'node' ?
(node['color'] || self.p.defaultNodeColor) : (node['color'] || self.p.defaultNodeColor) :
self.p.defaultActiveLabelBGColor; self.p.defaultActiveLabelBGColor;
switch(nodeShape) { switch(nodeShape) {
case 'square': case 'square':
// Node border: // Node border:
ctx.beginPath(); ctx.beginPath();
ctx.lineWidth = 2; ctx.lineWidth = 2;
wh=(node['displaySize'] * 2) + self.p.borderSize; wh=(node['displaySize'] * 2) + self.p.borderSize;
ctx.strokeStyle="red"; ctx.strokeStyle="red";
...@@ -2623,10 +2623,10 @@ sigma.classes.Cascade = function() { ...@@ -2623,10 +2623,10 @@ sigma.classes.Cascade = function() {
ctx.shadowOffsetX = 0; ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0; ctx.shadowOffsetY = 0;
ctx.shadowBlur = 0; ctx.shadowBlur = 0;
// Node border: // Node border:
ctx.beginPath(); ctx.beginPath();
ctx.fillStyle = self.p.nodeBorderColor == 'node' ? ctx.fillStyle = self.p.nodeBorderColor == 'node' ?
(node['color'] || self.p.defaultNodeColor) : (node['color'] || self.p.defaultNodeColor) :
self.p.defaultNodeBorderColor; self.p.defaultNodeBorderColor;
...@@ -2637,11 +2637,11 @@ sigma.classes.Cascade = function() { ...@@ -2637,11 +2637,11 @@ sigma.classes.Cascade = function() {
0, 0,
Math.PI * 2, Math.PI * 2,
true); true);
ctx.closePath(); ctx.closePath();
ctx.fill(); ctx.fill();
// Node: // Node:
ctx.beginPath(); ctx.beginPath();
ctx.fillStyle = self.p.nodeActiveColor == 'node' ? ctx.fillStyle = self.p.nodeActiveColor == 'node' ?
...@@ -2656,7 +2656,7 @@ sigma.classes.Cascade = function() { ...@@ -2656,7 +2656,7 @@ sigma.classes.Cascade = function() {
ctx.closePath(); ctx.closePath();
ctx.fill(); ctx.fill();
break; break;
} }
// Label: // Label:
...@@ -2912,7 +2912,7 @@ sigma.classes.Cascade = function() { ...@@ -2912,7 +2912,7 @@ sigma.classes.Cascade = function() {
); );
TW.partialGraph.centreX = (self.mouseX*(overviewWidth/(TW.partialGraph._core.width-1))); TW.partialGraph.centreX = (self.mouseX*(overviewWidth/(TW.partialGraph._core.width-1)));
TW.partialGraph.centreY = (self.mouseY*(overviewHeight/(TW.partialGraph._core.height-1))); TW.partialGraph.centreY = (self.mouseY*(overviewHeight/(TW.partialGraph._core.height-1)));
if (self.p['blockScroll']) { if (self.p['blockScroll']) {
if (event.preventDefault) { if (event.preventDefault) {
event.preventDefault(); event.preventDefault();
...@@ -3803,4 +3803,3 @@ sigma.classes.Cascade = function() { ...@@ -3803,4 +3803,3 @@ sigma.classes.Cascade = function() {
sigma.publicPrototype = SigmaPublic.prototype; sigma.publicPrototype = SigmaPublic.prototype;
})(); })();
...@@ -39,10 +39,10 @@ ParseCustom.prototype.scanFile = function() { ...@@ -39,10 +39,10 @@ ParseCustom.prototype.scanFile = function() {
switch (this.format) { switch (this.format) {
case "api.json": case "api.json":
pr("scanFile: "+this.format) pr("scanFile: "+this.format)
break; break;
case "db.json": case "db.json":
pr("scanFile: "+this.format) pr("scanFile: "+this.format)
break; break;
case "json": case "json":
pr("scanFile: "+this.format) pr("scanFile: "+this.format)
categories = this.getJSONCategories( this.data ); categories = this.getJSONCategories( this.data );
...@@ -53,7 +53,7 @@ ParseCustom.prototype.scanFile = function() { ...@@ -53,7 +53,7 @@ ParseCustom.prototype.scanFile = function() {
categories = this.getGEXFCategories( this.data ); categories = this.getGEXFCategories( this.data );
return categories; return categories;
break; break;
default: default:
pr("scanFile jsaispas: "+this.format) pr("scanFile jsaispas: "+this.format)
break; break;
} }
...@@ -65,10 +65,10 @@ ParseCustom.prototype.makeDicts = function(categories) { ...@@ -65,10 +65,10 @@ ParseCustom.prototype.makeDicts = function(categories) {
switch (this.format) { switch (this.format) {
case "api.json": case "api.json":
pr("makeDicts: "+this.format) pr("makeDicts: "+this.format)
break; break;
case "db.json": case "db.json":
pr("makeDicts: "+this.format) pr("makeDicts: "+this.format)
break; break;
case "json": case "json":
pr("makeDicts: "+this.format) pr("makeDicts: "+this.format)
dictionaries = this.parseJSON( categories ); dictionaries = this.parseJSON( categories );
...@@ -79,7 +79,7 @@ ParseCustom.prototype.makeDicts = function(categories) { ...@@ -79,7 +79,7 @@ ParseCustom.prototype.makeDicts = function(categories) {
dictionaries = this.parseGEXF( categories ); dictionaries = this.parseGEXF( categories );
return dictionaries; return dictionaries;
break; break;
default: default:
pr("makeDicts jsaispas: "+this.format) pr("makeDicts jsaispas: "+this.format)
break; break;
} }
...@@ -90,9 +90,9 @@ ParseCustom.prototype.makeDicts = function(categories) { ...@@ -90,9 +90,9 @@ ParseCustom.prototype.makeDicts = function(categories) {
function scanGexf(gexf) { function scanGexf(gexf) {
var categoriesDict={}, categories=[]; var categoriesDict={}, categories=[];
nodesNodes = gexf.getElementsByTagName('nodes'); nodesNodes = gexf.getElementsByTagName('nodes');
for(i=0; i<nodesNodes.length; i++){ for(i=0; i<nodesNodes.length; i++){
var nodesNode = nodesNodes[i]; // Each xml node 'nodes' (plural) var nodesNode = nodesNodes[i]; // Each xml node 'nodes' (plural)
node = nodesNode.getElementsByTagName('node'); node = nodesNode.getElementsByTagName('node');
for(j=0; j<node.length; j++){ for(j=0; j<node.length; j++){
attvalueNodes = node[j].getElementsByTagName('attvalue'); attvalueNodes = node[j].getElementsByTagName('attvalue');
for(k=0; k<attvalueNodes.length; k++){ for(k=0; k<attvalueNodes.length; k++){
...@@ -144,53 +144,53 @@ function dictfyGexf( gexf , categories ){ ...@@ -144,53 +144,53 @@ function dictfyGexf( gexf , categories ){
var edges={}, nodes={}, nodes1={}, nodes2=false, bipartiteD2N=false, bipartiteN2D=false; var edges={}, nodes={}, nodes1={}, nodes2=false, bipartiteD2N=false, bipartiteN2D=false;
if(categories.length>1) { if(categories.length>1) {
nodes2={}, bipartiteD2N={}, bipartiteN2D={} nodes2={}, bipartiteD2N={}, bipartiteN2D={}
} }
var i, j, k; var i, j, k;
var nodesAttributes = []; // The list of attributes of the nodes of the graph that we build in json var nodesAttributes = []; // The list of attributes of the nodes of the graph that we build in json
var edgesAttributes = []; // The list of attributes of the edges of the graph that we build in json var edgesAttributes = []; // The list of attributes of the edges of the graph that we build in json
var attributesNodes = gexf.getElementsByTagName('attributes'); // In the gexf (that is an xml), the list of xml nodes 'attributes' (note the plural 's') var attributesNodes = gexf.getElementsByTagName('attributes'); // In the gexf (that is an xml), the list of xml nodes 'attributes' (note the plural 's')
for(i = 0; i<attributesNodes.length; i++){ for(i = 0; i<attributesNodes.length; i++){
var attributesNode = attributesNodes[i]; // attributesNode is each xml node 'attributes' (plural) var attributesNode = attributesNodes[i]; // attributesNode is each xml node 'attributes' (plural)
if(attributesNode.getAttribute('class') == 'node'){ if(attributesNode.getAttribute('class') == 'node'){
var attributeNodes = attributesNode.getElementsByTagName('attribute'); // The list of xml nodes 'attribute' (no 's') var attributeNodes = attributesNode.getElementsByTagName('attribute'); // The list of xml nodes 'attribute' (no 's')
for(j = 0; j<attributeNodes.length; j++){ for(j = 0; j<attributeNodes.length; j++){
var attributeNode = attributeNodes[j]; // Each xml node 'attribute' var attributeNode = attributeNodes[j]; // Each xml node 'attribute'
var id = attributeNode.getAttribute('id'), var id = attributeNode.getAttribute('id'),
title = attributeNode.getAttribute('title'), title = attributeNode.getAttribute('title'),
type = attributeNode.getAttribute('type'); type = attributeNode.getAttribute('type');
var attribute = { var attribute = {
id:id, id:id,
title:title, title:title,
type:type type:type
}; };
nodesAttributes.push(attribute); nodesAttributes.push(attribute);
} }
} else if(attributesNode.getAttribute('class') == 'edge'){ } else if(attributesNode.getAttribute('class') == 'edge'){
var attributeNodes = attributesNode.getElementsByTagName('attribute'); // The list of xml nodes 'attribute' (no 's') var attributeNodes = attributesNode.getElementsByTagName('attribute'); // The list of xml nodes 'attribute' (no 's')
for(j = 0; j<attributeNodes.length; j++){ for(j = 0; j<attributeNodes.length; j++){
var attributeNode = attributeNodes[j]; // Each xml node 'attribute' var attributeNode = attributeNodes[j]; // Each xml node 'attribute'
var id = attributeNode.getAttribute('id'), var id = attributeNode.getAttribute('id'),
title = attributeNode.getAttribute('title'), title = attributeNode.getAttribute('title'),
type = attributeNode.getAttribute('type'); type = attributeNode.getAttribute('type');
var attribute = { var attribute = {
id:id, id:id,
title:title, title:title,
type:type type:type
}; };
edgesAttributes.push(attribute); edgesAttributes.push(attribute);
} }
} }
} //out: nodesAttributes Array } //out: nodesAttributes Array
var nodesNodes = gexf.getElementsByTagName('nodes') // The list of xml nodes 'nodes' (plural) var nodesNodes = gexf.getElementsByTagName('nodes') // The list of xml nodes 'nodes' (plural)
labels = []; labels = [];
minNodeSize=999.00; minNodeSize=999.00;
...@@ -204,7 +204,7 @@ function dictfyGexf( gexf , categories ){ ...@@ -204,7 +204,7 @@ function dictfyGexf( gexf , categories ){
for(j=0; j<nodeNodes.length; j++) { for(j=0; j<nodeNodes.length; j++) {
var nodeNode = nodeNodes[j]; // Each xml node 'node' (no 's') var nodeNode = nodeNodes[j]; // Each xml node 'node' (no 's')
window.NODE = nodeNode; window.NODE = nodeNode;
// [ get ID ] // [ get ID ]
...@@ -220,8 +220,8 @@ function dictfyGexf( gexf , categories ){ ...@@ -220,8 +220,8 @@ function dictfyGexf( gexf , categories ){
sizeNode = sizeNodes[0]; sizeNode = sizeNodes[0];
size = parseFloat(sizeNode.getAttribute('value')); size = parseFloat(sizeNode.getAttribute('value'));
}// [ / get Size ] }// [ / get Size ]
// [ get Coordinates ] // [ get Coordinates ]
var x = 100 - 200*Math.random(); var x = 100 - 200*Math.random();
var y = 100 - 200*Math.random(); var y = 100 - 200*Math.random();
var positionNodes = nodeNode.getElementsByTagName('position'); var positionNodes = nodeNode.getElementsByTagName('position');
...@@ -244,13 +244,13 @@ function dictfyGexf( gexf , categories ){ ...@@ -244,13 +244,13 @@ function dictfyGexf( gexf , categories ){
parseFloat(colorNode.getAttribute('g')), parseFloat(colorNode.getAttribute('g')),
parseFloat(colorNode.getAttribute('b'))); parseFloat(colorNode.getAttribute('b')));
}// [ / get Colour ] }// [ / get Colour ]
var node = ({ var node = ({
id:id, id:id,
label:label, label:label,
size:size, size:size,
x:x, x:x,
y:y, y:y,
color:color color:color
}); });
...@@ -283,15 +283,15 @@ function dictfyGexf( gexf , categories ){ ...@@ -283,15 +283,15 @@ function dictfyGexf( gexf , categories ){
// console.log(node) // console.log(node)
} }
if(parseInt(node.size) < parseInt(minNodeSize)) if(parseInt(node.size) < parseInt(minNodeSize))
minNodeSize= node.size; minNodeSize= node.size;
if(parseInt(node.size) > parseInt(maxNodeSize)) if(parseInt(node.size) > parseInt(maxNodeSize))
maxNodeSize= node.size; maxNodeSize= node.size;
} }
} }
var attention = false var attention = false
if( TW.Clusters.length == 0 ) { if( TW.Clusters.length == 0 ) {
...@@ -320,7 +320,7 @@ function dictfyGexf( gexf , categories ){ ...@@ -320,7 +320,7 @@ function dictfyGexf( gexf , categories ){
} }
// TW.partialGraph._core.graph.nodesIndex[it].size=Nodes[it].size; // TW.partialGraph._core.graph.nodesIndex[it].size=Nodes[it].size;
} }
var edgeId = 0; var edgeId = 0;
var edgesNodes = gexf.getElementsByTagName('edges'); var edgesNodes = gexf.getElementsByTagName('edges');
...@@ -334,7 +334,7 @@ function dictfyGexf( gexf , categories ){ ...@@ -334,7 +334,7 @@ function dictfyGexf( gexf , categories ){
var type = edgeNode.getAttribute('type');//line or curve var type = edgeNode.getAttribute('type');//line or curve
var indice=source+";"+target; var indice=source+";"+target;
var edge = { var edge = {
id: indice, id: indice,
source: source, source: source,
...@@ -355,7 +355,7 @@ function dictfyGexf( gexf , categories ){ ...@@ -355,7 +355,7 @@ function dictfyGexf( gexf , categories ){
var attr = attvalueNode.getAttribute('for'); var attr = attvalueNode.getAttribute('for');
var val = attvalueNode.getAttribute('value'); var val = attvalueNode.getAttribute('value');
edge.attributes.push({ edge.attributes.push({
attr:attr, attr:attr,
val:val val:val
}); });
} }
...@@ -374,7 +374,7 @@ function dictfyGexf( gexf , categories ){ ...@@ -374,7 +374,7 @@ function dictfyGexf( gexf , categories ){
idInRelations = [] idInRelations = []
for(var c in petitDict) idInRelations[catDict[c]] = true; for(var c in petitDict) idInRelations[catDict[c]] = true;
for(var c=0; c<categories.length;c++) { for(var c=0; c<categories.length;c++) {
if(!idInRelations[c]) idInRelations[c] = false; if(!idInRelations[c]) idInRelations[c] = false;
} }
idArray = idInRelations.map(Number).join("|") idArray = idInRelations.map(Number).join("|")
edge.categ = idArray; edge.categ = idArray;
...@@ -395,43 +395,43 @@ function dictfyGexf( gexf , categories ){ ...@@ -395,43 +395,43 @@ function dictfyGexf( gexf , categories ){
nodes1[source] = { nodes1[source] = {
label: nodes[source].label, label: nodes[source].label,
neighbours: [] neighbours: []
}; };
} }
if(isUndef(nodes1[target])) { if(isUndef(nodes1[target])) {
nodes1[target] = { nodes1[target] = {
label: nodes[target].label, label: nodes[target].label,
neighbours: [] neighbours: []
}; };
} }
nodes1[source].neighbours.push(target); nodes1[source].neighbours.push(target);
nodes1[target].neighbours.push(source); nodes1[target].neighbours.push(source);
// TW.partialGraph.addEdge(indice,source,target,edge); // TW.partialGraph.addEdge(indice,source,target,edge);
} }
if(categories.length>1) { if(categories.length>1) {
// Term <-> Term // Term <-> Term
if(idS==categories[1] && idT==categories[1]){ if(idS==categories[1] && idT==categories[1]){
edge.label = "nodes2"; edge.label = "nodes2";
if(isUndef(nodes2[source])) { if(isUndef(nodes2[source])) {
nodes2[source] = { nodes2[source] = {
label: nodes[source].label, label: nodes[source].label,
neighbours: [] neighbours: []
}; };
} }
if(isUndef(nodes2[target])) { if(isUndef(nodes2[target])) {
nodes2[target] = { nodes2[target] = {
label: nodes[target].label, label: nodes[target].label,
neighbours: [] neighbours: []
}; };
} }
nodes2[source].neighbours.push(target); nodes2[source].neighbours.push(target);
nodes2[target].neighbours.push(source); nodes2[target].neighbours.push(source);
// otherGraph.addEdge(indice,source,target,edge); // otherGraph.addEdge(indice,source,target,edge);
} }
// Doc <-> Term // Doc <-> Term
if((idS==categories[0] && idT==categories[1]) || if((idS==categories[0] && idT==categories[1]) ||
(idS==categories[1] && idT==categories[0])) { (idS==categories[1] && idT==categories[0])) {
...@@ -444,13 +444,13 @@ function dictfyGexf( gexf , categories ){ ...@@ -444,13 +444,13 @@ function dictfyGexf( gexf , categories ){
bipartiteD2N[source] = { bipartiteD2N[source] = {
label: nodes[source].label, label: nodes[source].label,
neighbours: [] neighbours: []
}; };
} }
if(isUndef(bipartiteN2D[target])) { if(isUndef(bipartiteN2D[target])) {
bipartiteN2D[target] = { bipartiteN2D[target] = {
label: nodes[target].label, label: nodes[target].label,
neighbours: [] neighbours: []
}; };
} }
bipartiteD2N[source].neighbours.push(target); bipartiteD2N[source].neighbours.push(target);
...@@ -463,13 +463,13 @@ function dictfyGexf( gexf , categories ){ ...@@ -463,13 +463,13 @@ function dictfyGexf( gexf , categories ){
bipartiteN2D[source] = { bipartiteN2D[source] = {
label: nodes[source].label, label: nodes[source].label,
neighbours: [] neighbours: []
}; };
} }
if(isUndef(bipartiteD2N[target])) { if(isUndef(bipartiteD2N[target])) {
bipartiteD2N[target] = { bipartiteD2N[target] = {
label: nodes[target].label, label: nodes[target].label,
neighbours: [] neighbours: []
}; };
} }
bipartiteN2D[source].neighbours.push(target); bipartiteN2D[source].neighbours.push(target);
bipartiteD2N[target].neighbours.push(source); bipartiteD2N[target].neighbours.push(source);
...@@ -558,7 +558,7 @@ function dictfyJSON( data , categories ) { ...@@ -558,7 +558,7 @@ function dictfyJSON( data , categories ) {
var edges={}, nodes={}, nodes1={}, nodes2=false, bipartiteD2N=false, bipartiteN2D=false; var edges={}, nodes={}, nodes1={}, nodes2=false, bipartiteD2N=false, bipartiteN2D=false;
if(categories.length>1) { if(categories.length>1) {
nodes2={}, bipartiteD2N={}, bipartiteN2D={} nodes2={}, bipartiteD2N={}, bipartiteN2D={}
} }
for(var i in data.nodes) { for(var i in data.nodes) {
...@@ -605,7 +605,7 @@ function dictfyJSON( data , categories ) { ...@@ -605,7 +605,7 @@ function dictfyJSON( data , categories ) {
edge.target = parseInt(target); edge.target = parseInt(target);
edge.weight = weight; edge.weight = weight;
edge.type = type; edge.type = type;
if (nodes[source] && nodes[target]) { if (nodes[source] && nodes[target]) {
idS=nodes[source].type; idS=nodes[source].type;
idT=nodes[target].type; idT=nodes[target].type;
...@@ -618,7 +618,7 @@ function dictfyJSON( data , categories ) { ...@@ -618,7 +618,7 @@ function dictfyJSON( data , categories ) {
idInRelations = [] idInRelations = []
for(var c in petitDict) idInRelations[catDict[c]] = true; for(var c in petitDict) idInRelations[catDict[c]] = true;
for(var c=0; c<categories.length;c++) { for(var c=0; c<categories.length;c++) {
if(!idInRelations[c]) idInRelations[c] = false; if(!idInRelations[c]) idInRelations[c] = false;
} }
idArray = idInRelations.map(Number).join("|") idArray = idInRelations.map(Number).join("|")
edge.categ = idArray; edge.categ = idArray;
...@@ -639,42 +639,42 @@ function dictfyJSON( data , categories ) { ...@@ -639,42 +639,42 @@ function dictfyJSON( data , categories ) {
nodes1[source] = { nodes1[source] = {
label: nodes[source].label, label: nodes[source].label,
neighbours: [] neighbours: []
}; };
} }
if(isUndef(nodes1[target])) { if(isUndef(nodes1[target])) {
nodes1[target] = { nodes1[target] = {
label: nodes[target].label, label: nodes[target].label,
neighbours: [] neighbours: []
}; };
} }
nodes1[source].neighbours.push(target); nodes1[source].neighbours.push(target);
nodes1[target].neighbours.push(source); nodes1[target].neighbours.push(source);
} }
if(categories.length>1) { if(categories.length>1) {
// Term <-> Term // Term <-> Term
if(idS==categories[1] && idT==categories[1]){ if(idS==categories[1] && idT==categories[1]){
edge.label = "nodes2"; edge.label = "nodes2";
if(isUndef(nodes2[source])) { if(isUndef(nodes2[source])) {
nodes2[source] = { nodes2[source] = {
label: nodes[source].label, label: nodes[source].label,
neighbours: [] neighbours: []
}; };
} }
if(isUndef(nodes2[target])) { if(isUndef(nodes2[target])) {
nodes2[target] = { nodes2[target] = {
label: nodes[target].label, label: nodes[target].label,
neighbours: [] neighbours: []
}; };
} }
nodes2[source].neighbours.push(target); nodes2[source].neighbours.push(target);
nodes2[target].neighbours.push(source); nodes2[target].neighbours.push(source);
// otherGraph.addEdge(indice,source,target,edge); // otherGraph.addEdge(indice,source,target,edge);
} }
// Doc <-> Term // Doc <-> Term
if((idS==categories[0] && idT==categories[1]) || if((idS==categories[0] && idT==categories[1]) ||
(idS==categories[1] && idT==categories[0])) { (idS==categories[1] && idT==categories[0])) {
...@@ -687,13 +687,13 @@ function dictfyJSON( data , categories ) { ...@@ -687,13 +687,13 @@ function dictfyJSON( data , categories ) {
bipartiteD2N[source] = { bipartiteD2N[source] = {
label: nodes[source].label, label: nodes[source].label,
neighbours: [] neighbours: []
}; };
} }
if(isUndef(bipartiteN2D[target])) { if(isUndef(bipartiteN2D[target])) {
bipartiteN2D[target] = { bipartiteN2D[target] = {
label: nodes[target].label, label: nodes[target].label,
neighbours: [] neighbours: []
}; };
} }
bipartiteD2N[source].neighbours.push(target); bipartiteD2N[source].neighbours.push(target);
...@@ -706,13 +706,13 @@ function dictfyJSON( data , categories ) { ...@@ -706,13 +706,13 @@ function dictfyJSON( data , categories ) {
bipartiteN2D[source] = { bipartiteN2D[source] = {
label: nodes[source].label, label: nodes[source].label,
neighbours: [] neighbours: []
}; };
} }
if(isUndef(bipartiteD2N[target])) { if(isUndef(bipartiteD2N[target])) {
bipartiteD2N[target] = { bipartiteD2N[target] = {
label: nodes[target].label, label: nodes[target].label,
neighbours: [] neighbours: []
}; };
} }
bipartiteN2D[source].neighbours.push(target); bipartiteN2D[source].neighbours.push(target);
bipartiteD2N[target].neighbours.push(source); bipartiteD2N[target].neighbours.push(source);
...@@ -759,8 +759,8 @@ function makeSystemStates (cats) { ...@@ -759,8 +759,8 @@ function makeSystemStates (cats) {
var systemstates = {} var systemstates = {}
var N=Math.pow(2 , cats.length); var N=Math.pow(2 , cats.length);
for (i = 0; i < N; i++) { for (i = 0; i < N; i++) {
bin = (i).toString(2) bin = (i).toString(2)
bin_splitted = [] bin_splitted = []
for(var j in bin) for(var j in bin)
...@@ -771,7 +771,7 @@ function makeSystemStates (cats) { ...@@ -771,7 +771,7 @@ function makeSystemStates (cats) {
for (k = 0; k < toadd; k++) for (k = 0; k < toadd; k++)
bin_array.push("0") bin_array.push("0")
for(var j in bin) for(var j in bin)
bin_array.push(bin[j]) bin_array.push(bin[j])
bin_array = bin_array.map(Number) bin_array = bin_array.map(Number)
......
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