Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
8a351ffa
Commit
8a351ffa
authored
Jan 06, 2016
by
PkSM3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
global variables changed
parent
9c9ca5c6
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
451 additions
and
477 deletions
+451
-477
parameters_details.php
LOCALDB/parameters_details.php
+2
-0
db.json
db.json
+16
-0
extras_explorerjs.js
extras_explorerjs.js
+55
-54
settings_explorerjs.js
settings_explorerjs.js
+54
-96
Tinaweb.js
tinawebJS/Tinaweb.js
+22
-22
enviroment.js
tinawebJS/enviroment.js
+92
-91
main.js
tinawebJS/main.js
+50
-52
methods.js
tinawebJS/methods.js
+79
-79
sigma.forceatlas2.js
tinawebJS/sigma.forceatlas2.js
+14
-15
sigma.min.js
tinawebJS/sigma.min.js
+5
-5
sigma.parseCustom.js
tinawebJS/sigma.parseCustom.js
+24
-24
sigmaUtils.js
tinawebJS/sigmaUtils.js
+38
-39
No files found.
LOCALDB/parameters_details.php
View file @
8a351ffa
...
...
@@ -8,6 +8,8 @@ $gexf_db = array();
# $gexf_db["data/ClimateChange/ClimateChangeV1.gexf"] = "data/ClimateChange/wosclimatechange-61715-1-wosclimatechange-db(2).db";
$gexf_db
[
"data/ClimateChange/Maps_S_800.gexf"
]
=
"data/ClimateChange/wos_climate-change_title_2014-2015.db"
;
$gexf_db
[
"data/AXA/EditedJan20151980 nodes V2 PageRank.gexf"
]
=
"data/AXA/data.db"
;
$gexf
=
str_replace
(
'"'
,
''
,
$_GET
[
"gexf"
]);
$mainpath
=
dirname
(
getcwd
())
.
"/"
;
...
...
db.json
View file @
8a351ffa
{
"data/AXA"
:
{
"dbname"
:
"data.db"
,
"title"
:
"ISITITLE"
,
"date"
:
"ISIpubdate"
,
"abstract"
:
"ISIABSTRACT"
,
"gexfs"
:
{
"EditedJan20151980 nodes V2 PageRank.gexf"
:
{
"social"
:
{
"table"
:
"ISIAUTHOR"
,
"textCol"
:
"data"
,
"forkeyCol"
:
"id"
},
"semantic"
:
{
"table"
:
"ISItermsAsbestos"
,
"textCol"
:
"data"
,
"forkeyCol"
:
"id"
}
},
"asbestos.gexf"
:
{
"social"
:
{
"table"
:
"ISIAUTHOR"
,
"textCol"
:
"data"
,
"forkeyCol"
:
"id"
},
"semantic"
:
{
"table"
:
"ISItermsAsbestos"
,
"textCol"
:
"data"
,
"forkeyCol"
:
"id"
}
}
}
},
"data/ClimateChange"
:
{
"dbname"
:
"wos_climate-change_title_2014-2015.db"
,
"title"
:
"ISITITLE"
,
...
...
extras_explorerjs.js
View file @
8a351ffa
...
...
@@ -13,8 +13,8 @@ function newPopup(url) {
// then, add the button in the html with the sigmaUtils.clustersBy(x) listener.
function
ChangeGraphAppearanceByAtt
(
manualflag
)
{
if
(
!
isUndef
(
manualflag
)
&&
!
colorByAtt
)
colorByAtt
=
manualflag
;
if
(
!
colorByAtt
)
return
;
if
(
!
isUndef
(
manualflag
)
&&
!
TW
.
colorByAtt
)
TW
.
colorByAtt
=
manualflag
;
if
(
!
TW
.
colorByAtt
)
return
;
// Seeing all the possible attributes!
var
AttsDict
=
{}
...
...
@@ -25,8 +25,8 @@ function ChangeGraphAppearanceByAtt( manualflag ) {
var
id
=
v_nodes
[
i
].
id
;
for
(
var
a
in
Nodes
[
id
].
attributes
)
{
var
someatt
=
Nodes
[
id
].
attributes
[
a
]
for
(
var
a
in
TW
.
Nodes
[
id
].
attributes
)
{
var
someatt
=
TW
.
Nodes
[
id
].
attributes
[
a
]
// Identifying the attribute datatype: exclude strings and objects
if
(
(
typeof
(
someatt
)
==
"string"
&&
isNaN
(
Number
(
someatt
))
)
||
typeof
(
someatt
)
==
"object"
)
{
...
...
@@ -36,8 +36,8 @@ function ChangeGraphAppearanceByAtt( manualflag ) {
}
var
possible_atts
=
[];
if
(
!
isUndef
(
Nodes
[
id
].
attributes
))
possible_atts
=
Object
.
keys
(
Nodes
[
id
].
attributes
)
if
(
!
isUndef
(
TW
.
Nodes
[
id
].
attributes
))
possible_atts
=
Object
.
keys
(
TW
.
Nodes
[
id
].
attributes
)
if
(
!
isUndef
(
v_nodes
[
i
].
degree
))
possible_atts
.
push
(
"degree"
)
...
...
@@ -118,7 +118,7 @@ function RunLouvain() {
var
community
=
jLouvain
().
nodes
(
node_realdata
).
edges
(
edge_realdata
);
var
results
=
community
();
for
(
var
i
in
results
)
Nodes
[
i
].
attributes
[
"clust_louvain"
]
=
results
[
i
]
TW
.
Nodes
[
i
].
attributes
[
"clust_louvain"
]
=
results
[
i
]
}
...
...
@@ -128,7 +128,7 @@ function SomeEffect( ClusterCode ) {
var
raw
=
ClusterCode
.
split
(
"||"
)
var
Type
=
raw
[
0
],
Cluster
=
raw
[
1
],
clstID
=
Number
(
raw
[
2
]);
var
present
=
partialGraph
.
states
.
slice
(
-
1
)[
0
];
// Last
var
present
=
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
];
// Last
var
type_t0
=
present
.
type
;
var
str_type_t0
=
type_t0
.
map
(
Number
).
join
(
"|"
)
console
.
log
(
"
\
t"
+
str_type_t0
)
...
...
@@ -143,7 +143,7 @@ function SomeEffect( ClusterCode ) {
for
(
var
i
in
nodesV
)
{
var
n
=
nodesV
[
i
]
n
.
forceLabel
=
false
;
var
node
=
Nodes
[
n
.
id
]
var
node
=
TW
.
Nodes
[
n
.
id
]
if
(
node
.
type
==
Type
&&
!
isUndef
(
node
.
attributes
[
Cluster
])
&&
node
.
attributes
[
Cluster
]
==
clstID
)
{
// pr( n.id + " | " + Cluster + " : " + node.attributes[Cluster] )
nodes_2_colour
[
n
.
id
]
=
n
.
degree
;
...
...
@@ -152,8 +152,8 @@ function SomeEffect( ClusterCode ) {
for
(
var
s
in
nodes_2_colour
)
{
if
(
Relations
[
str_type_t0
]
&&
Relations
[
str_type_t0
][
s
]
)
{
neigh
=
Relations
[
str_type_t0
][
s
]
if
(
TW
.
Relations
[
str_type_t0
]
&&
TW
.
Relations
[
str_type_t0
][
s
]
)
{
neigh
=
TW
.
Relations
[
str_type_t0
][
s
]
if
(
neigh
)
{
for
(
var
j
in
neigh
)
{
t
=
neigh
[
j
]
...
...
@@ -168,7 +168,7 @@ function SomeEffect( ClusterCode ) {
for
(
var
i
in
nodes_2_colour
)
{
n
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
]
n
=
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
]
if
(
n
)
{
n
.
color
=
n
.
attr
[
'true_color'
];
n
.
attr
[
'grey'
]
=
0
;
...
...
@@ -177,7 +177,7 @@ function SomeEffect( ClusterCode ) {
for
(
var
i
in
edges_2_colour
)
{
an_edge
=
partialGraph
.
_core
.
graph
.
edgesIndex
[
i
]
an_edge
=
TW
.
partialGraph
.
_core
.
graph
.
edgesIndex
[
i
]
if
(
!
isUndef
(
an_edge
)
&&
!
an_edge
.
hidden
){
// pr(an_edge)
an_edge
.
color
=
an_edge
.
attr
[
'true_color'
];
...
...
@@ -197,29 +197,30 @@ function SomeEffect( ClusterCode ) {
if
(
n
==
4
)
break
var
ID
=
nodes_2_label
[
n
].
key
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
].
forceLabel
=
true
;
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
].
forceLabel
=
true
;
}
overNodes
=
true
;
partialGraph
.
draw
()
TW
.
partialGraph
.
draw
()
}
function
set_ClustersLegend
(
daclass
)
{
//partialGraph.states.slice(-1)[0].LouvainFait = true
//
TW.
partialGraph.states.slice(-1)[0].LouvainFait = true
$
(
"#legend_for_clusters"
).
removeClass
(
"my-legend"
)
$
(
"#legend_for_clusters"
).
html
(
""
)
if
(
daclass
==
null
)
return
;
var
ClustNB_CurrentColor
=
{}
var
nodesV
=
getVisibleNodes
()
for
(
var
i
in
nodesV
)
{
n
=
nodesV
[
i
]
color
=
n
.
color
type
=
Nodes
[
n
.
id
].
type
clstNB
=
Nodes
[
n
.
id
].
attributes
[
daclass
]
type
=
TW
.
Nodes
[
n
.
id
].
type
clstNB
=
TW
.
Nodes
[
n
.
id
].
attributes
[
daclass
]
ClustNB_CurrentColor
[
type
+
"||"
+
daclass
+
"||"
+
clstNB
]
=
color
}
...
...
@@ -239,15 +240,15 @@ function set_ClustersLegend ( daclass ) {
var
ClustType
=
raw
[
1
]
var
ClustID
=
raw
[
2
]
var
Color
=
ClustNB_CurrentColor
[
IDx
]
pr
(
Color
+
" : "
+
Clusters
[
Type
][
ClustType
][
ClustID
]
)
pr
(
Color
+
" : "
+
TW
.
Clusters
[
Type
][
ClustType
][
ClustID
]
)
var
ColorDiv
=
'<span style="background:'
+
Color
+
';"></span>'
LegendDiv
+=
'<li onclick=
\'
SomeEffect("'
+
IDx
+
'")
\'
>'
+
ColorDiv
+
Clusters
[
Type
][
ClustType
][
ClustID
]
+
"</li>"
+
"
\n
"
LegendDiv
+=
'<li onclick=
\'
SomeEffect("'
+
IDx
+
'")
\'
>'
+
ColorDiv
+
TW
.
Clusters
[
Type
][
ClustType
][
ClustID
]
+
"</li>"
+
"
\n
"
}
}
else
{
for
(
var
i
in
OrderedClustDicts
)
{
var
IDx
=
OrderedClustDicts
[
i
]
var
Color
=
ClustNB_CurrentColor
[
IDx
]
// pr ( Color+" : "+ Clusters[Type][ClustType][ClustID] )
// pr ( Color+" : "+
TW.
Clusters[Type][ClustType][ClustID] )
var
ColorDiv
=
'<span style="background:'
+
Color
+
';"></span>'
LegendDiv
+=
'<li onclick=
\'
SomeEffect("'
+
IDx
+
'")
\'
>'
+
ColorDiv
+
IDx
+
"</li>"
+
"
\n
"
}
...
...
@@ -264,25 +265,25 @@ function set_ClustersLegend ( daclass ) {
//For CNRS
function
getTopPapers
(
type
){
if
(
getAdditionalInfo
){
if
(
TW
.
getAdditionalInfo
){
jsonparams
=
JSON
.
stringify
(
getSelections
());
bi
=
(
Object
.
keys
(
categories
).
length
==
2
)?
1
:
0
;
//jsonparams = jsonparams.replaceAll("&","__and__");
jsonparams
=
jsonparams
.
split
(
'&'
).
join
(
'__and__'
);
//dbsPaths.push(getGlobalDBs());
thisgexf
=
JSON
.
stringify
(
decodeURIComponent
(
getUrlParam
.
file
));
image
=
'<img style="display:block; margin: 0px auto;" src="'
+
APINAME
+
'img/ajax-loader.gif"></img>'
;
image
=
'<img style="display:block; margin: 0px auto;" src="'
+
TW
.
APINAME
+
'img/ajax-loader.gif"></img>'
;
$
(
"#tab-container-top"
).
show
();
$
(
"#topPapers"
).
show
();
$
(
"#topPapers"
).
html
(
image
);
$
.
ajax
({
type
:
'GET'
,
url
:
APINAME
+
'info_div.php'
,
data
:
"type="
+
type
+
"&bi="
+
bi
+
"&query="
+
jsonparams
+
"&gexf="
+
thisgexf
+
"&index="
+
field
[
getUrlParam
.
file
],
url
:
TW
.
APINAME
+
'info_div.php'
,
data
:
"type="
+
type
+
"&bi="
+
bi
+
"&query="
+
jsonparams
+
"&gexf="
+
thisgexf
+
"&index="
+
TW
.
field
[
getUrlParam
.
file
],
//contentType: "application/json",
//dataType: 'json',
success
:
function
(
data
){
pr
(
APINAME
+
'info_div.php?'
+
"type="
+
type
+
"&bi="
+
bi
+
"&query="
+
jsonparams
+
"&gexf="
+
thisgexf
+
"&index="
+
field
[
getUrlParam
.
file
]);
pr
(
TW
.
APINAME
+
'info_div.php?'
+
"type="
+
type
+
"&bi="
+
bi
+
"&query="
+
jsonparams
+
"&gexf="
+
thisgexf
+
"&index="
+
TW
.
field
[
getUrlParam
.
file
]);
$
(
"#topPapers"
).
html
(
data
);
},
error
:
function
(){
...
...
@@ -300,7 +301,7 @@ function selectionUni(currentNode){
highlightSelectedNodes
(
false
);
opossites
=
[];
selections
=
[];
partialGraph
.
refresh
();
TW
.
partialGraph
.
refresh
();
}
if
((
typeof
selections
[
currentNode
.
id
])
==
"undefined"
){
...
...
@@ -318,19 +319,19 @@ function selectionUni(currentNode){
//
partialGraph
.
zoomTo
(
partialGraph
.
_core
.
width
/
2
,
partialGraph
.
_core
.
height
/
2
,
0.8
);
partialGraph
.
refresh
();
TW
.
partialGraph
.
zoomTo
(
TW
.
partialGraph
.
_core
.
width
/
2
,
TW
.
partialGraph
.
_core
.
height
/
2
,
0.8
);
TW
.
partialGraph
.
refresh
();
}
//JUST ADEME
function
camaraButton
(){
$
(
"#PhotoGraph"
).
click
(
function
(){
//canvas=partialGraph._core.domElements.nodes;
//canvas=
TW.
partialGraph._core.domElements.nodes;
var
nodesCtx
=
partialGraph
.
_core
.
domElements
.
nodes
;
var
nodesCtx
=
TW
.
partialGraph
.
_core
.
domElements
.
nodes
;
/*
var edgesCtx = document.getElementById("sigma_edges_1").getContext('2d');
...
...
@@ -341,12 +342,12 @@ function camaraButton(){
//ctx.drawImage(partialGraph._core.domElements.edges,0,0)
//ctx.drawImage(
TW.
partialGraph._core.domElements.edges,0,0)
//var oCanvas = ctx;
*/
//div = document.getElementById("sigma_nodes_1").getContext('2d');
//ctx = div.getContext("2d");
//oCanvas.drawImage(partialGraph._core.domElements.edges,0,0);
//oCanvas.drawImage(
TW.
partialGraph._core.domElements.edges,0,0);
Canvas2Image
.
saveAsPNG
(
nodesCtx
);
/*
...
...
@@ -423,12 +424,12 @@ function draw1Circle(ctx , x , y , color) {
function
trackMouse
()
{
if
(
!
shift_key
)
{
// $.doTimeout(300,function (){
var
ctx
=
partialGraph
.
_core
.
domElements
.
mouse
.
getContext
(
'2d'
);
var
ctx
=
TW
.
partialGraph
.
_core
.
domElements
.
mouse
.
getContext
(
'2d'
);
ctx
.
globalCompositeOperation
=
"source-over"
;
ctx
.
clearRect
(
0
,
0
,
partialGraph
.
_core
.
domElements
.
nodes
.
width
,
partialGraph
.
_core
.
domElements
.
nodes
.
height
);
ctx
.
clearRect
(
0
,
0
,
TW
.
partialGraph
.
_core
.
domElements
.
nodes
.
width
,
TW
.
partialGraph
.
_core
.
domElements
.
nodes
.
height
);
x
=
partialGraph
.
_core
.
mousecaptor
.
mouseX
;
y
=
partialGraph
.
_core
.
mousecaptor
.
mouseY
;
x
=
TW
.
partialGraph
.
_core
.
mousecaptor
.
mouseX
;
y
=
TW
.
partialGraph
.
_core
.
mousecaptor
.
mouseY
;
ctx
.
strokeStyle
=
'#000'
;
ctx
.
lineWidth
=
1
;
...
...
@@ -436,43 +437,43 @@ function trackMouse() {
ctx
.
globalAlpha
=
0.5
;
ctx
.
beginPath
();
if
(
partialGraph
.
_core
.
mousecaptor
.
ratio
>
showLabelsIfZoom
){
for
(
var
i
in
partialGraph
.
_core
.
graph
.
nodesIndex
){
n
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
];
if
(
TW
.
partialGraph
.
_core
.
mousecaptor
.
ratio
>
showLabelsIfZoom
){
for
(
var
i
in
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
){
n
=
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
];
if
(
n
.
hidden
==
false
){
distance
=
Math
.
sqrt
(
Math
.
pow
((
x
-
parseInt
(
n
.
displayX
)),
2
)
+
Math
.
pow
((
y
-
parseInt
(
n
.
displayY
)),
2
)
);
if
(
parseInt
(
distance
)
<=
cursor_size
)
{
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
true
;
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
true
;
}
else
{
if
(
typeof
(
n
.
neighbour
)
!==
"undefined"
)
{
if
(
!
n
.
neighbour
)
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
false
;
}
else
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
false
;
if
(
!
n
.
neighbour
)
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
false
;
}
else
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
false
;
}
}
}
if
(
partialGraph
.
forceatlas2
&&
partialGraph
.
forceatlas2
.
count
<=
1
)
{
partialGraph
.
draw
(
2
,
2
,
2
);
if
(
TW
.
partialGraph
.
forceatlas2
&&
TW
.
partialGraph
.
forceatlas2
.
count
<=
1
)
{
TW
.
partialGraph
.
draw
(
2
,
2
,
2
);
}
}
else
{
for
(
var
i
in
partialGraph
.
_core
.
graph
.
nodesIndex
){
n
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
];
for
(
var
i
in
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
){
n
=
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
];
if
(
!
n
.
hidden
){
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
false
;
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
false
;
if
(
typeof
(
n
.
neighbour
)
!==
"undefined"
)
{
if
(
!
n
.
neighbour
)
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
false
;
else
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
true
;
}
else
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
false
;
if
(
!
n
.
neighbour
)
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
false
;
else
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
true
;
}
else
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
false
;
}
}
if
(
partialGraph
.
forceatlas2
&&
partialGraph
.
forceatlas2
.
count
<=
1
)
{
partialGraph
.
draw
(
2
,
2
,
2
);
if
(
TW
.
partialGraph
.
forceatlas2
&&
TW
.
partialGraph
.
forceatlas2
.
count
<=
1
)
{
TW
.
partialGraph
.
draw
(
2
,
2
,
2
);
}
}
ctx
.
arc
(
x
,
y
,
cursor_size
,
0
,
Math
.
PI
*
2
,
true
);
//ctx.arc(
partialGraph._core.width/2,
partialGraph._core.height/2, 4, 0, 2 * Math.PI, true);/*todel*/
//ctx.arc(
TW.partialGraph._core.width/2, TW.
partialGraph._core.height/2, 4, 0, 2 * Math.PI, true);/*todel*/
ctx
.
closePath
();
ctx
.
fill
();
ctx
.
stroke
();
...
...
settings_explorerjs.js
View file @
8a351ffa
/*
* Customize as you want ;)
*/
// ============ < DEVELOPER OPTIONS > ============
var
geomap
=
false
;
var
colorByAtt
=
false
;
var
twittertimeline
=
false
;
var
minimap
=
false
;
var
getAdditionalInfo
=
false
;
//for topPapers div
var
mainfile
=
[
"db.json"
];
// // var mainfile = "api.json";
// var mainfile = [
// "data/2-Terms-Authors-300nodes.gexf",
// "data/0-terms-terms-MainNodes.gexf",
// "data/maziyar2.json",
// "data/3-Terms-Countries-300nodes.gexf",
// // "data/noclimatechange_mnodes.gexf",
// "data/20150518t1052_phylograph.json",
// // "data/phylograph_6.json",
// // "data/maziyar.json",
// // "data/20141128_GPs_03_bi.gexf",
// // "data/example.json",
// // "data/Elisa__Omodei.gexf",
// ];
var
APINAME
=
"LOCALDB/"
// getUrlParam.file = "data/testgraph.json";
var
dataFolderTree
=
{};
var
egonode
=
{}
var
iwantograph
=
""
;
var
bridge
=
{};
external
=
""
;
//external="http://tina.iscpif.fr/explorerjs/";//Just if you want to use the server-apps from tina.server
bridge
[
"forFilteredQuery"
]
=
external
+
"php/bridgeClientServer_filter.php"
;
bridge
[
"forNormalQuery"
]
=
external
+
"php/bridgeClientServer.php"
;
var
gexfDict
=
{};
// gexfDict["data/terrorism/terrorism_mono.gexf"] = "[2001-2014] TERRORISM (1-partite graph)";
// gexfDict["data/terrorism/terrorism_bi.gexf"] = "[2001-2014] TERRORISM (2-partite graph)";
var
field
=
{}
// field["data/20141128_GPs_03_bi.gexf"] = "ISItermsfirstindexing";
// field["data/20141215_GPs_04.gexf"] = "ISItermsfirstindexing";
// field["data/medq2/20141128_MED_02_bi.gexf"] = "ISItermsBigWL";
// field["data/medq2/20141128_MED_03_bi.gexf"] = "ISItermsBigWL";
// field["data/medq2/20141208_MED_Author_name-ISItermsjulien_index.gexf"] = "ISItermsjulien_index";
// field["data/medq1/20141208_MED_01_bi.gexf"] = "ISItermsfirstindex";
// field["data/terrorism/terrorism_mono.gexf"] = "ISItermsListV1";
// field["data/terrorism/terrorism_bi.gexf"] = "ISItermsListV1";
var
TW
=
{}
TW
.
geomap
=
false
;
TW
.
colorByAtt
=
false
;
TW
.
twittertimeline
=
false
;
TW
.
minimap
=
false
;
TW
.
getAdditionalInfo
=
false
;
// True: Activate TopPapers feature.
TW
.
mainfile
=
[
"db.json"
];
// // TW.mainfile = "api.json";
// TW.mainfile = [
// "data/2-Terms-Authors-300nodes.gexf",
// "data/0-terms-terms-MainNodes.gexf",
// "data/maziyar2.json",
// "data/3-Terms-Countries-300nodes.gexf",
// // "data/noclimatechange_mnodes.gexf",
// "data/20150518t1052_phylograph.json",
// // "data/phylograph_6.json",
// // "data/maziyar.json",
// // "data/20141128_GPs_03_bi.gexf",
// // "data/example.json",
// // "data/Elisa__Omodei.gexf",
// ];
TW
.
APINAME
=
"LOCALDB/"
;
TW
.
bridge
=
{};
TW
.
bridge
[
"forFilteredQuery"
]
=
"php/bridgeClientServer_filter.php"
;
TW
.
bridge
[
"forNormalQuery"
]
=
"php/bridgeClientServer.php"
;
TW
.
gexfDict
=
{};
TW
.
gexfDictReverse
=
{}
for
(
var
i
in
TW
.
gexfDict
){
TW
.
gexfDictReverse
[
TW
.
gexfDict
[
i
]]
=
i
;
}
TW
.
field
=
{}
// field["data/20141128_GPs_03_bi.gexf"] = "ISItermsfirstindexing";
// field["data/20141215_GPs_04.gexf"] = "ISItermsfirstindexing";
TW
.
Relations
=
{}
TW
.
SystemStates
=
{}
TW
.
SystemStates
.
level
=
true
;
TW
.
SystemStates
.
type
=
[
true
]
//[ true , false ]; //social activated!
TW
.
SystemStates
.
selections
=
[];
TW
.
SystemStates
.
opposites
=
[];
TW
.
catSoc
=
"Document"
;
TW
.
catSem
=
"NGram"
;
var
ParseCustom
=
function
()
{};
var
SigmaUtils
=
function
()
{};
var
TinaWebJS
=
function
()
{};
var
Relations
=
{}
var
SystemStates
=
{}
SystemStates
.
level
=
true
;
SystemStates
.
type
=
[
true
]
//[ true , false ]; //social activated!
SystemStates
.
selections
=
[];
SystemStates
.
opposites
=
[];
ircNick
=
""
;
ircCHN
=
""
;
var
catSoc
=
"Document"
;
var
catSem
=
"NGram"
;
var
sizeMult
=
[];
sizeMult
[
catSoc
]
=
0.0
;
sizeMult
[
catSem
]
=
0.0
;
sizeMult
[
TW
.
catSoc
]
=
0.0
;
sizeMult
[
TW
.
catSem
]
=
0.0
;
var
inactiveColor
=
'#666'
;
var
startingNodeId
=
"1"
;
...
...
@@ -155,10 +118,9 @@ var sigmaJsMouseProperties = {
// ============ < VARIABLES.JS > ============
//"http://webchat.freenode.net/?nick=Ademe&channels=#anoe"
var
ircUrl
=
"http://webchat.freenode.net/?nick="
+
ircNick
+
"&channels="
+
ircCHN
;
var
twjs
=
"tinawebJS/"
;
var
categories
=
{};
var
categoriesIndex
=
[];
TW
.
categories
=
{};
TW
.
categoriesIndex
=
[];
var
gexf
;
//var zoom=0;
...
...
@@ -183,7 +145,7 @@ var lastFilter = []
lastFilter
[
"#slidercat0edgesweight"
]
=
{
"orig"
:
"-"
,
"last"
:
"-"
}
lastFilter
[
"#slidercat1edgesweight"
]
=
{
"orig"
:
"-"
,
"last"
:
"-"
}
var
Filters
=
{}
TW
.
Filters
=
{}
...
...
@@ -193,11 +155,11 @@ var overviewScale = 0.25;
var
overviewHover
=
false
;
var
moveDelay
=
80
,
zoomDelay
=
2
;
//var Vecindad;
var
partialGraph
;
TW
.
partialGraph
;
var
otherGraph
;
var
Nodes
=
[];
var
Edges
=
[];
var
Clusters
=
[];
TW
.
Nodes
=
[];
TW
.
Edges
=
[];
TW
.
Clusters
=
[];
var
nodeslength
=
0
;
...
...
@@ -232,10 +194,6 @@ var maxEdgeWeight=0.0;
//---------------------------------------------------
var
bipartite
=
false
;
var
gexfDictReverse
=
{}
for
(
var
i
in
gexfDict
){
gexfDictReverse
[
gexfDict
[
i
]]
=
i
;
}
var
colorList
=
[
"#000000"
,
"#FFFF00"
,
"#1CE6FF"
,
"#FF34FF"
,
"#FF4A46"
,
"#008941"
,
"#006FA6"
,
"#A30059"
,
"#FFDBE5"
,
"#7A4900"
,
"#0000A6"
,
"#63FFAC"
,
"#B79762"
,
"#004D43"
,
"#8FB0FF"
,
"#997D87"
,
"#5A0007"
,
"#809693"
,
"#FEFFE6"
,
"#1B4400"
,
"#4FC601"
,
"#3B5DFF"
,
"#4A3B53"
,
"#FF2F80"
,
"#61615A"
,
"#BA0900"
,
"#6B7900"
,
"#00C2A0"
,
"#FFAA92"
,
"#FF90C9"
,
"#B903AA"
,
"#D16100"
,
"#DDEFFF"
,
"#000035"
,
"#7B4F4B"
,
"#A1C299"
,
"#300018"
,
"#0AA6D8"
,
"#013349"
,
"#00846F"
,
"#372101"
,
"#FFB500"
,
"#C2FFED"
,
"#A079BF"
,
"#CC0744"
,
"#C0B9B2"
,
"#C2FF99"
,
"#001E09"
,
"#00489C"
,
"#6F0062"
,
"#0CBD66"
,
"#EEC3FF"
,
"#456D75"
,
"#B77B68"
,
"#7A87A1"
,
"#788D66"
,
"#885578"
,
"#FAD09F"
,
"#FF8A9A"
,
"#D157A0"
,
"#BEC459"
,
"#456648"
,
"#0086ED"
,
"#886F4C"
,
"#34362D"
,
"#B4A8BD"
,
"#00A6AA"
,
"#452C2C"
,
"#636375"
,
"#A3C8C9"
,
"#FF913F"
,
"#938A81"
,
"#575329"
,
"#00FECF"
,
"#B05B6F"
,
"#8CD0FF"
,
"#3B9700"
,
"#04F757"
,
"#C8A1A1"
,
"#1E6E00"
,
"#7900D7"
,
"#A77500"
,
"#6367A9"
,
"#A05837"
,
"#6B002C"
,
"#772600"
,
"#D790FF"
,
"#9B9700"
,
"#549E79"
,
"#FFF69F"
,
"#201625"
,
"#72418F"
,
"#BC23FF"
,
"#99ADC0"
,
"#3A2465"
,
"#922329"
,
"#5B4534"
,
"#FDE8DC"
,
"#404E55"
,
"#0089A3"
,
"#CB7E98"
,
"#A4E804"
,
"#324E72"
,
"#6A3A4C"
,
"#83AB58"
,
"#001C1E"
,
"#D1F7CE"
,
"#004B28"
,
"#C8D0F6"
,
"#A3A489"
,
"#806C66"
,
"#222800"
,
"#BF5650"
,
"#E83000"
,
"#66796D"
,
"#DA007C"
,
"#FF1A59"
,
"#8ADBB4"
,
"#1E0200"
,
"#5B4E51"
,
"#C895C5"
,
"#320033"
,
"#FF6832"
,
"#66E1D3"
,
"#CFCDAC"
,
"#D0AC94"
,
"#7ED379"
,
"#012C58"
];
...
...
tinawebJS/Tinaweb.js
View file @
8a351ffa
...
...
@@ -48,7 +48,7 @@ SelectionEngine = function() {
if
(
cursorsize
>
0
)
{
clickedNodes
=
this
.
SelectThis2
(
area
)
}
else
{
clickedNodes
=
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
clickedNodes
=
TW
.
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
return
!!
n
[
'hover'
];
}).
map
(
function
(
n
)
{
return
n
.
id
;
...
...
@@ -122,7 +122,7 @@ SelectionEngine = function() {
if
(
cursorsize
>
0
)
{
targeted
=
this
.
SelectThis2
(
area
)
}
else
{
targeted
=
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
targeted
=
TW
.
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
return
!!
n
[
'hover'
];
}).
map
(
function
(
n
)
{
return
n
.
id
;
...
...
@@ -203,7 +203,7 @@ SelectionEngine = function() {
cancelSelection
(
false
);
MultipleSelection2
(
targeted
);
}
partialGraph
.
draw
();
TW
.
partialGraph
.
draw
();
$
(
"input#searchinput"
).
val
(
""
);
$
(
"input#searchinput"
).
autocomplete
(
"close"
);
...
...
@@ -240,7 +240,7 @@ SelectionEngine = function() {
//Multiple selection
var
counter
=
0
;
var
actualSel
=
[];
partialGraph
.
iterNodes
(
function
(
n
){
TW
.
partialGraph
.
iterNodes
(
function
(
n
){
if
(
!
n
.
hidden
){
distance
=
Math
.
sqrt
(
Math
.
pow
((
x1
-
parseInt
(
n
.
displayX
)),
2
)
+
...
...
@@ -263,7 +263,7 @@ SelectionEngine = function() {
greyEverything
();
var
typeNow
=
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
(
typeNow
)
console
.
log
(
" - - - - - - "
)
...
...
@@ -280,8 +280,8 @@ SelectionEngine = function() {
else
ndsids
=
nodes
;
for
(
var
i
in
ndsids
)
{
s
=
ndsids
[
i
];
if
(
Relations
[
typeNow
]
&&
Relations
[
typeNow
][
s
]
)
{
neigh
=
Relations
[
typeNow
][
s
]
if
(
TW
.
Relations
[
typeNow
]
&&
TW
.
Relations
[
typeNow
][
s
]
)
{
neigh
=
TW
.
Relations
[
typeNow
][
s
]
if
(
neigh
)
{
for
(
var
j
in
neigh
)
{
t
=
neigh
[
j
]
...
...
@@ -300,7 +300,7 @@ SelectionEngine = function() {
for
(
var
i
in
nodes_2_colour
)
{
if
(
i
)
{
n
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
]
n
=
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
]
if
(
n
)
{
n
.
color
=
n
.
attr
[
'true_color'
];
n
.
attr
[
'grey'
]
=
0
;
...
...
@@ -312,7 +312,7 @@ SelectionEngine = function() {
}
}
for
(
var
i
in
edges_2_colour
)
{
an_edge
=
partialGraph
.
_core
.
graph
.
edgesIndex
[
i
]
an_edge
=
TW
.
partialGraph
.
_core
.
graph
.
edgesIndex
[
i
]
if
(
!
isUndef
(
an_edge
)
&&
!
an_edge
.
hidden
){
an_edge
.
color
=
an_edge
.
attr
[
'true_color'
];
an_edge
.
attr
[
'grey'
]
=
0
;
...
...
@@ -321,13 +321,13 @@ SelectionEngine = function() {
var
the_new_sels
=
Object
.
keys
(
selections
).
map
(
Number
)
partialGraph
.
states
.
slice
(
-
1
)[
0
].
selections
=
the_new_sels
;
partialGraph
.
states
.
slice
(
-
1
)[
0
].
setState
(
{
sels
:
the_new_sels
}
)
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
].
selections
=
the_new_sels
;
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
].
setState
(
{
sels
:
the_new_sels
}
)
var
neighsDict
=
{}
if
(
Relations
[
"1|1"
])
{
if
(
TW
.
Relations
[
"1|1"
])
{
for
(
var
s
in
the_new_sels
)
{
var
neighs
=
Relations
[
"1|1"
][
the_new_sels
[
s
]];
var
neighs
=
TW
.
Relations
[
"1|1"
][
the_new_sels
[
s
]];
for
(
var
n
in
neighs
)
{
if
(
!
neighsDict
[
neighs
[
n
]])
neighsDict
[
neighs
[
n
]]
=
0
;
...
...
@@ -343,7 +343,7 @@ SelectionEngine = function() {
overNodes
=
true
;
partialGraph
.
draw
();
TW
.
partialGraph
.
draw
();
updateLeftPanel_fix
(
selections
,
oppos
);
...
...
@@ -452,7 +452,7 @@ TinaWebJS = function ( sigmacanvas ) {
SelInst
.
MultipleSelection2
({
nodes
:
targeted
});
cursor_size
=
prev_cursor_size
;
}
partialGraph
.
draw
();
TW
.
partialGraph
.
draw
();
$
(
"input#searchinput"
).
val
(
""
);
$
(
"input#searchinput"
).
autocomplete
(
"close"
);
...
...
@@ -481,7 +481,7 @@ TinaWebJS = function ( sigmacanvas ) {
cancelSelection
(
false
);
SelInst
.
MultipleSelection2
({
nodes
:
targeted
});
}
partialGraph
.
draw
();
TW
.
partialGraph
.
draw
();
$
(
"input#searchinput"
).
val
(
""
);
$
(
"input#searchinput"
).
autocomplete
(
"close"
);
...
...
@@ -743,10 +743,10 @@ TinaWebJS = function ( sigmacanvas ) {
onchange
:
function
(
value
){
$
.
doTimeout
(
100
,
function
(){
partialGraph
.
iterNodes
(
function
(
n
)
{
if
(
Nodes
[
n
.
id
].
type
==
catSoc
)
{
var
newval
=
parseFloat
(
Nodes
[
n
.
id
].
size
)
+
parseFloat
((
value
-
1
))
*
0.3
if
(
TW
.
Nodes
[
n
.
id
].
type
==
TW
.
catSoc
)
{
var
newval
=
parseFloat
(
TW
.
Nodes
[
n
.
id
].
size
)
+
parseFloat
((
value
-
1
))
*
0.3
n
.
size
=
(
newval
<
1.0
)?
1
:
newval
;
sizeMult
[
catSoc
]
=
parseFloat
(
value
-
1
)
*
0.3
;
sizeMult
[
TW
.
catSoc
]
=
parseFloat
(
value
-
1
)
*
0.3
;
}
});
partialGraph
.
draw
();
...
...
@@ -764,10 +764,10 @@ TinaWebJS = function ( sigmacanvas ) {
onchange
:
function
(
value
){
$
.
doTimeout
(
100
,
function
(){
partialGraph
.
iterNodes
(
function
(
n
)
{
if
(
Nodes
[
n
.
id
].
type
==
catSem
)
{
var
newval
=
parseFloat
(
Nodes
[
n
.
id
].
size
)
+
parseFloat
((
value
-
1
))
*
0.3
if
(
TW
.
Nodes
[
n
.
id
].
type
==
TW
.
catSem
)
{
var
newval
=
parseFloat
(
TW
.
Nodes
[
n
.
id
].
size
)
+
parseFloat
((
value
-
1
))
*
0.3
n
.
size
=
(
newval
<
1.0
)?
1
:
newval
;
sizeMult
[
catSem
]
=
parseFloat
(
value
-
1
)
*
0.3
;
sizeMult
[
TW
.
catSem
]
=
parseFloat
(
value
-
1
)
*
0.3
;
}
});
partialGraph
.
draw
();
...
...
tinawebJS/enviroment.js
View file @
8a351ffa
//============================ < NEW BUTTONS > =============================//
// Documentation Level: *****
function
changeType
()
{
var
present
=
partialGraph
.
states
.
slice
(
-
1
)[
0
];
// Last
var
past
=
partialGraph
.
states
.
slice
(
-
2
)[
0
]
// avant Last
var
lastpos
=
partialGraph
.
states
.
length
-
1
;
var
present
=
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
];
// Last
var
past
=
TW
.
partialGraph
.
states
.
slice
(
-
2
)[
0
]
// avant Last
var
lastpos
=
TW
.
partialGraph
.
states
.
length
-
1
;
var
avantlastpos
=
lastpos
-
1
;
...
...
@@ -44,16 +46,16 @@ function changeType() {
var
prevnodes
=
{}
var
prevedges
=
{}
for
(
var
i
in
partialGraph
.
_core
.
graph
.
nodesIndex
)
{
anode
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
];
for
(
var
i
in
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
)
{
anode
=
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
];
if
(
anode
)
{
prevnodes
[
i
]
=
true
}
}
var
links_sels
=
{}
for
(
var
i
in
partialGraph
.
_core
.
graph
.
edgesIndex
)
{
anedge
=
partialGraph
.
_core
.
graph
.
edgesIndex
[
i
];
for
(
var
i
in
TW
.
partialGraph
.
_core
.
graph
.
edgesIndex
)
{
anedge
=
TW
.
partialGraph
.
_core
.
graph
.
edgesIndex
[
i
];
if
(
anedge
)
{
prevedges
[
i
]
=
true
;
if
(
anedge
.
attr
)
{
...
...
@@ -64,7 +66,7 @@ function changeType() {
}
}
partialGraph
.
emptyGraph
();
TW
.
partialGraph
.
emptyGraph
();
var
nodes_2_colour
=
{}
var
edges_2_colour
=
{}
...
...
@@ -73,12 +75,12 @@ function changeType() {
if
(
present
.
level
)
{
//If level=Global, fill all {X}-component
for
(
var
n
in
Nodes
)
{
if
(
type_t1
[
catDict
[
Nodes
[
n
].
type
]])
for
(
var
n
in
TW
.
Nodes
)
{
if
(
type_t1
[
catDict
[
TW
.
Nodes
[
n
].
type
]])
add1Elem
(
n
)
}
for
(
var
e
in
Edges
)
{
if
(
Edges
[
e
].
categ
==
str_type_t1
)
for
(
var
e
in
TW
.
Edges
)
{
if
(
TW
.
Edges
[
e
].
categ
==
str_type_t1
)
add1Elem
(
e
)
}
}
else
/* Local level, change to previous or alter component*/
{
...
...
@@ -101,7 +103,7 @@ function changeType() {
if
(
sumpastcat
==
1
)
/* change to alter comp*/
{
for
(
var
i
in
prevnodes
)
{
s
=
i
;
neigh
=
Relations
[
str_nextState
][
s
]
neigh
=
TW
.
Relations
[
str_nextState
][
s
]
if
(
neigh
)
{
for
(
var
j
in
neigh
)
{
t
=
neigh
[
j
]
...
...
@@ -112,7 +114,7 @@ function changeType() {
for
(
var
i
in
nodes_2_colour
)
{
s
=
i
;
neigh
=
Relations
[
str_type_t1
][
s
]
neigh
=
TW
.
Relations
[
str_type_t1
][
s
]
if
(
neigh
)
{
for
(
var
j
in
neigh
)
{
t
=
neigh
[
j
]
...
...
@@ -164,7 +166,7 @@ function changeType() {
var
newsels
=
{}
for
(
var
i
in
sels
)
{
s
=
sels
[
i
];
neigh
=
Relations
[
indexCat
][
s
]
neigh
=
TW
.
Relations
[
indexCat
][
s
]
if
(
neigh
)
{
for
(
var
j
in
neigh
)
{
t
=
neigh
[
j
]
...
...
@@ -192,7 +194,7 @@ function changeType() {
// Saving all the nodes&edges to be highlighted.
for
(
var
i
in
sels
)
{
s
=
sels
[
i
];
neigh
=
Relations
[
str_nextState
][
s
]
neigh
=
TW
.
Relations
[
str_nextState
][
s
]
if
(
neigh
)
{
for
(
var
j
in
neigh
)
{
t
=
neigh
[
j
]
...
...
@@ -208,7 +210,7 @@ function changeType() {
}
if
(
sumNextState
==
2
)
{
// we're moving to bipartite subgraph
for
(
var
i
in
Edges
)
{
for
(
var
i
in
TW
.
Edges
)
{
n
=
i
.
split
(
";"
).
map
(
Number
)
if
(
selDict
[
n
[
0
]
]
||
selDict
[
n
[
1
]
]
)
{
nodes_2_colour
[
n
[
0
]]
=
false
;
...
...
@@ -236,36 +238,37 @@ function changeType() {
overNodes
=
true
;
}
partialGraph
.
states
[
avantlastpos
]
=
{};
partialGraph
.
states
[
avantlastpos
].
LouvainFait
=
false
;
partialGraph
.
states
[
avantlastpos
].
level
=
present
.
level
;
partialGraph
.
states
[
avantlastpos
].
selections
=
selsbackup
;
partialGraph
.
states
[
avantlastpos
].
type
=
present
.
type
;
partialGraph
.
states
[
avantlastpos
].
opposites
=
present
.
opposites
;
partialGraph
.
states
[
avantlastpos
].
categories
=
present
.
categories
;
//to_del
partialGraph
.
states
[
avantlastpos
].
categoriesDict
=
present
.
categoriesDict
;
//to_del
TW
.
partialGraph
.
states
[
avantlastpos
]
=
{};
TW
.
partialGraph
.
states
[
avantlastpos
].
LouvainFait
=
false
;
TW
.
partialGraph
.
states
[
avantlastpos
].
level
=
present
.
level
;
TW
.
partialGraph
.
states
[
avantlastpos
].
selections
=
selsbackup
;
TW
.
partialGraph
.
states
[
avantlastpos
].
type
=
present
.
type
;
TW
.
partialGraph
.
states
[
avantlastpos
].
opposites
=
present
.
opposites
;
TW
.
partialGraph
.
states
[
avantlastpos
].
categories
=
present
.
categories
;
//to_del
TW
.
partialGraph
.
states
[
avantlastpos
].
categoriesDict
=
present
.
categoriesDict
;
//to_del
partialGraph
.
states
[
lastpos
].
setState
({
TW
.
partialGraph
.
states
[
lastpos
].
setState
({
type
:
nextState
,
level
:
level
,
sels
:
Object
.
keys
(
selections
).
map
(
Number
),
oppos
:
[]
})
partialGraph
.
states
[
lastpos
].
categories
=
present
.
categories
;
//to_del
partialGraph
.
states
[
lastpos
].
categoriesDict
=
catDict
;
//to_del
TW
.
partialGraph
.
states
[
lastpos
].
categories
=
present
.
categories
;
//to_del
TW
.
partialGraph
.
states
[
lastpos
].
categoriesDict
=
catDict
;
//to_del
fa2enabled
=
true
;
partialGraph
.
zoomTo
(
partialGraph
.
_core
.
width
/
2
,
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();
}
// Documentation Level: *****
function
changeLevel
()
{
var
present
=
partialGraph
.
states
.
slice
(
-
1
)[
0
];
// Last
var
past
=
partialGraph
.
states
.
slice
(
-
2
)[
0
]
// avant Last
var
lastpos
=
partialGraph
.
states
.
length
-
1
;
var
present
=
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
];
// Last
var
past
=
TW
.
partialGraph
.
states
.
slice
(
-
2
)[
0
]
// avant Last
var
lastpos
=
TW
.
partialGraph
.
states
.
length
-
1
;
var
avantlastpos
=
lastpos
-
1
;
var
level
=
present
.
level
;
var
sels
=
present
.
selections
;
//[144, 384, 543]//partialGraph.states.selections;
var
sels
=
present
.
selections
;
//[144, 384, 543]//
TW.
partialGraph.states.selections;
var
catDict
=
present
.
categoriesDict
;
var
type_t0
=
present
.
type
;
...
...
@@ -293,7 +296,7 @@ function changeLevel() {
}
var
str_nextState
=
nextState
.
map
(
Number
).
join
(
"|"
)
partialGraph
.
emptyGraph
();
TW
.
partialGraph
.
emptyGraph
();
var
voisinage
=
{}
// Dictionaries of: selection+neighbors
...
...
@@ -301,7 +304,7 @@ function changeLevel() {
var
edges_2_colour
=
{}
for
(
var
i
in
sels
)
{
s
=
sels
[
i
];
neigh
=
Relations
[
str_type_t0
][
s
]
neigh
=
TW
.
Relations
[
str_type_t0
][
s
]
if
(
neigh
)
{
for
(
var
j
in
neigh
)
{
t
=
neigh
[
j
]
...
...
@@ -340,12 +343,12 @@ function changeLevel() {
futurelevel
=
false
;
}
else
{
// [Change to Global] when level=Local(0)
for
(
var
n
in
Nodes
)
{
if
(
type_t0
[
catDict
[
Nodes
[
n
].
type
]])
for
(
var
n
in
TW
.
Nodes
)
{
if
(
type_t0
[
catDict
[
TW
.
Nodes
[
n
].
type
]])
add1Elem
(
n
)
}
for
(
var
e
in
Edges
)
{
if
(
Edges
[
e
].
categ
==
str_type_t0
)
for
(
var
e
in
TW
.
Edges
)
{
if
(
TW
.
Edges
[
e
].
categ
==
str_type_t0
)
add1Elem
(
e
)
}
futurelevel
=
true
;
...
...
@@ -364,24 +367,24 @@ function changeLevel() {
overNodes
=
true
;
}
partialGraph
.
states
[
avantlastpos
]
=
{};
partialGraph
.
states
[
avantlastpos
].
level
=
present
.
level
;
partialGraph
.
states
[
avantlastpos
].
selections
=
present
.
selections
;
partialGraph
.
states
[
avantlastpos
].
type
=
present
.
type
;
partialGraph
.
states
[
avantlastpos
].
opposites
=
present
.
opposites
;
partialGraph
.
states
[
avantlastpos
].
categories
=
present
.
categories
;
//to_del
partialGraph
.
states
[
avantlastpos
].
categoriesDict
=
present
.
categoriesDict
;
//to_del
TW
.
partialGraph
.
states
[
avantlastpos
]
=
{};
TW
.
partialGraph
.
states
[
avantlastpos
].
level
=
present
.
level
;
TW
.
partialGraph
.
states
[
avantlastpos
].
selections
=
present
.
selections
;
TW
.
partialGraph
.
states
[
avantlastpos
].
type
=
present
.
type
;
TW
.
partialGraph
.
states
[
avantlastpos
].
opposites
=
present
.
opposites
;
TW
.
partialGraph
.
states
[
avantlastpos
].
categories
=
present
.
categories
;
//to_del
TW
.
partialGraph
.
states
[
avantlastpos
].
categoriesDict
=
present
.
categoriesDict
;
//to_del
partialGraph
.
states
[
lastpos
].
setState
({
TW
.
partialGraph
.
states
[
lastpos
].
setState
({
type
:
present
.
type
,
level
:
futurelevel
,
sels
:
Object
.
keys
(
selections
).
map
(
Number
),
oppos
:
[]
})
partialGraph
.
states
[
lastpos
].
categories
=
present
.
categories
;
//to_del
partialGraph
.
states
[
lastpos
].
categoriesDict
=
catDict
;
//to_del
TW
.
partialGraph
.
states
[
lastpos
].
categories
=
present
.
categories
;
//to_del
TW
.
partialGraph
.
states
[
lastpos
].
categoriesDict
=
catDict
;
//to_del
fa2enabled
=
true
;
partialGraph
.
zoomTo
(
partialGraph
.
_core
.
width
/
2
,
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
();
}
//============================= </ NEW BUTTONS > =============================//
...
...
@@ -407,7 +410,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// type_attrb = "type"
// criteria = "size"
if
(
partialGraph
.
_core
.
graph
.
edges
.
length
<
3
)
{
if
(
TW
.
partialGraph
.
_core
.
graph
.
edges
.
length
<
3
)
{
$
(
sliderDivID
).
freshslider
({
range
:
true
,
step
:
1
,
...
...
@@ -420,7 +423,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
return
;
}
var
filterparams
=
AlgorithmForSliders
(
Edges
,
type_attrb
,
type
,
criteria
)
//OK
var
filterparams
=
AlgorithmForSliders
(
TW
.
Edges
,
type_attrb
,
type
,
criteria
)
//OK
pr
(
"EdgeWeightFilter: "
+
type
)
pr
(
filterparams
)
var
steps
=
filterparams
[
"steps"
]
...
...
@@ -443,7 +446,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
pushFilterValue
(
sliderDivID
,
lastvalue
)
var
present
=
partialGraph
.
states
.
slice
(
-
1
)[
0
];
var
present
=
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
];
//finished
$
(
sliderDivID
).
freshslider
({
...
...
@@ -466,7 +469,7 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
pr
(
"
\n
previous value "
+
lastvalue
+
" | current value "
+
filtervalue
)
// [ Stopping FA2 ]
partialGraph
.
stopForceAtlas2
();
TW
.
partialGraph
.
stopForceAtlas2
();
// [ / Stopping FA2 ]
var
t0
=
lastvalue
.
split
(
"-"
)
...
...
@@ -512,18 +515,18 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
// pr("adding "+ids.join())
for
(
var
id
in
ids
)
{
ID
=
ids
[
id
]
Edges
[
ID
].
lock
=
false
;
TW
.
Edges
[
ID
].
lock
=
false
;
if
(
present
.
level
)
{
// pr("\tADD "+ID)
// n = ID.split(";")
// if(n.length>1)
// pr("\t\tsource:("+
Nodes[n[0]].x+","+Nodes[n[0]].y+") ||| target:("+Nodes[n[1]].x+","+
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+")")
add1Elem
(
ID
)
}
else
{
for
(
var
n
in
partialGraph
.
_core
.
graph
.
nodesIndex
)
{
sid
=
Edges
[
ID
].
sourceID
tid
=
Edges
[
ID
].
targetID
for
(
var
n
in
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
)
{
sid
=
TW
.
Edges
[
ID
].
sourceID
tid
=
TW
.
Edges
[
ID
].
targetID
if
(
sid
==
n
||
tid
==
n
)
{
if
(
isUndef
(
getn
(
sid
)))
unHide
(
sid
)
if
(
isUndef
(
getn
(
tid
)))
unHide
(
tid
)
...
...
@@ -542,28 +545,28 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
for
(
var
id
in
ids
)
{
ID
=
ids
[
id
]
if
(
!
isUndef
(
gete
(
ID
)))
{
partialGraph
.
dropEdge
(
ID
)
Edges
[
ID
].
lock
=
true
;
TW
.
partialGraph
.
dropEdge
(
ID
)
TW
.
Edges
[
ID
].
lock
=
true
;
// pr("\tDEL "+ID)
// n = ID.split(";")
// if(n.length>1)
// pr("\t\tsource:("+
Nodes[n[0]].x+","+Nodes[n[0]].y+") ||| target:("+Nodes[n[1]].x+","+
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+")")
}
}
}
}
}
partialGraph
.
refresh
()
partialGraph
.
draw
()
TW
.
partialGraph
.
refresh
()
TW
.
partialGraph
.
draw
()
// console.log("\t\tedgesfilter:")
// console.log("\t\t[ Starting FA2 ]")
// [ Starting FA2 ]
$
.
doTimeout
(
10
,
function
(){
fa2enabled
=
true
;
partialGraph
.
startForceAtlas2
();
fa2enabled
=
true
;
TW
.
partialGraph
.
startForceAtlas2
();
// $.doTimeout(10,function(){
// partialGraph.stopForceAtlas2();
//
TW.
partialGraph.stopForceAtlas2();
// });
});
// [ / Starting FA2 ]
...
...
@@ -597,7 +600,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
// type_attrb = "type"
// criteria = "size"
if
(
partialGraph
.
_core
.
graph
.
nodes
.
length
<
3
)
{
if
(
TW
.
partialGraph
.
_core
.
graph
.
nodes
.
length
<
3
)
{
$
(
sliderDivID
).
freshslider
({
range
:
true
,
...
...
@@ -612,7 +615,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
return
;
}
var
filterparams
=
AlgorithmForSliders
(
Nodes
,
type
,
type_attrb
,
criteria
)
var
filterparams
=
AlgorithmForSliders
(
TW
.
Nodes
,
type
,
type_attrb
,
criteria
)
pr
(
"NodeWeightFilter: "
+
type
)
pr
(
filterparams
)
...
...
@@ -649,7 +652,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
}
// [ Stopping FA2 ]
partialGraph
.
stopForceAtlas2
();
TW
.
partialGraph
.
stopForceAtlas2
();
// [ / Stopping FA2 ]
for
(
var
i
in
finalarray
)
{
...
...
@@ -657,29 +660,29 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
if
(
i
>=
low
&&
i
<=
high
){
for
(
var
id
in
ids
)
{
ID
=
ids
[
id
]
Nodes
[
ID
].
lock
=
false
;
if
(
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
])
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
].
hidden
=
false
;
TW
.
Nodes
[
ID
].
lock
=
false
;
if
(
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
])
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
].
hidden
=
false
;
}
}
else
{
for
(
var
id
in
ids
)
{
ID
=
ids
[
id
]
Nodes
[
ID
].
lock
=
true
;
if
(
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
])
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
].
hidden
=
true
;
TW
.
Nodes
[
ID
].
lock
=
true
;
if
(
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
])
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
].
hidden
=
true
;
}
}
}
pushFilterValue
(
sliderDivID
,
filtervalue
)
partialGraph
.
refresh
()
partialGraph
.
draw
()
TW
.
partialGraph
.
refresh
()
TW
.
partialGraph
.
draw
()
// [ Starting FA2 ]
$
.
doTimeout
(
10
,
function
(){
fa2enabled
=
true
;
partialGraph
.
startForceAtlas2
();
fa2enabled
=
true
;
TW
.
partialGraph
.
startForceAtlas2
();
// $.doTimeout(10,function(){
// partialGraph.stopForceAtlas2();
//
TW.
partialGraph.stopForceAtlas2();
// });
});
// [ / Starting FA2 ]
...
...
@@ -690,23 +693,20 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
}
function
getGraphElement
(
elem
)
{
if
(
elem
.
split
(
";"
).
length
==
1
)
return
partialGraph
.
_core
.
graph
.
nodesIndex
[
elem
];
else
return
partialGraph
.
_core
.
graph
.
edgesIndex
[
elem
]
if
(
elem
.
split
(
";"
).
length
==
1
)
return
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
elem
];
else
return
TW
.
partialGraph
.
_core
.
graph
.
edgesIndex
[
elem
]
}
// Execution modes:
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes1" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size")
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size")
// AlgorithmForSliders (
TW.
partialGraph._core.graph.edges , "label" , "nodes1" , "weight")
// AlgorithmForSliders (
TW.
partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
// AlgorithmForSliders (
TW.
partialGraph._core.graph.nodes , "type" , "Document" , "size")
// AlgorithmForSliders (
TW.
partialGraph._core.graph.nodes , "type" , "NGram" , "size")
function
AlgorithmForSliders
(
elements
,
type_attrb
,
type
,
criteria
)
{
// // ( 1 )
// // get visible sigma nodes|edges
if
(
isUndef
(
elements
))
return
{
"steps"
:
0
,
"finalarray"
:[]};
var
elems
=
[];
/*=elements.filter(function(e) {
return e[type_attrb]==type;
});*/
var
elems
=
[];
for
(
var
e
in
elements
)
{
if
(
elements
[
e
][
type_attrb
]
==
type
)
{
if
(
getGraphElement
(
e
))
{
...
...
@@ -714,7 +714,8 @@ function AlgorithmForSliders( elements , type_attrb , type , criteria) {
}
}
}
if
(
elems
.
length
==
0
)
return
{
"steps"
:
0
,
"finalarray"
:[]};
if
(
elems
.
length
==
0
)
return
{
"steps"
:
0
,
"finalarray"
:[]
};
// 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
;
...
...
@@ -836,7 +837,7 @@ function searchLabel(string){
var
id_node
=
''
;
var
n
;
nds
=
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
){
n
=
nds
[
i
]
if
(
n
.
label
==
string
)
{
...
...
tinawebJS/main.js
View file @
8a351ffa
...
...
@@ -21,6 +21,7 @@
/
\(([\s\S]
*
?)\)
/
,
/
[
$
\w]
+/g
);
var
AjaxSync
=
(
function
(
TYPE
,
URL
,
DATA
,
CT
,
DT
)
{
var
Result
=
[]
TYPE
=
(
!
TYPE
)?
"GET"
:
"POST"
...
...
@@ -46,7 +47,7 @@ var AjaxSync = (function(TYPE, URL, DATA, CT , DT) {
}).
index
();
function
getGexfPath
(
v
){
gexfpath
=
(
gexfDictReverse
[
v
])?
gexfDictReverse
[
v
]:
v
;
var
gexfpath
=
(
TW
.
gexfDictReverse
[
v
])?
TW
.
gexfDictReverse
[
v
]:
v
;
return
gexfpath
;
}
...
...
@@ -57,30 +58,27 @@ function jsActionOnGexfSelector(gexfLegend){
window
.
location
=
window
.
location
.
origin
+
window
.
location
.
pathname
+
"?file="
+
encodeURIComponent
(
gexfLegend
);
}
var
urlfile_override
=
(
isUndef
(
getUrlParam
.
file
))?
false
:
true
;
var
files_selector
=
""
if
(
urlfile_override
)
mainfile
.
unshift
(
getUrlParam
.
file
);
if
(
!
isUndef
(
getUrlParam
.
file
)
)
TW
.
mainfile
.
unshift
(
getUrlParam
.
file
);
unique_mainfile
=
mainfile
.
filter
(
function
(
item
,
pos
)
{
return
mainfile
.
indexOf
(
item
)
==
pos
;
var
unique_mainfile
=
TW
.
mainfile
.
filter
(
function
(
item
,
pos
)
{
return
TW
.
mainfile
.
indexOf
(
item
)
==
pos
;
});
mainfile
=
unique_mainfile
;
TW
.
mainfile
=
unique_mainfile
;
console
.
log
(
"THE URL.FILE PARAM:"
)
console
.
log
(
mainfile
)
console
.
log
(
TW
.
mainfile
)
files_selector
+=
'<select onchange="jsActionOnGexfSelector(this.value);">'
for
(
var
i
in
mainfile
)
{
var
gotoURL
=
window
.
location
.
origin
+
window
.
location
.
pathname
+
"?file="
+
mainfile
[
i
];
files_selector
+=
'<option>'
+
mainfile
[
i
]
+
'</option>'
for
(
var
i
in
TW
.
mainfile
)
{
var
gotoURL
=
window
.
location
.
origin
+
window
.
location
.
pathname
+
"?file="
+
TW
.
mainfile
[
i
];
files_selector
+=
'<option>'
+
TW
.
mainfile
[
i
]
+
'</option>'
}
files_selector
+=
"</select>"
$
(
"#network"
).
html
(
files_selector
)
var
file
=
(
Array
.
isArray
(
mainfile
))?
mainfile
[
0
]:
mainfile
;
var
file
=
(
Array
.
isArray
(
TW
.
mainfile
))?
TW
.
mainfile
[
0
]:
TW
.
mainfile
;
var
RES
=
AjaxSync
({
URL
:
file
});
...
...
@@ -91,7 +89,7 @@ if(RES["OK"]) {
if
(
file
==
"db.json"
)
{
getAdditionalInfo
=
true
;
TW
.
getAdditionalInfo
=
true
;
fileparam
=
file
;
...
...
@@ -103,8 +101,8 @@ if(RES["OK"]) {
for
(
var
gexf
in
the_gexfs
)
{
pr
(
"
\
t
\
t
\
t"
+
gexf
)
pr
(
"
\
t
\
t
\
t
\
t"
+
the_gexfs
[
gexf
][
"semantic"
][
"table"
]
)
field
[
path
+
"/"
+
gexf
]
=
the_gexfs
[
gexf
][
"semantic"
][
"table"
]
gexfDict
[
path
+
"/"
+
gexf
]
=
"A "
+
gexf
TW
.
field
[
path
+
"/"
+
gexf
]
=
the_gexfs
[
gexf
][
"semantic"
][
"table"
]
TW
.
gexfDict
[
path
+
"/"
+
gexf
]
=
"A "
+
gexf
getUrlParam
.
file
=
path
+
"/"
+
gexf
break
}
...
...
@@ -112,8 +110,8 @@ if(RES["OK"]) {
}
pr
(
"
\n
============================
\n
"
)
pr
(
field
)
pr
(
gexfDict
)
pr
(
TW
.
field
)
pr
(
TW
.
gexfDict
)
var
sub_RES
=
AjaxSync
({
URL
:
getUrlParam
.
file
});
the_data
=
sub_RES
[
"data"
]
fileparam
=
sub_RES
[
"format"
]
...
...
@@ -139,23 +137,23 @@ if(RES["OK"]) {
var
possibleStates
=
makeSystemStates
(
categories
)
var
initialState
=
buildInitialState
(
categories
)
//[true,false]//
dicts
=
start
.
makeDicts
(
categories
);
Nodes
=
dicts
.
nodes
;
Edges
=
dicts
.
edges
;
if
(
the_data
.
clusters
)
Clusters
=
the_data
.
clusters
var
dicts
=
start
.
makeDicts
(
categories
);
TW
.
Nodes
=
dicts
.
nodes
;
TW
.
Edges
=
dicts
.
edges
;
if
(
the_data
.
clusters
)
TW
.
Clusters
=
the_data
.
clusters
nodes1
=
dicts
.
n1
;
//not used
TW
.
nodes1
=
dicts
.
n1
;
//not used
var
catDict
=
dicts
.
catDict
pr
(
"CategoriesDict: "
)
pr
(
catDict
)
categoriesIndex
=
categories
;
//to_remove
catSoc
=
categories
[
0
];
//to_remove
catSem
=
(
categories
[
1
])?
categories
[
1
]:
false
;
//to_remove
TW
.
categoriesIndex
=
categories
;
//to_remove
TW
.
catSoc
=
categories
[
0
];
//to_remove
TW
.
catSem
=
(
categories
[
1
])?
categories
[
1
]:
false
;
//to_remove
for
(
var
i
in
categories
)
{
Filters
[
i
]
=
{}
Filters
[
i
][
"#slidercat"
+
i
+
"edgesweight"
]
=
true
;
TW
.
Filters
[
i
]
=
{}
TW
.
Filters
[
i
][
"#slidercat"
+
i
+
"edgesweight"
]
=
true
;
}
// [ Initiating Sigma-Canvas ]
...
...
@@ -169,21 +167,21 @@ if(RES["OK"]) {
// [ Poblating the Sigma-Graph ]
var
sigma_utils
=
new
SigmaUtils
();
partialGraph
=
sigma
.
init
(
document
.
getElementById
(
'sigma-example'
))
TW
.
partialGraph
=
sigma
.
init
(
document
.
getElementById
(
'sigma-example'
))
.
drawingProperties
(
sigmaJsDrawingProperties
)
.
graphProperties
(
sigmaJsGraphProperties
)
.
mouseProperties
(
sigmaJsMouseProperties
);
partialGraph
=
sigma_utils
.
FillGraph
(
initialState
,
catDict
,
dicts
.
nodes
,
dicts
.
edges
,
partialGraph
);
partialGraph
.
states
=
[]
partialGraph
.
states
[
0
]
=
false
;
partialGraph
.
states
[
1
]
=
SystemStates
;
partialGraph
.
states
[
1
].
categories
=
categories
partialGraph
.
states
[
1
].
categoriesDict
=
catDict
;
partialGraph
.
states
[
1
].
type
=
initialState
;
partialGraph
.
states
[
1
].
LouvainFait
=
false
;
TW
.
partialGraph
=
sigma_utils
.
FillGraph
(
initialState
,
catDict
,
dicts
.
nodes
,
dicts
.
edges
,
TW
.
partialGraph
);
TW
.
partialGraph
.
states
=
[]
TW
.
partialGraph
.
states
[
0
]
=
false
;
TW
.
partialGraph
.
states
[
1
]
=
TW
.
SystemStates
;
TW
.
partialGraph
.
states
[
1
].
categories
=
categories
TW
.
partialGraph
.
states
[
1
].
categoriesDict
=
catDict
;
TW
.
partialGraph
.
states
[
1
].
type
=
initialState
;
TW
.
partialGraph
.
states
[
1
].
LouvainFait
=
false
;
// [ / Poblating the Sigma-Graph ]
partialGraph
.
states
[
1
].
setState
=
(
function
(
type
,
level
,
sels
,
oppos
)
{
TW
.
partialGraph
.
states
[
1
].
setState
=
(
function
(
type
,
level
,
sels
,
oppos
)
{
var
bistate
=
false
,
typestring
=
false
;
console
.
log
(
"IN THE SET STATE METHOD:"
)
if
(
!
isUndef
(
type
))
{
...
...
@@ -207,8 +205,8 @@ if(RES["OK"]) {
console
.
log
(
"opposites: "
);
console
.
log
(
oppos
)
var
present
=
partialGraph
.
states
.
slice
(
-
1
)[
0
];
// Last
var
past
=
partialGraph
.
states
.
slice
(
-
2
)[
0
]
// avant Last
var
present
=
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
];
// Last
var
past
=
TW
.
partialGraph
.
states
.
slice
(
-
2
)[
0
]
// avant Last
console
.
log
(
"previous level: "
+
past
.
level
)
console
.
log
(
"new level: "
+
present
.
level
)
...
...
@@ -224,7 +222,7 @@ if(RES["OK"]) {
LevelButtonDisable
(
true
)
// console.log("printing the first state:")
// first_state = partialGraph.states.slice(-1)[0].type;
// first_state =
TW.
partialGraph.states.slice(-1)[0].type;
// for(var i in first_state) {
// if(first_state[i]) {
// for(var j in Filters[i])
...
...
@@ -279,14 +277,14 @@ if(RES["OK"]) {
bgcolor
:
"#FFA500"
,
onchange
:
function
(
value
){
$
.
doTimeout
(
100
,
function
(){
partialGraph
.
iterNodes
(
function
(
n
)
{
if
(
Nodes
[
n
.
id
].
type
==
catSem
)
{
var
newval
=
parseFloat
(
Nodes
[
n
.
id
].
size
)
+
parseFloat
((
value
-
1
))
*
0.3
TW
.
partialGraph
.
iterNodes
(
function
(
n
)
{
if
(
TW
.
Nodes
[
n
.
id
].
type
==
TW
.
catSem
)
{
var
newval
=
parseFloat
(
TW
.
Nodes
[
n
.
id
].
size
)
+
parseFloat
((
value
-
1
))
*
0.3
n
.
size
=
(
newval
<
1.0
)?
1
:
newval
;
sizeMult
[
catSem
]
=
parseFloat
(
value
-
1
)
*
0.3
;
sizeMult
[
TW
.
catSem
]
=
parseFloat
(
value
-
1
)
*
0.3
;
}
});
partialGraph
.
draw
();
TW
.
partialGraph
.
draw
();
});
}
});
...
...
@@ -305,17 +303,17 @@ if(RES["OK"]) {
}
}).
index
();
partialGraph
.
zoomTo
(
partialGraph
.
_core
.
width
/
2
,
partialGraph
.
_core
.
height
/
2
,
0.8
).
draw
();
TW
.
partialGraph
.
zoomTo
(
TW
.
partialGraph
.
_core
.
width
/
2
,
TW
.
partialGraph
.
_core
.
height
/
2
,
0.8
).
draw
();
// fa2enabled=true;
partialGraph.zoomTo(partialGraph._core.width / 2,
partialGraph._core.height / 2, 0.8).draw();
// fa2enabled=true;
TW.partialGraph.zoomTo(TW.partialGraph._core.width / 2, TW.
partialGraph._core.height / 2, 0.8).draw();
// $.doTimeout(1,function(){
// fa2enabled=true; partialGraph.startForceAtlas2();
// fa2enabled=true;
TW.
partialGraph.startForceAtlas2();
// $.doTimeout(10,function(){
// partialGraph.stopForceAtlas2();
//
TW.
partialGraph.stopForceAtlas2();
// });
// });
twjs_
.
initListeners
(
categories
,
partialGraph
);
twjs_
.
initListeners
(
categories
,
TW
.
partialGraph
);
if
(
categories
.
length
==
1
)
{
$
(
"#changetype"
).
hide
();
...
...
tinawebJS/methods.js
View file @
8a351ffa
...
...
@@ -7,21 +7,21 @@ function cancelSelection (fromTagCloud) {
selections
=
[];
//selections.length = 0;
selections
.
splice
(
0
,
selections
.
length
);
partialGraph
.
refresh
();
TW
.
partialGraph
.
refresh
();
partialGraph
.
states
.
slice
(
-
1
)[
0
].
selections
=
[]
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
].
selections
=
[]
//Nodes colors go back to normal
overNodes
=
false
;
e
=
partialGraph
.
_core
.
graph
.
edges
;
e
=
TW
.
partialGraph
.
_core
.
graph
.
edges
;
for
(
i
=
0
;
i
<
e
.
length
;
i
++
){
e
[
i
].
color
=
e
[
i
].
attr
[
'grey'
]
?
e
[
i
].
attr
[
'true_color'
]
:
e
[
i
].
color
;
e
[
i
].
attr
[
'grey'
]
=
0
;
}
partialGraph
.
draw
(
2
,
1
,
2
);
TW
.
partialGraph
.
draw
(
2
,
1
,
2
);
partialGraph
.
iterNodes
(
function
(
n
){
TW
.
partialGraph
.
iterNodes
(
function
(
n
){
n
.
active
=
false
;
n
.
color
=
n
.
attr
[
'grey'
]
?
n
.
attr
[
'true_color'
]
:
n
.
color
;
n
.
attr
[
'grey'
]
=
0
;
...
...
@@ -39,33 +39,33 @@ function cancelSelection (fromTagCloud) {
$
(
"#tips"
).
html
(
getTips
());
}
for
(
var
i
in
deselections
){
if
(
!
isUndef
(
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
])
)
{
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
false
;
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
neighbour
=
false
;
if
(
!
isUndef
(
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
])
)
{
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
forceLabel
=
false
;
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
neighbour
=
false
;
}
}
deselections
=
{};
// leftPanel("close");
if
(
partialGraph
.
states
.
slice
(
-
1
)[
0
].
level
)
if
(
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
].
level
)
LevelButtonDisable
(
true
);
partialGraph
.
draw
();
TW
.
partialGraph
.
draw
();
}
function
highlightSelectedNodes
(
flag
){
pr
(
"
\
t***methods.js:highlightSelectedNodes(flag)"
+
flag
+
" selEmpty:"
+
is_empty
(
selections
))
if
(
!
is_empty
(
selections
)){
for
(
var
i
in
selections
)
{
if
(
Nodes
[
i
].
type
==
catSoc
&&
swclickActual
==
"social"
){
node
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
];
if
(
TW
.
Nodes
[
i
].
type
==
TW
.
catSoc
&&
swclickActual
==
"social"
){
node
=
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
];
node
.
active
=
flag
;
}
else
if
(
Nodes
[
i
].
type
==
catSem
&&
swclickActual
==
"semantic"
)
{
node
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
];
else
if
(
TW
.
Nodes
[
i
].
type
==
TW
.
catSem
&&
swclickActual
==
"semantic"
)
{
node
=
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
];
node
.
active
=
flag
;
}
else
if
(
swclickActual
==
"sociosemantic"
)
{
node
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
];
node
=
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
];
node
.
active
=
flag
;
}
else
break
;
...
...
@@ -114,7 +114,7 @@ function RefreshState(newNOW){
// N : number of nodes
// k : number of ( selected nodes + their neighbors )
// s : number of selections
var
N
=
(
Object
.
keys
(
Nodes
).
filter
(
function
(
n
){
return
Nodes
[
n
].
type
==
catSoc
})
).
length
var
N
=
(
Object
.
keys
(
TW
.
Nodes
).
filter
(
function
(
n
){
return
TW
.
Nodes
[
n
].
type
==
TW
.
catSoc
})
).
length
var
k
=
Object
.
keys
(
getNeighs
(
Object
.
keys
(
selections
),
nodes1
)).
length
var
s
=
Object
.
keys
(
selections
).
length
pr
(
"in social N: "
+
N
+
" - k: "
+
k
+
" - s: "
+
s
)
...
...
@@ -135,7 +135,7 @@ function RefreshState(newNOW){
}
if
(
NOW
==
"B"
||
NOW
==
"b"
)
{
var
N
=
(
Object
.
keys
(
Nodes
).
filter
(
function
(
n
){
return
Nodes
[
n
].
type
==
catSem
})
).
length
var
N
=
(
Object
.
keys
(
TW
.
Nodes
).
filter
(
function
(
n
){
return
TW
.
Nodes
[
n
].
type
==
TW
.
catSem
})
).
length
var
k
=
Object
.
keys
(
getNeighs
(
Object
.
keys
(
selections
),
nodes2
)).
length
var
s
=
Object
.
keys
(
selections
).
length
pr
(
"in semantic N: "
+
N
+
" - k: "
+
k
+
" - s: "
+
s
)
...
...
@@ -169,7 +169,7 @@ function RefreshState(newNOW){
$
(
"#category-B"
).
show
();
}
partialGraph
.
draw
();
TW
.
partialGraph
.
draw
();
}
...
...
@@ -194,10 +194,10 @@ function htmlfied_alternodes(elems) {
(
frec
-
1
)
*
((
desirableTagCloudFont_MAX
-
desirableTagCloudFont_MIN
)
/
(
frecMAX
-
1
));
}
if
(
!
isUndef
(
Nodes
[
id
])){
if
(
!
isUndef
(
TW
.
Nodes
[
id
])){
// js1 js2
// onclick="graphTagCloudElem(' ');
htmlfied_alternode
=
'<span class="tagcloud-item" style="font-size:'
+
fontSize
+
'px;" '
+
js1
+
id
+
js2
+
'>'
+
Nodes
[
id
].
label
+
'</span>'
;
htmlfied_alternode
=
'<span class="tagcloud-item" style="font-size:'
+
fontSize
+
'px;" '
+
js1
+
id
+
js2
+
'>'
+
TW
.
Nodes
[
id
].
label
+
'</span>'
;
oppositesNodes
.
push
(
htmlfied_alternode
)
}
}
...
...
@@ -206,8 +206,8 @@ function htmlfied_alternodes(elems) {
function
manualForceLabel
(
nodeid
,
active
)
{
// pr("manual|"+nodeid+"|"+active)
partialGraph
.
_core
.
graph
.
nodesIndex
[
nodeid
].
active
=
active
;
partialGraph
.
draw
();
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
nodeid
].
active
=
active
;
TW
.
partialGraph
.
draw
();
}
function
htmlfied_samenodes
(
elems
)
{
...
...
@@ -236,9 +236,9 @@ function htmlfied_nodesatts(elems){
information
=
[]
var
id
=
elems
[
i
]
var
node
=
Nodes
[
id
]
var
node
=
TW
.
Nodes
[
id
]
if
(
mainfile
)
{
if
(
TW
.
mainfile
)
{
var
addname
=
(
node
.
attributes
[
"name"
])?
node
.
attributes
[
"name"
]:
""
;
google
=
'<a target="_blank" href="http://www.google.com/search?q='
+
addname
+
"+"
+
node
.
label
.
replace
(
" "
,
"+"
)
+
'">'
;
information
+=
'<li><b>'
+
google
+
node
.
label
+
'</a></b></li>'
;
...
...
@@ -248,7 +248,7 @@ function htmlfied_nodesatts(elems){
}
socnodes
.
push
(
information
);
}
else
{
if
(
node
.
type
==
catSoc
){
if
(
node
.
type
==
TW
.
catSoc
){
information
+=
'<li><b>'
+
node
.
label
+
'</b></li>'
;
if
(
node
.
htmlCont
==
""
){
if
(
!
isUndef
(
node
.
level
))
{
...
...
@@ -260,7 +260,7 @@ function htmlfied_nodesatts(elems){
socnodes
.
push
(
information
)
}
if
(
node
.
type
==
catSem
){
if
(
node
.
type
==
TW
.
catSem
){
information
+=
'<li><b>'
+
node
.
label
+
'</b></li>'
;
google
=
'<a href=http://www.google.com/#hl=en&source=hp&q=%20'
+
node
.
label
.
replace
(
" "
,
"+"
)
+
'%20><img src="'
+
'img/google.png"></img></a>'
;
wiki
=
'<a href=http://en.wikipedia.org/wiki/'
+
node
.
label
.
replace
(
" "
,
"_"
)
+
'><img src="'
+
'img/wikipedia.png"></img></a>'
;
...
...
@@ -318,7 +318,7 @@ function updateLeftPanel_fix( sels , oppos ) {
$
(
"#information"
).
html
(
informationDIV
);
$
(
"#tips"
).
html
(
""
);
if
(
categoriesIndex
.
length
==
1
)
getTopPapers
(
"semantic"
);
if
(
TW
.
categoriesIndex
.
length
==
1
)
getTopPapers
(
"semantic"
);
else
getTopPapers
(
swclickActual
);
}
...
...
@@ -345,7 +345,7 @@ function LevelButtonDisable( TF ){
function
graphTagCloudElem
(
nodes
)
{
pr
(
"in graphTagCloudElem, nodae_id: "
+
nodes
);
cancelSelection
();
partialGraph
.
emptyGraph
();
TW
.
partialGraph
.
emptyGraph
();
var
ndsids
=
[]
...
...
@@ -356,18 +356,18 @@ function graphTagCloudElem(nodes) {
node_id
=
ndsids
[
0
]
var
catDict
=
partialGraph
.
states
.
slice
(
-
1
)[
0
].
categoriesDict
;
var
type
=
Nodes
[
node_id
].
type
;
var
catDict
=
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
].
categoriesDict
;
var
type
=
TW
.
Nodes
[
node_id
].
type
;
var
next_state
=
[];
for
(
var
c
in
catDict
)
next_state
.
push
(
c
==
type
)
var
str_nextstate
=
next_state
.
map
(
Number
).
join
(
"|"
)
var
present
=
partialGraph
.
states
.
slice
(
-
1
)[
0
];
// Last
var
present
=
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
];
// Last
var
level
=
present
.
level
;
var
sels
=
[
node_id
];
//[144, 384, 543]//partialGraph.states.selections;Last
var
lastpos
=
partialGraph
.
states
.
length
-
1
;
var
sels
=
[
node_id
];
//[144, 384, 543]//
TW.
partialGraph.states.selections;Last
var
lastpos
=
TW
.
partialGraph
.
states
.
length
-
1
;
var
avantlastpos
=
lastpos
-
1
;
// Dictionaries of: selection+neighbors
...
...
@@ -376,7 +376,7 @@ function graphTagCloudElem(nodes) {
var
voisinage
=
{}
for
(
var
i
in
sels
)
{
s
=
sels
[
i
];
neigh
=
Relations
[
str_nextstate
][
s
]
neigh
=
TW
.
Relations
[
str_nextstate
][
s
]
if
(
neigh
)
{
for
(
var
j
in
neigh
)
{
t
=
neigh
[
j
]
...
...
@@ -424,33 +424,33 @@ function graphTagCloudElem(nodes) {
overNodes
=
true
;
}
partialGraph
.
states
[
avantlastpos
]
=
{};
partialGraph
.
states
[
avantlastpos
].
level
=
present
.
level
;
partialGraph
.
states
[
avantlastpos
].
selections
=
present
.
selections
;
partialGraph
.
states
[
avantlastpos
].
type
=
present
.
type
;
partialGraph
.
states
[
avantlastpos
].
opposites
=
present
.
opposites
;
partialGraph
.
states
[
avantlastpos
].
categories
=
present
.
categories
;
//to_del
partialGraph
.
states
[
avantlastpos
].
categoriesDict
=
present
.
categoriesDict
;
//to_del
TW
.
partialGraph
.
states
[
avantlastpos
]
=
{};
TW
.
partialGraph
.
states
[
avantlastpos
].
level
=
present
.
level
;
TW
.
partialGraph
.
states
[
avantlastpos
].
selections
=
present
.
selections
;
TW
.
partialGraph
.
states
[
avantlastpos
].
type
=
present
.
type
;
TW
.
partialGraph
.
states
[
avantlastpos
].
opposites
=
present
.
opposites
;
TW
.
partialGraph
.
states
[
avantlastpos
].
categories
=
present
.
categories
;
//to_del
TW
.
partialGraph
.
states
[
avantlastpos
].
categoriesDict
=
present
.
categoriesDict
;
//to_del
partialGraph
.
states
[
lastpos
].
setState
({
TW
.
partialGraph
.
states
[
lastpos
].
setState
({
type
:
next_state
,
level
:
futurelevel
,
sels
:
Object
.
keys
(
selections
).
map
(
Number
),
oppos
:
[]
})
partialGraph
.
states
[
lastpos
].
categories
=
present
.
categories
;
//to_del
partialGraph
.
states
[
lastpos
].
categoriesDict
=
catDict
;
//to_del
TW
.
partialGraph
.
states
[
lastpos
].
categories
=
present
.
categories
;
//to_del
TW
.
partialGraph
.
states
[
lastpos
].
categoriesDict
=
catDict
;
//to_del
fa2enabled
=
true
;
partialGraph
.
zoomTo
(
partialGraph
.
_core
.
width
/
2
,
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
();
ChangeGraphAppearanceByAtt
(
true
)
}
function
greyEverything
(){
nds
=
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
nds
=
TW
.
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
return
!
n
[
'hidden'
];
});
for
(
var
i
in
nds
){
...
...
@@ -462,7 +462,7 @@ function greyEverything(){
nds
[
i
].
attr
[
'grey'
]
=
1
;
}
eds
=
partialGraph
.
_core
.
graph
.
edges
.
filter
(
function
(
e
)
{
eds
=
TW
.
partialGraph
.
_core
.
graph
.
edges
.
filter
(
function
(
e
)
{
return
!
e
[
'hidden'
];
});
for
(
var
i
in
eds
){
...
...
@@ -475,10 +475,10 @@ function greyEverything(){
}
function
graphResetColor
(){
nds
=
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
x
)
{
nds
=
TW
.
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
x
)
{
return
!
x
[
'hidden'
];
});
eds
=
partialGraph
.
_core
.
graph
.
edges
.
filter
(
function
(
x
)
{
eds
=
TW
.
partialGraph
.
_core
.
graph
.
edges
.
filter
(
function
(
x
)
{
return
!
x
[
'hidden'
];
});
...
...
@@ -498,11 +498,11 @@ function graphResetColor(){
function
hideEverything
(){
pr
(
"
\
thiding all"
);
nodeslength
=
0
;
for
(
var
n
in
partialGraph
.
_core
.
graph
.
nodesIndex
){
partialGraph
.
_core
.
graph
.
nodesIndex
[
n
].
hidden
=
true
;
for
(
var
n
in
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
){
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
n
].
hidden
=
true
;
}
for
(
var
e
in
partialGraph
.
_core
.
graph
.
edgesIndex
){
partialGraph
.
_core
.
graph
.
edgesIndex
[
e
].
hidden
=
true
;
for
(
var
e
in
TW
.
partialGraph
.
_core
.
graph
.
edgesIndex
){
TW
.
partialGraph
.
_core
.
graph
.
edgesIndex
[
e
].
hidden
=
true
;
}
overNodes
=
false
;
//magic line!
pr
(
"
\
tall hidded"
);
...
...
@@ -517,43 +517,43 @@ function add1Elem(id) {
id
=
parseInt
(
id
)
if
(
!
isUndef
(
getn
(
id
)))
return
;
if
(
Nodes
[
id
])
{
if
(
TW
.
Nodes
[
id
])
{
var
anode
=
{}
anode
.
id
=
id
;
anode
.
label
=
Nodes
[
id
].
label
;
anode
.
size
=
Nodes
[
id
].
size
;
anode
.
x
=
Nodes
[
id
].
x
;
anode
.
y
=
Nodes
[
id
].
y
;
anode
.
hidden
=
(
Nodes
[
id
].
lock
)?
true
:
false
;
anode
.
type
=
Nodes
[
id
].
type
;
anode
.
color
=
Nodes
[
id
].
color
;
if
(
Nodes
[
id
].
shape
)
anode
.
shape
=
Nodes
[
id
].
shape
;
anode
.
label
=
TW
.
Nodes
[
id
].
label
;
anode
.
size
=
TW
.
Nodes
[
id
].
size
;
anode
.
x
=
TW
.
Nodes
[
id
].
x
;
anode
.
y
=
TW
.
Nodes
[
id
].
y
;
anode
.
hidden
=
(
TW
.
Nodes
[
id
].
lock
)?
true
:
false
;
anode
.
type
=
TW
.
Nodes
[
id
].
type
;
anode
.
color
=
TW
.
Nodes
[
id
].
color
;
if
(
TW
.
Nodes
[
id
].
shape
)
anode
.
shape
=
TW
.
Nodes
[
id
].
shape
;
if
(
Number
(
anode
.
id
)
==
287
)
console
.
log
(
"coordinates of node 287: ( "
+
anode
.
x
+
" , "
+
anode
.
y
+
" ) "
)
if
(
!
Nodes
[
id
].
lock
)
{
updateSearchLabels
(
id
,
Nodes
[
id
].
label
,
Nodes
[
id
].
type
);
if
(
!
TW
.
Nodes
[
id
].
lock
)
{
updateSearchLabels
(
id
,
TW
.
Nodes
[
id
].
label
,
TW
.
Nodes
[
id
].
type
);
nodeslength
++
;
}
partialGraph
.
addNode
(
id
,
anode
);
TW
.
partialGraph
.
addNode
(
id
,
anode
);
return
;
}
}
else
{
// It's an edge!
if
(
!
isUndef
(
gete
(
id
)))
return
;
if
(
Edges
[
id
]
&&
!
Edges
[
id
].
lock
){
// var present = partialGraph.states.slice(-1)[0];
if
(
TW
.
Edges
[
id
]
&&
!
TW
.
Edges
[
id
].
lock
){
// var present =
TW.
partialGraph.states.slice(-1)[0];
var
anedge
=
{
id
:
id
,
sourceID
:
Edges
[
id
].
source
,
targetID
:
Edges
[
id
].
target
,
sourceID
:
TW
.
Edges
[
id
].
source
,
targetID
:
TW
.
Edges
[
id
].
target
,
lock
:
false
,
label
:
Edges
[
id
].
label
,
type
:
Edges
[
id
].
type
,
categ
:
Edges
[
id
].
categ
,
weight
:
Edges
[
id
].
weight
label
:
TW
.
Edges
[
id
].
label
,
type
:
TW
.
Edges
[
id
].
type
,
categ
:
TW
.
Edges
[
id
].
categ
,
weight
:
TW
.
Edges
[
id
].
weight
};
partialGraph
.
addEdge
(
id
,
anedge
.
sourceID
,
anedge
.
targetID
,
anedge
);
TW
.
partialGraph
.
addEdge
(
id
,
anedge
.
sourceID
,
anedge
.
targetID
,
anedge
);
return
;
}
}
...
...
@@ -614,7 +614,7 @@ function saveGEXF(nodes,edges,atts){
}
gexf
+=
' <attvalues>
\
n'
;
gexf
+=
' <attvalue for="0" value="'
+
nodes
[
n
].
type
+
'"/>
\
n'
;
gexf
+=
' <attvalue for="1" value="'
+
Nodes
[
nodes
[
n
].
id
].
CC
+
'"/>
\
n'
;
gexf
+=
' <attvalue for="1" value="'
+
TW
.
Nodes
[
nodes
[
n
].
id
].
CC
+
'"/>
\
n'
;
gexf
+=
' </attvalues>
\
n'
;
gexf
+=
'</node>
\
n'
;
}
...
...
@@ -636,17 +636,17 @@ function saveGraphIMG(){
var
strDownloadMime
=
"image/octet-stream"
var
nodesDiv
=
partialGraph
.
_core
.
domElements
.
nodes
;
var
nodesDiv
=
TW
.
partialGraph
.
_core
.
domElements
.
nodes
;
var
nodesCtx
=
nodesDiv
.
getContext
(
"2d"
);
var
edgesDiv
=
partialGraph
.
_core
.
domElements
.
edges
;
var
edgesDiv
=
TW
.
partialGraph
.
_core
.
domElements
.
edges
;
var
edgesCtx
=
edgesDiv
.
getContext
(
"2d"
);
var
hoverDiv
=
partialGraph
.
_core
.
domElements
.
hover
;
var
hoverDiv
=
TW
.
partialGraph
.
_core
.
domElements
.
hover
;
var
hoverCtx
=
hoverDiv
.
getContext
(
"2d"
);
var
labelsDiv
=
partialGraph
.
_core
.
domElements
.
labels
;
var
labelsDiv
=
TW
.
partialGraph
.
_core
.
domElements
.
labels
;
var
labelsCtx
=
labelsDiv
.
getContext
(
"2d"
);
nodesCtx
.
drawImage
(
hoverDiv
,
0
,
0
);
...
...
tinawebJS/sigma.forceatlas2.js
View file @
8a351ffa
...
...
@@ -341,7 +341,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
var
swingingVSnodes_length
=
swingingSum
/
nodes
.
length
;
/**/
if
(
stopcriteria
&&
(
convg
>
swingingVSnodes_length
)){
pr
(
"i've applied the stopcriteria: "
+
self
.
count
)
partialGraph
.
stopForceAtlas2
();
TW
.
partialGraph
.
stopForceAtlas2
();
}
self
.
p
.
totalEffectiveTraction
=
totalEffectiveTraction
;
...
...
@@ -1128,7 +1128,7 @@ sigma.publicPrototype.startForceAtlas2 = function() {
}
if
(
isolatedBCauseFilter
==
ene
)
{
partialGraph
.
stopForceAtlas2
();
TW
.
partialGraph
.
stopForceAtlas2
();
return
;
}
...
...
@@ -1139,12 +1139,12 @@ sigma.publicPrototype.startForceAtlas2 = function() {
return
true
;
});
var
present
=
partialGraph
.
states
.
slice
(
-
1
)[
0
]
var
present
=
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
]
// fixing anomaly in forceatlas2
$
.
doTimeout
(
250
,
function
(){
if
(
!
present
.
level
&&
partialGraph
.
forceatlas2
.
active
&&
partialGraph
.
forceatlas2
.
count
==
0
)
{
if
(
!
present
.
level
&&
TW
.
partialGraph
.
forceatlas2
.
active
&&
TW
.
partialGraph
.
forceatlas2
.
count
==
0
)
{
pr
(
"SUPER JUTSU!!"
)
partialGraph
.
startForceAtlas2
();
TW
.
partialGraph
.
startForceAtlas2
();
return
;
}
});
...
...
@@ -1153,7 +1153,7 @@ sigma.publicPrototype.startForceAtlas2 = function() {
};
sigma
.
publicPrototype
.
stopForceAtlas2
=
function
()
{
var
present
=
partialGraph
.
states
.
slice
(
-
1
)[
0
]
var
present
=
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
]
if
(
this
.
forceatlas2
)
{
if
(
this
.
forceatlas2
.
count
)
{
pr
(
"
\
t
\
t
\
t
\
t
\
tFA2 Stopped: "
+
this
.
forceatlas2
.
count
)
...
...
@@ -1162,14 +1162,14 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
first_state
=
present
.
type
;
for
(
var
i
in
first_state
)
{
if
(
first_state
[
i
])
{
for
(
var
j
in
Filters
[
i
])
{
for
(
var
j
in
TW
.
Filters
[
i
])
{
original
=
lastFilter
[
j
][
"orig"
]
thelast
=
lastFilter
[
j
][
"last"
]
if
(
thelast
!=
"-"
)
{
if
(
original
==
thelast
)
{
for
(
var
i
in
partialGraph
.
_core
.
graph
.
nodesIndex
){
Nodes
[
i
].
x
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
x
;
Nodes
[
i
].
y
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
y
;
for
(
var
i
in
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
){
TW
.
Nodes
[
i
].
x
=
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
x
;
TW
.
Nodes
[
i
].
y
=
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
y
;
}
}
}
...
...
@@ -1182,15 +1182,14 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
this
.
forceatlas2
.
count
=
0
;
}
this
.
removeGenerator
(
'forceatlas2'
);
partialGraph
.
refresh
();
if
(
minimap
)
$
(
"#overviewzone"
).
show
();
TW
.
partialGraph
.
refresh
();
if
(
first_time
)
{
$
.
doTimeout
(
100
,
function
(){
pr
(
"
\
t
\
t
\
t
\
t
\
tFirst time FA2 Stopped"
)
for
(
var
i
in
partialGraph
.
_core
.
graph
.
nodesIndex
){
Nodes
[
i
].
x
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
x
;
Nodes
[
i
].
y
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
y
;
for
(
var
i
in
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
){
TW
.
Nodes
[
i
].
x
=
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
x
;
TW
.
Nodes
[
i
].
y
=
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
y
;
}
});
first_time
=
false
;
...
...
tinawebJS/sigma.min.js
View file @
8a351ffa
...
...
@@ -1273,9 +1273,9 @@ sigma.classes.Cascade = function() {
*/
function
empty
()
{
if
(
partialGraph
)
{
if
(
partialGraph
.
forceatlas2
)
{
partialGraph
.
stopForceAtlas2
();
if
(
TW
.
partialGraph
)
{
if
(
TW
.
partialGraph
.
forceatlas2
)
{
TW
.
partialGraph
.
stopForceAtlas2
();
}
}
...
...
@@ -2910,8 +2910,8 @@ sigma.classes.Cascade = function() {
self
.
p
.
zoomMultiply
:
1
/
self
.
p
.
zoomMultiply
)
);
partialGraph
.
centreX
=
(
self
.
mouseX
*
(
overviewWidth
/
(
partialGraph
.
_core
.
width
-
1
)));
partialGraph
.
centreY
=
(
self
.
mouseY
*
(
overviewHeight
/
(
partialGraph
.
_core
.
height
-
1
)));
TW
.
partialGraph
.
centreX
=
(
self
.
mouseX
*
(
overviewWidth
/
(
TW
.
partialGraph
.
_core
.
width
-
1
)));
TW
.
partialGraph
.
centreY
=
(
self
.
mouseY
*
(
overviewHeight
/
(
TW
.
partialGraph
.
_core
.
height
-
1
)));
if
(
self
.
p
[
'blockScroll'
])
{
if
(
event
.
preventDefault
)
{
...
...
tinawebJS/sigma.parseCustom.js
View file @
8a351ffa
...
...
@@ -292,13 +292,13 @@ function dictfyGexf( gexf , categories ){
}
var
attention
=
false
if
(
Clusters
.
length
==
0
)
{
if
(
TW
.
Clusters
.
length
==
0
)
{
if
(
nodes
[
1
].
attributes
[
"cluster_index"
]
)
{
attention
=
true
;
}
}
Clusters
=
{}
TW
.
Clusters
=
{}
//New scale for node size: now, between 2 and 5 instead [1,70]
for
(
var
it
in
nodes
){
nodes
[
it
].
size
=
desirableNodeSizeMIN
+
(
parseInt
(
nodes
[
it
].
size
)
-
1
)
*
((
desirableNodeSizeMAX
-
desirableNodeSizeMIN
)
/
(
maxNodeSize
-
minNodeSize
));
...
...
@@ -307,13 +307,13 @@ function dictfyGexf( gexf , categories ){
var
t_cnumber
=
nodes
[
it
].
attributes
[
"cluster_index"
]
nodes
[
it
].
attributes
[
"clust_default"
]
=
t_cnumber
;
var
t_label
=
(
nodes
[
it
].
attributes
[
"cluster_label"
])?
nodes
[
it
].
attributes
[
"cluster_label"
]:
"cluster_"
+
nodes
[
it
].
attributes
[
"cluster_index"
]
if
(
!
Clusters
[
t_type
])
{
Clusters
[
t_type
]
=
{}
Clusters
[
t_type
][
"clust_default"
]
=
{}
if
(
!
TW
.
Clusters
[
t_type
])
{
TW
.
Clusters
[
t_type
]
=
{}
TW
.
Clusters
[
t_type
][
"clust_default"
]
=
{}
}
Clusters
[
t_type
][
"clust_default"
][
t_cnumber
]
=
t_label
TW
.
Clusters
[
t_type
][
"clust_default"
][
t_cnumber
]
=
t_label
}
// partialGraph._core.graph.nodesIndex[it].size=Nodes[it].size;
//
TW.
partialGraph._core.graph.nodesIndex[it].size=Nodes[it].size;
}
...
...
@@ -373,12 +373,12 @@ function dictfyGexf( gexf , categories ){
}
idArray
=
idInRelations
.
map
(
Number
).
join
(
"|"
)
edge
.
categ
=
idArray
;
if
(
!
Relations
[
idArray
])
Relations
[
idArray
]
=
{}
if
(
!
TW
.
Relations
[
idArray
])
TW
.
Relations
[
idArray
]
=
{}
if
(
isUndef
(
Relations
[
idArray
][
source
]))
Relations
[
idArray
][
source
]
=
{};
if
(
isUndef
(
Relations
[
idArray
][
target
]))
Relations
[
idArray
][
target
]
=
{};
Relations
[
idArray
][
source
][
target
]
=
true
;
Relations
[
idArray
][
target
][
source
]
=
true
;
if
(
isUndef
(
TW
.
Relations
[
idArray
][
source
]))
TW
.
Relations
[
idArray
][
source
]
=
{};
if
(
isUndef
(
TW
.
Relations
[
idArray
][
target
]))
TW
.
Relations
[
idArray
][
target
]
=
{};
TW
.
Relations
[
idArray
][
source
][
target
]
=
true
;
TW
.
Relations
[
idArray
][
target
][
source
]
=
true
;
// [ / New Code! ]
...
...
@@ -400,7 +400,7 @@ function dictfyGexf( gexf , categories ){
}
nodes1
[
source
].
neighbours
.
push
(
target
);
nodes1
[
target
].
neighbours
.
push
(
source
);
// partialGraph.addEdge(indice,source,target,edge);
//
TW.
partialGraph.addEdge(indice,source,target,edge);
}
if
(
categories
.
length
>
1
)
{
...
...
@@ -482,9 +482,9 @@ function dictfyGexf( gexf , categories ){
}
}
for
(
var
i
in
Relations
)
{
for
(
var
j
in
Relations
[
i
])
{
Relations
[
i
][
j
]
=
Object
.
keys
(
Relations
[
i
][
j
]).
map
(
Number
)
for
(
var
i
in
TW
.
Relations
)
{
for
(
var
j
in
TW
.
Relations
[
i
])
{
TW
.
Relations
[
i
][
j
]
=
Object
.
keys
(
TW
.
Relations
[
i
][
j
]).
map
(
Number
)
}
}
...
...
@@ -617,12 +617,12 @@ function dictfyJSON( data , categories ) {
}
idArray
=
idInRelations
.
map
(
Number
).
join
(
"|"
)
edge
.
categ
=
idArray
;
if
(
!
Relations
[
idArray
])
Relations
[
idArray
]
=
{}
if
(
!
TW
.
Relations
[
idArray
])
TW
.
Relations
[
idArray
]
=
{}
if
(
isUndef
(
Relations
[
idArray
][
source
]))
Relations
[
idArray
][
source
]
=
{};
if
(
isUndef
(
Relations
[
idArray
][
target
]))
Relations
[
idArray
][
target
]
=
{};
Relations
[
idArray
][
source
][
target
]
=
true
;
Relations
[
idArray
][
target
][
source
]
=
true
;
if
(
isUndef
(
TW
.
Relations
[
idArray
][
source
]))
TW
.
Relations
[
idArray
][
source
]
=
{};
if
(
isUndef
(
TW
.
Relations
[
idArray
][
target
]))
TW
.
Relations
[
idArray
][
target
]
=
{};
TW
.
Relations
[
idArray
][
source
][
target
]
=
true
;
TW
.
Relations
[
idArray
][
target
][
source
]
=
true
;
// [ / New Code! ]
...
...
@@ -720,9 +720,9 @@ function dictfyJSON( data , categories ) {
}
}
for
(
var
i
in
Relations
)
{
for
(
var
j
in
Relations
[
i
])
{
Relations
[
i
][
j
]
=
Object
.
keys
(
Relations
[
i
][
j
]).
map
(
Number
)
for
(
var
i
in
TW
.
Relations
)
{
for
(
var
j
in
TW
.
Relations
[
i
])
{
TW
.
Relations
[
i
][
j
]
=
Object
.
keys
(
TW
.
Relations
[
i
][
j
]).
map
(
Number
)
}
}
...
...
tinawebJS/sigmaUtils.js
View file @
8a351ffa
...
...
@@ -33,11 +33,11 @@ SigmaUtils = function () {
var
typeNow
=
initialState
.
map
(
Number
).
join
(
"|"
)
for
(
var
i
in
Relations
[
typeNow
])
{
for
(
var
i
in
TW
.
Relations
[
typeNow
])
{
s
=
i
;
for
(
var
j
in
Relations
[
typeNow
][
i
])
{
t
=
Relations
[
typeNow
][
i
][
j
]
e
=
Edges
[
s
+
";"
+
t
]
for
(
var
j
in
TW
.
Relations
[
typeNow
][
i
])
{
t
=
TW
.
Relations
[
typeNow
][
i
][
j
]
e
=
TW
.
Edges
[
s
+
";"
+
t
]
if
(
e
)
{
if
(
e
.
source
!=
e
.
target
)
{
var
edge
=
({
...
...
@@ -69,7 +69,7 @@ function showMeSomeLabels(N){
maxIn
=
0
,
minOut
=
50
,
maxOut
=
0
;
partialGraph
.
iterNodes
(
function
(
n
){
TW
.
partialGraph
.
iterNodes
(
function
(
n
){
if
(
n
.
hidden
==
false
){
if
(
parseInt
(
n
.
inDegree
)
<
minIn
)
minIn
=
n
.
inDegree
;
if
(
parseInt
(
n
.
inDegree
)
>
maxIn
)
maxIn
=
n
.
inDegree
;
...
...
@@ -100,51 +100,51 @@ function showMeSomeLabels(N){
if
(
counter
==
N
)
break
;
}
}
partialGraph
.
draw
()
TW
.
partialGraph
.
draw
()
/*======= Show some labels at the beginning =======*/
}
function
getnodes
(){
return
partialGraph
.
_core
.
graph
.
nodes
;
return
TW
.
partialGraph
.
_core
.
graph
.
nodes
;
}
function
getnodesIndex
(){
return
partialGraph
.
_core
.
graph
.
nodesIndex
;
return
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
;
}
function
getedges
(){
return
partialGraph
.
_core
.
graph
.
edges
;
return
TW
.
partialGraph
.
_core
.
graph
.
edges
;
}
function
getedgesIndex
(){
return
partialGraph
.
_core
.
graph
.
edgesIndex
;
return
TW
.
partialGraph
.
_core
.
graph
.
edgesIndex
;
}
function
getVisibleEdges
()
{
return
partialGraph
.
_core
.
graph
.
edges
.
filter
(
function
(
e
)
{
return
TW
.
partialGraph
.
_core
.
graph
.
edges
.
filter
(
function
(
e
)
{
return
!
e
[
'hidden'
];
});
}
function
getVisibleNodes
()
{
return
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
return
TW
.
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
return
!
n
[
'hidden'
];
});
}
function
getNodesByAtt
(
att
)
{
return
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
return
TW
.
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
return
n
[
'type'
]
==
att
;
});
}
function
getn
(
id
){
return
partialGraph
.
_core
.
graph
.
nodesIndex
[
id
];
return
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
id
];
}
function
gete
(
id
){
return
partialGraph
.
_core
.
graph
.
edgesIndex
[
id
];
return
TW
.
partialGraph
.
_core
.
graph
.
edgesIndex
[
id
];
}
...
...
@@ -182,7 +182,7 @@ function getNodeLabels(elems){
var
labelss
=
[]
for
(
var
i
in
elems
){
var
id
=
(
!
isUndef
(
elems
[
i
].
key
))?
elems
[
i
].
key
:
i
labelss
.
push
(
Nodes
[
id
].
label
)
labelss
.
push
(
TW
.
Nodes
[
id
].
label
)
}
return
labelss
}
...
...
@@ -195,7 +195,7 @@ function getNodeIDs(elems){
function
getSelections
(){
params
=
[];
for
(
var
i
in
selections
){
params
.
push
(
Nodes
[
i
].
label
);
params
.
push
(
TW
.
Nodes
[
i
].
label
);
}
return
params
;
}
...
...
@@ -250,7 +250,7 @@ function clustersBy(daclass) {
var
v_nodes
=
getVisibleNodes
();
var
min_pow
=
0
;
for
(
var
i
in
v_nodes
)
{
var
the_node
=
Nodes
[
v_nodes
[
i
].
id
]
var
the_node
=
TW
.
Nodes
[
v_nodes
[
i
].
id
]
var
attval
=
(
isUndef
(
the_node
.
attributes
)
||
isUndef
(
the_node
.
attributes
[
daclass
])
)?
v_nodes
[
i
][
daclass
]:
the_node
.
attributes
[
daclass
];
if
(
!
isNaN
(
parseFloat
(
attval
))
)
{
//is float
while
(
true
)
{
...
...
@@ -268,7 +268,7 @@ function clustersBy(daclass) {
var
real_max
=
-
1
;
var
themult
=
Math
.
pow
(
10
,
min_pow
);
for
(
var
i
in
v_nodes
)
{
var
the_node
=
Nodes
[
v_nodes
[
i
].
id
]
var
the_node
=
TW
.
Nodes
[
v_nodes
[
i
].
id
]
var
attval
=
(
isUndef
(
the_node
.
attributes
)
||
isUndef
(
the_node
.
attributes
[
daclass
])
)?
v_nodes
[
i
][
daclass
]:
the_node
.
attributes
[
daclass
];
var
attnumber
=
Number
(
attval
);
var
round_number
=
Math
.
round
(
attnumber
*
themult
)
;
...
...
@@ -298,19 +298,19 @@ function clustersBy(daclass) {
var
newval_color
=
Math
.
round
(
(
Min_color
+
(
NodeID_Val
[
i
][
"round"
]
-
real_min
)
*
((
Max_color
-
Min_color
)
/
(
real_max
-
real_min
))
)
);
var
hex_color
=
rgbToHex
(
255
,
(
255
-
newval_color
)
,
0
)
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
color
=
hex_color
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
color
=
hex_color
var
newval_size
=
Math
.
round
(
(
Min_size
+
(
NodeID_Val
[
i
][
"round"
]
-
real_min
)
*
((
Max_size
-
Min_size
)
/
(
real_max
-
real_min
))
)
);
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
size
=
newval_size
;
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
size
=
newval_size
;
// pr("real:"+ NodeID_Val[i]["real"] + " | newvalue: "+newval_size)
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
label
=
"("
+
NodeID_Val
[
i
][
"real"
].
toFixed
(
min_pow
)
+
") "
+
Nodes
[
i
].
label
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
i
].
label
=
"("
+
NodeID_Val
[
i
][
"real"
].
toFixed
(
min_pow
)
+
") "
+
TW
.
Nodes
[
i
].
label
}
// [ / Scaling node colours(0-255) and sizes(3-5) ]
partialGraph
.
refresh
();
partialGraph
.
draw
();
TW
.
partialGraph
.
refresh
();
TW
.
partialGraph
.
draw
();
// [ Edge-colour by source-target nodes-colours combination ]
...
...
@@ -324,15 +324,14 @@ function clustersBy(daclass) {
var
r
=
(
a
[
0
]
+
b
[
0
])
>>
1
;
var
g
=
(
a
[
1
]
+
b
[
1
])
>>
1
;
var
b
=
(
a
[
2
]
+
b
[
2
])
>>
1
;
partialGraph
.
_core
.
graph
.
edgesIndex
[
e_id
].
color
=
"rgba("
+
[
r
,
g
,
b
].
join
(
","
)
+
",0.5)"
;
TW
.
partialGraph
.
_core
.
graph
.
edgesIndex
[
e_id
].
color
=
"rgba("
+
[
r
,
g
,
b
].
join
(
","
)
+
",0.5)"
;
}
// [ / Edge-colour by source-target nodes-colours combination ]
if
(
daclass
!=
"degree"
)
set_ClustersLegend
(
daclass
)
set_ClustersLegend
(
null
)
partialGraph
.
refresh
();
partialGraph
.
draw
();
TW
.
partialGraph
.
refresh
();
TW
.
partialGraph
.
draw
();
}
function
colorsBy
(
daclass
)
{
...
...
@@ -346,9 +345,9 @@ function colorsBy(daclass) {
pr
(
""
)
if
(
daclass
==
"clust_louvain"
)
{
if
(
!
partialGraph
.
states
.
slice
(
-
1
)[
0
].
LouvainFait
)
{
if
(
!
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
].
LouvainFait
)
{
RunLouvain
()
partialGraph
.
states
.
slice
(
-
1
)[
0
].
LouvainFait
=
true
TW
.
partialGraph
.
states
.
slice
(
-
1
)[
0
].
LouvainFait
=
true
}
}
...
...
@@ -356,11 +355,11 @@ function colorsBy(daclass) {
colorList
.
sort
(
function
(){
return
Math
.
random
()
-
0.5
;
});
for
(
var
i
in
v_nodes
)
{
var
the_node
=
Nodes
[
v_nodes
[
i
].
id
]
var
the_node
=
TW
.
Nodes
[
v_nodes
[
i
].
id
]
var
attval
=
(
isUndef
(
the_node
.
attributes
)
||
isUndef
(
the_node
.
attributes
[
daclass
])
)?
v_nodes
[
i
][
daclass
]:
the_node
.
attributes
[
daclass
];
partialGraph
.
_core
.
graph
.
nodesIndex
[
v_nodes
[
i
].
id
].
color
=
colorList
[
attval
]
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
v_nodes
[
i
].
id
].
color
=
colorList
[
attval
]
}
partialGraph
.
draw
();
TW
.
partialGraph
.
draw
();
// [ Edge-colour by source-target nodes-colours combination ]
var
v_edges
=
getVisibleEdges
();
...
...
@@ -374,18 +373,18 @@ function colorsBy(daclass) {
var
r
=
(
a
[
0
]
+
b
[
0
])
>>
1
;
var
g
=
(
a
[
1
]
+
b
[
1
])
>>
1
;
var
b
=
(
a
[
2
]
+
b
[
2
])
>>
1
;
partialGraph
.
_core
.
graph
.
edgesIndex
[
e_id
].
color
=
"rgba("
+
[
r
,
g
,
b
].
join
(
","
)
+
",0.5)"
;
TW
.
partialGraph
.
_core
.
graph
.
edgesIndex
[
e_id
].
color
=
"rgba("
+
[
r
,
g
,
b
].
join
(
","
)
+
",0.5)"
;
}
}
// [ / Edge-colour by source-target nodes-colours combination ]
set_ClustersLegend
(
daclass
)
partialGraph
.
refresh
();
partialGraph
.
draw
();
TW
.
partialGraph
.
refresh
();
TW
.
partialGraph
.
draw
();
}
//just for fun
function
makeEdgeWeightUndef
()
{
for
(
var
e
in
partialGraph
.
_core
.
graph
.
edges
)
{
partialGraph
.
_core
.
graph
.
edges
[
e
].
weight
=
1
;
for
(
var
e
in
TW
.
partialGraph
.
_core
.
graph
.
edges
)
{
TW
.
partialGraph
.
_core
.
graph
.
edges
[
e
].
weight
=
1
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment