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
b8ef076d
Commit
b8ef076d
authored
Jul 16, 2014
by
PkSM3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
both edge filters ok
parent
18ba0e00
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
371 additions
and
626 deletions
+371
-626
FA2.pyc
php/PySQlite/FA2.pyc
+0
-0
ForceFactory.pyc
php/PySQlite/ForceFactory.pyc
+0
-0
Region.pyc
php/PySQlite/Region.pyc
+0
-0
extractData.py
php/PySQlite/extractData.py
+1
-1
extractData.pyc
php/PySQlite/extractData.pyc
+0
-0
settings_explorerjs.js
settings_explorerjs.js
+6
-1
enviroment.js
tinawebJS/js/enviroment.js
+184
-436
main.js
tinawebJS/js/main.js
+16
-124
methods.js
tinawebJS/js/methods.js
+143
-55
sigma.min.js
tinawebJS/js/sigma.min.js
+20
-9
sigma.parseCustom.js
tinawebJS/js/sigma.parseCustom.js
+1
-0
No files found.
php/PySQlite/FA2.pyc
deleted
100644 → 0
View file @
18ba0e00
File deleted
php/PySQlite/ForceFactory.pyc
deleted
100644 → 0
View file @
18ba0e00
File deleted
php/PySQlite/Region.pyc
deleted
100644 → 0
View file @
18ba0e00
File deleted
php/PySQlite/extractData.py
View file @
b8ef076d
...
@@ -773,7 +773,7 @@ class extract:
...
@@ -773,7 +773,7 @@ class extract:
edge
[
"t"
]
=
n
[
1
]
edge
[
"t"
]
=
n
[
1
]
edge
[
"w"
]
=
str
(
wr
)
edge
[
"w"
]
=
str
(
wr
)
edge
[
"type"
]
=
GG
[
n
[
0
]][
n
[
1
]][
'type'
]
edge
[
"type"
]
=
GG
[
n
[
0
]][
n
[
1
]][
'type'
]
if
edge
[
"type"
]
==
"nodes1"
:
print
wr
#
if edge["type"]=="nodes1": print wr
edges
[
str
(
e
)]
=
edge
edges
[
str
(
e
)]
=
edge
e
+=
1
e
+=
1
#if e%1000 == 0:
#if e%1000 == 0:
...
...
php/PySQlite/extractData.pyc
deleted
100644 → 0
View file @
18ba0e00
File deleted
settings_explorerjs.js
View file @
b8ef076d
...
@@ -30,6 +30,7 @@ var startingNodeId = "1";
...
@@ -30,6 +30,7 @@ var startingNodeId = "1";
var
minLengthAutoComplete
=
1
;
var
minLengthAutoComplete
=
1
;
var
maxSearchResults
=
10
;
var
maxSearchResults
=
10
;
var
strSearchBar
=
"Search"
;
var
strSearchBar
=
"Search"
;
var
cursor_size_min
=
0
;
var
cursor_size_min
=
0
;
var
cursor_size
=
0
;
var
cursor_size
=
0
;
var
cursor_size_max
=
100
;
var
cursor_size_max
=
100
;
...
@@ -52,6 +53,7 @@ var seed=999999999;//defaultseed
...
@@ -52,6 +53,7 @@ var seed=999999999;//defaultseed
var
showLabelsIfZoom
=
2.0
;
var
showLabelsIfZoom
=
2.0
;
var
greyColor
=
"#9b9e9e"
;
// ============ < SIGMA.JS PROPERTIES > ============
// ============ < SIGMA.JS PROPERTIES > ============
...
@@ -113,7 +115,10 @@ var constantNGramFilter;
...
@@ -113,7 +115,10 @@ var constantNGramFilter;
// var nodeFilterB_past = ""
// var nodeFilterB_past = ""
// var nodeFilterB_now = ""
// var nodeFilterB_now = ""
var
lastEdgeFilterA
=
"-"
var
lastFilter
=
[]
lastFilter
[
"#sliderBNodeWeight"
]
=
"-"
lastFilter
[
"#sliderAEdgeWeight"
]
=
"-"
lastFilter
[
"#sliderBEdgeWeight"
]
=
"-"
// var edgeFilterB_past = ""
// var edgeFilterB_past = ""
// var edgeFilterB_now = ""
// var edgeFilterB_now = ""
...
...
tinawebJS/js/enviroment.js
View file @
b8ef076d
...
@@ -337,481 +337,229 @@ function justhide(){
...
@@ -337,481 +337,229 @@ function justhide(){
//=========================== < FILTERS-SLIDERS > ===========================//
//=========================== < FILTERS-SLIDERS > ===========================//
// EdgeWeightFilter("#sliderAEdgeWeight", "label" , "nodes1", "weight");
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
function
EdgeWeightFilter
(
sliderDivID
,
type_attrb
,
type
,
criteria
)
{
function
OrganizeEdgeWeightsForSlider
(
edgtype
)
{
if
(
$
(
sliderDivID
).
html
()
!=
""
)
{
// ( 1 )
pr
(
"
\
t
\
t
\
t
\
t
\
t
\
t[[ algorithm not applied "
+
sliderDivID
+
" ]]"
)
// get visible sigma edges
return
;
visible_edges
=
partialGraph
.
_core
.
graph
.
edges
.
filter
(
function
(
e
)
{
return
!
e
[
'hidden'
]
&&
e
[
"label"
]
==
edgtype
;
});
// ( 2 )
// extract [ "edgeID" : edgeWEIGHT ]
// and save this into edges_weight
var
edges_weight
=
[]
for
(
var
i
in
visible_edges
)
{
e
=
visible_edges
[
i
]
id
=
e
.
id
edges_weight
[
id
]
=
e
.
weight
// pr(id+"\t:\t"+e.weight)
}
}
// sliderDivID = "#sliderAEdgeWeight"
// type = "nodes1"
// type_attrb = "label"
// criteria = "weight"
// sliderDivID = "#sliderBNodeSize"
// type = "NGram"
// type_attrb = "type"
// criteria = "size"
// 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")
var
filterparams
=
AlgorithmForSliders
(
partialGraph
.
_core
.
graph
.
edges
,
type_attrb
,
type
,
criteria
)
var
steps
=
filterparams
[
"steps"
]
var
finalarray
=
filterparams
[
"finalarray"
]
//finished
$
(
sliderDivID
).
freshslider
({
range
:
true
,
step
:
1
,
min
:
0
,
max
:
steps
-
1
,
value
:[
0
,
steps
-
1
],
onchange
:
function
(
low
,
high
){
var
filtervalue
=
low
+
"-"
+
high
// ( 3 )
if
(
filtervalue
!=
lastFilter
[
sliderDivID
])
{
// order dict edges_weight by edge weight
if
(
lastFilter
[
sliderDivID
]
==
"-"
)
{
var
result
=
ArraySortByValue
(
edges_weight
,
function
(
a
,
b
){
pushFilterValue
(
sliderDivID
,
filtervalue
)
return
a
-
b
return
false
//ASCENDENT
});
// // ( 4 )
// printing ordered ASC by weigth
// for (var i in result) {
// r = result[i]
// edgeid = r.key
// edgeweight = r.value
// pr(edgeid+"\t:\t"+edgeweight)
// // e = result[i]
// // pr(e.weight)
// }
var
nb_E
=
result
.
length
var
magnitude
=
(
""
+
nb_E
).
length
//order of magnitude of #visibleedges
var
exponent
=
magnitude
-
1
var
steps
=
Math
.
pow
(
10
,
exponent
)
// #(10 ^ magnit-1) steps
var
stepsize
=
Math
.
round
(
nb_E
/
steps
)
// ~~(visibledges / #steps)
// pr("-----------------------------------")
// pr("number of visible edges: "+nb_E);
// pr("result array:")
// pr(result)
// pr("magnitude : "+magnitude)
// pr("number of steps : "+steps)
// pr("size of one step : "+stepsize)
// pr("-----------------------------------")
var
finalarray
=
[]
var
counter
=
0
for
(
var
i
=
0
;
i
<
steps
;
i
++
)
{
// pr(i)
var
edgIDs
=
[]
for
(
var
j
=
0
;
j
<
stepsize
;
j
++
)
{
if
(
!
isUndef
(
result
[
counter
]))
{
k
=
result
[
counter
].
key
// w = result[counter].value
// pr("\t["+counter+"] : "+w)
edgIDs
.
push
(
k
)
}
}
counter
++
;
// $.doTimeout(300,function (){
}
if
(
edgIDs
.
length
==
0
)
break
;
finalarray
[
i
]
=
edgIDs
}
return
{
"steps"
:
finalarray
.
length
,
"finalarray"
:
finalarray
}
}
function
updateEdgeFilter
(
edgeFilterName
)
{
pr
(
"nothing: Updating edge filter_ "
+
edgeFilterName
);
/*
thing="";
if(edgeFilterName=="social") {
edgeFilterName="#sliderAEdgeWeight";
minvalue="#nodeAFilterMinValue";
maxvalue="#nodeAFilterMaxValue";
thing="nodes1";
}
if(edgeFilterName=="semantic") {
minvalue="#nodeBFilterMinValue";
maxvalue="#nodeBFilterMaxValue";
edgeFilterName="#sliderBEdgeWeight";
thing="nodes2";
}
edges=partialGraph._core.graph.edges.filter(function(e) {
return !e['hidden'];
});
// pr("\tpartialGraph._core.graph.edges: "+partialGraph._core.graph.edges.length);
// pr(partialGraph._core.graph.edges); //#edges=936
// pr("\tpartialGraph._core.graph.edges.filter(function(x){return !x['hidden']});: "+edges.length);
// pr(edges); //#edges=936
edgesByWeight=[];
for
(
var
i
in
finalarray
)
{
for(var i in edges){
ids
=
finalarray
[
i
]
if(edges[i].hidden==false
){
if
(
i
>=
low
&&
i
<=
high
){
if(edges[i].label==thing){
for
(
var
id
in
ids
)
{
if(isUndef(edgesByWeight[edges[i].weight])){
ID
=
ids
[
id
]
edgesByWeight[edges[i].weight]=[];
add1Edge
(
ID
)
}
}
edgesByWeight[edges[i].weight].push(edges[i].id);
}
else
{
for
(
var
id
in
ids
)
{
ID
=
ids
[
id
]
partialGraph
.
dropEdge
(
ID
)
}
}
}
}
}
}
// pr("\tedgesByWeight: ");
pushFilterValue
(
sliderDivID
,
filtervalue
)
// pr(edgesByWeight);
edgesSortedByWeight = ArraySortByKey(edgesByWeight, function(a,b){
return a-b
});
// pr("\tedgesSortedByWeight: ");
if
(
!
is_empty
(
selections
))
// pr(edgesSortedByWeight);
DrawAsSelectedNodes
(
selections
)
normEdges=[];
cont=0;
index=0;
nbCuts=Math.floor(edges.length/10);
for(var i in edgesSortedByWeight){
for(var j in edgesSortedByWeight[i].value){
if(isUndef(normEdges[index])){
normEdges[index]=[];
}
normEdges[index].push(edgesSortedByWeight[i].value[j])
cont++;
if(cont%nbCuts==0) {
index++;
cont=0;
}
}
}
// pr("\tnormEdges: ");
// pr(normEdges);
$(edgeFilterName).slider({
partialGraph
.
refresh
()
range: true,
partialGraph
.
draw
()
min: 0,
// });
max: normEdges.length-1,
values: [0, normEdges.length-1],
step: 1,
animate: true,
slide: function(event, ui) {
$.doTimeout(300,function (){
//console.log("Rango Pesos Arista: "+ui.values[ 0 ]+" , "+ui.values[ 1 ]);
edgesTemp = partialGraph._core.graph.edgesIndex;
for(i=0;i<normEdges.length;i++){
if(i>=ui.values[0] && i<=ui.values[1]){
//$(minvalue).text(ui.values[ 0 ]);
//$(maxvalue).text(ui.values[ 1 ]);
//console.log("Rango Pesos Arista: "+ui.values[ 0 ]+" , "+ui.values[ 1 ]);
for (var j in normEdges[i]){
id=normEdges[i][j];
//pr("unHideElem("+id+");");
// if(isUndef(edgesTemp[id])){
// //source=Edges[id].sourceID;
// //target=Edges[id].targetID;
// //edge=Edges[id];
// pr("unHideElem("+id+");")
unHideElem(id);
//partialGraph.addEdge(id,source,target,edge);
// }
}
}
else {
for (var j in normEdges[i]){
hideElem(normEdges[i][j]);
}
//partialGraph.dropEdge(normEdges[i]);
}
}
}
pr("==========================================")
partialGraph.draw();
});
}
}
});
});
*/
}
}
function
updateBothEdgeFilters
()
{
// NodeWeightFilter ( "#sliderANodeWeight" , "Document" , "type" , "size")
pr
(
"nothing: Updating both edge filters"
);
// NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size")
/*
function
NodeWeightFilter
(
sliderDivID
,
type_attrb
,
type
,
criteria
)
{
edges=partialGraph._core.graph.edges.filter(function(e) {
return !e['hidden'];
});;
scholarsEdgesByWeight=[];
keywordsEdgesByWeight=[];
for(var i in edges){
if
(
$
(
sliderDivID
).
html
()
!=
""
)
{
if(edges[i].label=="nodes1"){
pr
(
"
\
t
\
t
\
t
\
t
\
t
\
t[[ algorithm not applied "
+
sliderDivID
+
" ]]"
)
if(isUndef(scholarsEdgesByWeight[edges[i].weight])){
return
;
scholarsEdgesByWeight[edges[i].weight]=[];
}
scholarsEdgesByWeight[edges[i].weight].push(edges[i].id);
}
if(edges[i].label=="nodes2"){
if(isUndef(keywordsEdgesByWeight[edges[i].weight])){
keywordsEdgesByWeight[edges[i].weight]=[];
}
keywordsEdgesByWeight[edges[i].weight].push(edges[i].id);
}
}
}
scholarsEdgesSortedByWeight = ArraySortByKey(scholarsEdgesByWeight, function(a,b){
// sliderDivID = "#sliderAEdgeWeight"
return a-b
// type = "nodes1"
});
// type_attrb = "label"
// criteria = "weight"
keywordsEdgesSortedByWeight = ArraySortByKey(keywordsEdgesByWeight, function(a,b){
return a-b
// sliderDivID = "#sliderBNodeSize"
});
// type = "NGram"
//
// type_attrb = "type"
// normScholarEdges=[];
// criteria = "size"
// cont=0;
// index=0;
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes1" , "weight")
// for(var i in scholarsEdgesSortedByWeight){
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
// for(var j in scholarsEdgesSortedByWeight[i].value){
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size")
// if(isUndef(normScholarEdges[index])){
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size")
// normScholarEdges[index]=[];
var
filterparams
=
AlgorithmForSliders
(
partialGraph
.
_core
.
graph
.
nodes
,
type_attrb
,
type
,
criteria
)
// }
var
steps
=
filterparams
[
"steps"
]
// normScholarEdges[index].push(scholarsEdgesSortedByWeight[i].value[j])
var
finalarray
=
filterparams
[
"finalarray"
]
// cont++;
// if(cont%20==0) {
//finished
// index++;
$
(
sliderDivID
).
freshslider
({
// cont=0;
// }
// }
// }
// pr(normScholarEdges);
$("#sliderAEdgeWeight").slider({
range
:
true
,
range
:
true
,
min: 0,
max: scholarsEdgesSortedByWeight.length-1,
values: [0, scholarsEdgesSortedByWeight.length-1],
step
:
1
,
step
:
1
,
animate: true,
min
:
0
,
slide: function(event, ui) {
max
:
steps
-
1
,
$.doTimeout(300,function (){
value
:[
0
,
steps
-
1
],
//console.log("Rango Pesos Arista: "+ui.values[ 0 ]+" , "+ui.values[ 1 ]);
onchange
:
function
(
low
,
high
){
edgesTemp = partialGraph._core.graph.edgesIndex;
var
filtervalue
=
low
+
"-"
+
high
for(i=0;i<scholarsEdgesSortedByWeight.length;i++){
if(i>=ui.values[0] && i<=ui.values[1]){
if
(
filtervalue
!=
lastFilter
[
sliderDivID
])
{
for (var j in scholarsEdgesSortedByWeight[i].value){
if
(
lastFilter
[
sliderDivID
]
==
"-"
)
{
id=scholarsEdgesSortedByWeight[i].value[j];
pushFilterValue
(
sliderDivID
,
filtervalue
)
unHideElem(id);
return
false
// if(isUndef(edgesTemp[id])){
// source=Edges[id].sourceID;
// target=Edges[id].targetID;
// edge=Edges[id];
// //partialGraph.addEdge(id,source,target,edge);
// }
}
}
else {
for(var j in scholarsEdgesSortedByWeight[i].value){
hideElem(scholarsEdgesSortedByWeight[i].value[j])
}
}
}
partialGraph.draw();
});
}
}
});
// $.doTimeout(300,function (){
$("#sliderBEdgeWeight").slider({
for
(
var
i
in
finalarray
)
{
range: true,
ids
=
finalarray
[
i
]
min: 0,
if
(
i
>=
low
&&
i
<=
high
){
max: keywordsEdgesSortedByWeight.length-1,
for
(
var
id
in
ids
)
{
values: [0, keywordsEdgesSortedByWeight.length-1],
ID
=
ids
[
id
]
step: 1,
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
].
hidden
=
false
;
animate: true,
slide: function(event, ui) {
$.doTimeout(300,function (){
//console.log("Rango Pesos Arista: "+ui.values[ 0 ]+" , "+ui.values[ 1 ]);
edgesTemp = partialGraph._core.graph.edgesIndex;
for(i=0;i<keywordsEdgesSortedByWeight.length;i++){
if(i>=ui.values[0] && i<=ui.values[1]){
for (var j in keywordsEdgesSortedByWeight[i].value){
id=keywordsEdgesSortedByWeight[i].value[j];
unHideElem(id);
// if(isUndef(edgesTemp[id])){
// source=Edges[id].sourceID;
// target=Edges[id].targetID;
// edge=Edges[id];
// //partialGraph.addEdge(id,source,target,edge);
// }
}
}
}
else
{
for
(
var
id
in
ids
)
{
ID
=
ids
[
id
]
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
].
hidden
=
true
;
}
}
else {
for(var j in keywordsEdgesSortedByWeight[i].value){
hideElem(keywordsEdgesSortedByWeight[i].value[j])
}
}
//partialGraph.dropEdge(keywordsEdgesSortedByWeight[i].value);
}
}
pushFilterValue
(
sliderDivID
,
filtervalue
)
if
(
!
is_empty
(
selections
))
DrawAsSelectedNodes
(
selections
)
partialGraph
.
refresh
()
partialGraph
.
draw
()
// });
}
}
partialGraph.draw();
});
}
}
});
});
*/
}
}
function
updateNodeFilter
(
nodeFilterName
)
{
pr
(
"nothing: Updating node filter_ "
+
nodeFilterName
);
/*
scholarsNodesBySize=[];
keywordsNodesBySize=[];
nodesSortedBySize=[];
nodeType="";
divName="";
pr("something weird is going here dude: enviroment.js|updateNodeFilter(nodeFilterName)")
pr(catSoc)
pr(catSem)
// if(nodeFilterName=="social"){
// nodeType=catSoc;
// divName="#sliderANodeWeight";
// }
// else {
// nodeType=catSem;
// divName="#sliderBNodeWeight";
// }
// nodes=partialGraph._core.graph.nodes.filter(function(n) {
// return !n['hidden'];
// });
// nodesBySize=[];
// for(var i in nodes){
// if(Nodes[nodes[i].id].type==catSoc){
// if(isUndef(nodesBySize[nodes[i].degree])){
// nodesBySize[nodes[i].degree]=[];
// }
// nodesBySize[nodes[i].degree].push(nodes[i].id);
// }
// if(Nodes[nodes[i].id].type==catSem){
// if(isUndef(nodesBySize[nodes[i].size])){
// nodesBySize[nodes[i].size]=[];
// }
// nodesBySize[nodes[i].size].push(nodes[i].id);
// }
// }
// nodesSortedBySize = ArraySortByKey(nodesBySize, function(a,b){
// return a-b
// });
// if(nodeFilterName=="social"){
// return null;
// }
// $(divName).slider({
// range: true,
// min: 0,
// max: nodesSortedBySize.length-1,
// values: [0, nodesSortedBySize.length-1],
// step: 1,
// animate: true,
// slide: function(event, ui) {
// $.doTimeout(300,function (){
// //console.log("Rango Pesos Arista: "+ui.values[ 0 ]+" , "+ui.values[ 1 ]);
// nodesTemp = partialGraph._core.graph.nodesIndex;
// for(i=0;i<nodesSortedBySize.length;i++){
// if(i>=ui.values[0] && i<=ui.values[1]){
// for (var j in nodesSortedBySize[i].value){
// id=nodesSortedBySize[i].value[j];
// nodesTemp[id].hidden=false;
// }
// }
// else {
// for (var j in nodesSortedBySize[i].value){
// id=nodesSortedBySize[i].value[j];
// nodesTemp[id].hidden=true;
// }
// }
// }
// partialGraph.draw();
// });
// }
// });
*/
}
function
updateBothNodeFilters
()
{
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes1" , "weight")
pr
(
"nothing: Updating both node filters"
);
// AlgorithmForSliders ( partialGraph._core.graph.edges , "label" , "nodes2" , "weight")
/*
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "Document" , "size")
nodes=partialGraph._core.graph.nodes.filter(function(n) {
// AlgorithmForSliders ( partialGraph._core.graph.nodes , "type" , "NGram" , "size")
return !n['hidden'];
function
AlgorithmForSliders
(
elements
,
type_attrb
,
type
,
criteria
)
{
// // ( 1 )
// // get visible sigma nodes|edges
elems
=
elements
.
filter
(
function
(
e
)
{
return
e
[
type_attrb
]
==
type
;
});
});
scholarsNodesBySize=[];
keywordsNodesBySize=[];
nodesSortedBySize=[];
for(var i in nodes){
// pr("nodes|edges length: "+elems.length)
if(Nodes[nodes[i].id].type==catSoc){
// // ( 2 )
if(isUndef(scholarsNodesBySize[nodes[i].degree])){
// // extract [ "edgeID" : edgeWEIGHT ] | [ "nodeID" : nodeSIZE ]
scholarsNodesBySize[nodes[i].degree]=[];
// // and save this into edges_weight | nodes_size
}
var
elem_attrb
=
[]
scholarsNodesBySize[nodes[i].degree].push(nodes[i].id);
for
(
var
i
in
elems
)
{
}
e
=
elems
[
i
]
if(Nodes[nodes[i].id].type==catSem){
id
=
e
.
id
if(isUndef(keywordsNodesBySize[nodes[i].size])){
elem_attrb
[
id
]
=
e
[
criteria
]
keywordsNodesBySize[nodes[i].size]=[];
// pr(id+"\t:\t"+e[criteria])
}
keywordsNodesBySize[nodes[i].size].push(nodes[i].id);
}
}
}
scholarsSortedBySize = ArraySortByKey(scholarsNodesBySize, function(a,b){
// pr("{ id : size|weight } ")
return a-b
// pr(elem_attrb)
});
keywordsSortedBySize = ArraySortByKey(keywordsNodesBySize, function(a,b){
// // ( 3 )
// // order dict edges_weight by edge weight | nodes_size by node size
var
result
=
ArraySortByValue
(
elem_attrb
,
function
(
a
,
b
){
return
a
-
b
return
a
-
b
//ASCENDENT
});
});
// $("#sliderANodeWeight").slider({
// pr("result: ")
// range: true,
// pr(result)
// min: 0,
// pr(result.length)
// max: scholarsSortedBySize.length-1,
// // ( 4 )
// values: [0, scholarsSortedBySize.length-1],
// // printing ordered ASC by weigth
// step: 1,
// for (var i in result) {
// animate: true,
// r = result[i]
// slide: function(event, ui) {
// idid = r.key
// $.doTimeout(300,function (){
// elemattrb = r.value
// //console.log("Rango Pesos Arista: "+ui.values[ 0 ]+" , "+ui.values[ 1 ]);
// pr(idid+"\t:\t"+elemattrb)
// nodesTemp = partialGraph._core.graph.nodesIndex;
// // e = result[i]
// for(i=0;i<scholarsSortedBySize.length;i++){
// // pr(e[criteria])
// if(i>=ui.values[0] && i<=ui.values[1]){
// for (var j in scholarsSortedBySize[i].value){
// id=scholarsSortedBySize[i].value[j];
// nodesTemp[id].hidden=false;
// }
// }
// else {
// for (var j in scholarsSortedBySize[i].value){
// id=scholarsSortedBySize[i].value[j];
// nodesTemp[id].hidden=true;
// }
// }
// }
// partialGraph.draw();
// });
// }
// }
// });
var
N
=
result
.
length
$("#sliderBNodeWeight").slider({
var
magnitude
=
(
""
+
N
).
length
//order of magnitude of edges|nodes
range: true,
var
exponent
=
magnitude
-
1
min: 0,
var
steps
=
Math
.
pow
(
10
,
exponent
)
// #(10 ^ magnit-1) steps
max: keywordsSortedBySize.length-1,
var
stepsize
=
Math
.
round
(
N
/
steps
)
// ~~(visibledges / #steps)
values: [0, keywordsSortedBySize.length-1],
step: 1,
// pr("-----------------------------------")
animate: true,
// pr("number of visible nodes|edges: "+N);
slide: function(event, ui) {
// pr("magnitude : "+magnitude)
$.doTimeout(300,function (){
// pr("number of steps : "+steps)
//console.log("Rango Pesos Arista: "+ui.values[ 0 ]+" , "+ui.values[ 1 ]);
// pr("size of one step : "+stepsize)
nodesTemp = partialGraph._core.graph.nodesIndex;
// pr("-----------------------------------")
for(i=0;i<keywordsSortedBySize.length;i++){
if(i>=ui.values[0] && i<=ui.values[1]){
for (var j in keywordsSortedBySize[i].value){
var
finalarray
=
[]
id=keywordsSortedBySize[i].value[j];
var
counter
=
0
nodesTemp[id].hidden=false;
for
(
var
i
=
0
;
i
<
steps
*
2
;
i
++
)
{
}
// pr(i)
}
var
IDs
=
[]
else {
for
(
var
j
=
0
;
j
<
stepsize
;
j
++
)
{
for (var j in keywordsSortedBySize[i].value){
if
(
!
isUndef
(
result
[
counter
]))
{
id=keywordsSortedBySize[i].value[j];
k
=
result
[
counter
].
key
nodesTemp[id].hidden=true;
// w = result[counter].value
}
// pr("\t["+counter+"] : "+w)
IDs
.
push
(
k
)
}
}
counter
++
;
}
}
partialGraph.draw()
;
if
(
IDs
.
length
==
0
)
break
;
});
finalarray
[
i
]
=
IDs
}
}
});
// pr("finalarray: ")
*/
return
{
"steps"
:
finalarray
.
length
,
"finalarray"
:
finalarray
}
}
}
//=========================== </ FILTERS-SLIDERS > ===========================//
//=========================== </ FILTERS-SLIDERS > ===========================//
...
...
tinawebJS/js/main.js
View file @
b8ef076d
...
@@ -34,6 +34,7 @@ if (mainfile) {
...
@@ -34,6 +34,7 @@ if (mainfile) {
if
(
isUndef
(
getUrlParam
.
nodeidparam
))
{
if
(
isUndef
(
getUrlParam
.
nodeidparam
))
{
pr
(
"doing something 'cause i'm a doer"
);
mainfile
=
true
;
pr
(
"doing something 'cause i'm a doer"
);
mainfile
=
true
;
bringTheNoise
(
"data/pkmn_types.gexf"
,
"mono"
);
bringTheNoise
(
"data/pkmn_types.gexf"
,
"mono"
);
scanCategories
();
}
else
{
}
else
{
if
(
getUrlParam
.
nodeidparam
.
indexOf
(
"__"
)
===-
1
){
if
(
getUrlParam
.
nodeidparam
.
indexOf
(
"__"
)
===-
1
){
...
@@ -202,8 +203,6 @@ function bringTheNoise(pathfile,type){
...
@@ -202,8 +203,6 @@ function bringTheNoise(pathfile,type){
// < === DATA EXTRACTED!! === >
// < === DATA EXTRACTED!! === >
if
(
fa2enabled
===
"off"
)
$
(
"#edgesButton"
).
hide
();
if
(
fa2enabled
===
"off"
)
$
(
"#edgesButton"
).
hide
();
// updateEdgeFilter("social");
// updateNodeFilter("social");
pushSWClick
(
"social"
);
pushSWClick
(
"social"
);
// < === ASYNCHRONOUS FA2.JS === >
// < === ASYNCHRONOUS FA2.JS === >
...
@@ -362,7 +361,7 @@ function theListeners(){
...
@@ -362,7 +361,7 @@ function theListeners(){
});
});
/******************* /SEARCH ***********************/
/******************* /SEARCH ***********************/
// button CENTER
$
(
"#lensButton"
).
click
(
function
()
{
$
(
"#lensButton"
).
click
(
function
()
{
partialGraph
.
position
(
0
,
0
,
1
);
partialGraph
.
position
(
0
,
0
,
1
);
partialGraph
.
zoomTo
(
partialGraph
.
_core
.
width
/
2
,
partialGraph
.
_core
.
height
/
2
,
0.8
);
partialGraph
.
zoomTo
(
partialGraph
.
_core
.
width
/
2
,
partialGraph
.
_core
.
height
/
2
,
0.8
);
...
@@ -462,7 +461,10 @@ function theListeners(){
...
@@ -462,7 +461,10 @@ function theListeners(){
}
}
});
});
//finished
// finished but not used
// NodeWeightFilter ( "#sliderANodeWeight" , "Document" , "type" , "size")
$
(
"#sliderANodeWeight"
).
freshslider
({
$
(
"#sliderANodeWeight"
).
freshslider
({
range
:
true
,
range
:
true
,
step
:
1
,
step
:
1
,
...
@@ -473,59 +475,10 @@ function theListeners(){
...
@@ -473,59 +475,10 @@ function theListeners(){
}
}
});
});
// finished
EdgeWeightFilter
(
"#sliderAEdgeWeight"
,
"label"
,
"nodes1"
,
"weight"
);
var
filterparams
=
OrganizeEdgeWeightsForSlider
(
"nodes1"
)
var
steps
=
filterparams
[
"steps"
]
var
finalarray
=
filterparams
[
"finalarray"
]
//finished
$
(
"#sliderAEdgeWeight"
).
freshslider
({
range
:
true
,
step
:
1
,
min
:
0
,
max
:
steps
-
1
,
onchange
:
function
(
low
,
high
){
var
filtervalue
=
low
+
"-"
+
high
// pr("filterNOW: "+filtervalue+" | filterPAST: "+lastEdgeFilterA+" => "+(filtervalue!=lastEdgeFilterA))
if
(
filtervalue
!=
lastEdgeFilterA
)
{
if
(
lastEdgeFilterA
==
"-"
)
{
pushEdgesFilterA
(
filtervalue
)
return
false
}
// $.doTimeout(300,function (){
for
(
var
i
in
finalarray
)
{
ids
=
finalarray
[
i
]
if
(
i
>=
low
&&
i
<=
high
){
for
(
var
id
in
ids
)
{
edgeid
=
ids
[
id
]
add1Edge
(
edgeid
)
// partialGraph.addEdge(edgeid,Edges[edgeid].source,target,edge);
// unHideElem(edgeid)
}
}
else
{
for
(
var
id
in
ids
)
{
edgeid
=
ids
[
id
]
remove1Edge
(
edgeid
)
// hideElem(edgeid)
}
}
}
pushEdgesFilterA
(
filtervalue
)
partialGraph
.
refresh
()
partialGraph
.
draw
()
// });
}
// pr("filterNOW: "+filtervalue+" | filterPAST: "+lastEdgeFilterA+" => "+(filtervalue!=lastEdgeFilterA))
}
});
//finished
//finished
$
(
"#sliderANodeSize"
).
freshslider
({
$
(
"#sliderANodeSize"
).
freshslider
({
step
:
1
,
step
:
1
,
...
@@ -544,24 +497,6 @@ function theListeners(){
...
@@ -544,24 +497,6 @@ function theListeners(){
}
}
});
});
$
(
"#sliderBNodeWeight"
).
freshslider
({
range
:
true
,
step
:
1
,
value
:[
20
,
60
],
onchange
:
function
(
low
,
high
){
console
.
log
(
low
,
high
);
}
});
$
(
"#sliderBEdgeWeight"
).
freshslider
({
range
:
true
,
step
:
1
,
value
:[
20
,
100
],
onchange
:
function
(
low
,
high
){
console
.
log
(
low
,
high
);
}
});
//finished
//finished
$
(
"#sliderBNodeSize"
).
freshslider
({
$
(
"#sliderBNodeSize"
).
freshslider
({
step
:
1
,
step
:
1
,
...
@@ -580,6 +515,12 @@ function theListeners(){
...
@@ -580,6 +515,12 @@ function theListeners(){
}
}
});
});
//NodeWeightFilter ( "#sliderBNodeWeight" , "NGram" , "type" , "size")
// EdgeWeightFilter("#sliderBEdgeWeight", "label" , "nodes2", "weight");
//finished
//finished
$
(
"#unranged-value"
).
freshslider
({
$
(
"#unranged-value"
).
freshslider
({
step
:
1
,
step
:
1
,
...
@@ -594,54 +535,5 @@ function theListeners(){
...
@@ -594,54 +535,5 @@ function theListeners(){
});
});
// $("#sliderSelectionZone").slider({
// value: cursor_size,
// min: parseFloat(cursor_size_min),
// max: parseFloat(cursor_size_max),
// animate: true,
// change: function(event, ui) {
// cursor_size= ui.value;
// //if(cursor_size==0) updateDownNodeEvent(false);
// //else updateDownNodeEvent(true);
// //return callSlider("#sliderSelectionZone", "selectionRadius");
// }
// });
//
// $("#sliderANodeSize").slider({
// value: 1,
// min: 1,
// max: 25,
// animate: true,
// slide: function(event, ui) {
// $.doTimeout(100,function (){
// partialGraph.iterNodes(function (n) {
// pr();
// if(Nodes[n.id].type==catSoc) {
// n.size = parseFloat(Nodes[n.id].size) + parseFloat((ui.value-1))*0.3;
// }
// });
// partialGraph.draw();
// });
// }
// });
// $("#sliderBNodeSize").slider({
// value: 1,
// min: 1,
// max: 25,
// animate: true,
// slide: function(event, ui) {
// $.doTimeout(100,function (){
// partialGraph.iterNodes(function (n) {
// if(Nodes[n.id].type==catSem) {
// n.size = parseFloat(Nodes[n.id].size) + parseFloat((ui.value-1))*0.3;
// }
// });
// partialGraph.draw();
// });
// }
// });
}
}
tinawebJS/js/methods.js
View file @
b8ef076d
...
@@ -228,6 +228,7 @@ function RefreshState(newNOW){
...
@@ -228,6 +228,7 @@ function RefreshState(newNOW){
pr
(
"in social N: "
+
N
+
" - k: "
+
k
+
" - s: "
+
s
)
pr
(
"in social N: "
+
N
+
" - k: "
+
k
+
" - s: "
+
s
)
if
(
NOW
==
"A"
&&
(
s
==
0
||
k
>=
N
))
LevelButtonDisable
(
true
);
if
(
NOW
==
"A"
&&
(
s
==
0
||
k
>=
N
))
LevelButtonDisable
(
true
);
else
LevelButtonDisable
(
false
);
else
LevelButtonDisable
(
false
);
EdgeWeightFilter
(
"#sliderAEdgeWeight"
,
"label"
,
"nodes1"
,
"weight"
);
}
}
if
(
NOW
==
"B"
||
NOW
==
"b"
)
{
if
(
NOW
==
"B"
||
NOW
==
"b"
)
{
var
N
=
Object
.
keys
(
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
){
return
n
.
type
==
catSem
&&
!
n
.
hidden
})).
length
;
var
N
=
Object
.
keys
(
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
){
return
n
.
type
==
catSem
&&
!
n
.
hidden
})).
length
;
...
@@ -236,6 +237,8 @@ function RefreshState(newNOW){
...
@@ -236,6 +237,8 @@ function RefreshState(newNOW){
pr
(
"in semantic N: "
+
N
+
" - k: "
+
k
+
" - s: "
+
s
)
pr
(
"in semantic N: "
+
N
+
" - k: "
+
k
+
" - s: "
+
s
)
if
(
NOW
==
"B"
&&
(
s
==
0
||
k
>=
N
)
)
LevelButtonDisable
(
true
);
if
(
NOW
==
"B"
&&
(
s
==
0
||
k
>=
N
)
)
LevelButtonDisable
(
true
);
else
LevelButtonDisable
(
false
);
else
LevelButtonDisable
(
false
);
EdgeWeightFilter
(
"#sliderBEdgeWeight"
,
"label"
,
"nodes2"
,
"weight"
);
NodeWeightFilter
(
"#sliderBNodeWeight"
,
"type"
,
"NGram"
,
"size"
)
}
}
if
(
NOW
==
"AaBb"
){
if
(
NOW
==
"AaBb"
){
LevelButtonDisable
(
true
);
LevelButtonDisable
(
true
);
...
@@ -249,9 +252,6 @@ function pushSWClick(arg){
...
@@ -249,9 +252,6 @@ function pushSWClick(arg){
}
}
function
pushEdgesFilterA
(
arg
){
lastEdgeFilterA
=
arg
;
}
// it receives entire node
// it receives entire node
function
selection
(
currentNode
){
function
selection
(
currentNode
){
...
@@ -609,8 +609,6 @@ function graphNGrams(node_id){
...
@@ -609,8 +609,6 @@ function graphNGrams(node_id){
node
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
node_id
];
node
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
node_id
];
selection
(
node
);
selection
(
node
);
partialGraph
.
startForceAtlas2
();
partialGraph
.
startForceAtlas2
();
updateEdgeFilter
(
"semantic"
);
updateNodeFilter
(
"semantic"
);
$
(
"#category-A"
).
hide
();
$
(
"#category-A"
).
hide
();
$
(
"#category-B"
).
show
();
$
(
"#category-B"
).
show
();
changeButton
(
"active_tags.png"
);
changeButton
(
"active_tags.png"
);
...
@@ -667,7 +665,6 @@ function graphDocs(node_id){
...
@@ -667,7 +665,6 @@ function graphDocs(node_id){
partialGraph
.
startForceAtlas2
();
partialGraph
.
startForceAtlas2
();
$
(
"#category-A"
).
show
();
$
(
"#category-A"
).
show
();
$
(
"#category-B"
).
hide
();
$
(
"#category-B"
).
hide
();
updateEdgeFilter
(
"social"
);
changeButton
(
"active_scholars.png"
);
changeButton
(
"active_scholars.png"
);
}
}
}
}
...
@@ -686,7 +683,6 @@ function greyEverything(){
...
@@ -686,7 +683,6 @@ function greyEverything(){
// partialGraph._core.graph.nodesIndex[i].forceLabel=false;
// partialGraph._core.graph.nodesIndex[i].forceLabel=false;
// }
// }
// deselections={};
// deselections={};
greyColor
=
'#9b9e9e'
;
nds
=
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
nds
=
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
return
!
n
[
'hidden'
];
return
!
n
[
'hidden'
];
...
@@ -724,7 +720,6 @@ function greyEverything(){
...
@@ -724,7 +720,6 @@ function greyEverything(){
}
}
function
markAsSelected
(
n_id
,
sel
)
{
function
markAsSelected
(
n_id
,
sel
)
{
greyColor
=
'#9b9e9e'
;
if
(
!
isUndef
(
n_id
.
id
))
nodeSel
=
n_id
;
if
(
!
isUndef
(
n_id
.
id
))
nodeSel
=
n_id
;
else
nodeSel
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
n_id
];
else
nodeSel
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
n_id
];
...
@@ -734,11 +729,38 @@ function markAsSelected(n_id,sel) {
...
@@ -734,11 +729,38 @@ function markAsSelected(n_id,sel) {
nodeSel
.
attr
[
'grey'
]
=
0
;
nodeSel
.
attr
[
'grey'
]
=
0
;
if
(
categoriesIndex
.
length
==
1
)
{
if
(
categoriesIndex
.
length
==
1
)
{
pr
(
"jeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeere"
)
if
(
!
isUndef
(
nodes1
[
nodeSel
.
id
])
&&
if
(
!
isUndef
(
nodes1
[
nodeSel
.
id
])
&&
!
isUndef
(
nodes1
[
nodeSel
.
id
].
neighbours
)
!
isUndef
(
nodes1
[
nodeSel
.
id
].
neighbours
)
){
){
neigh
=
nodes1
[
nodeSel
.
id
].
neighbours
;
/**/
neigh
=
nodes1
[
nodeSel
.
id
].
neighbours
;
/**/
for
(
var
i
in
neigh
){
for
(
var
i
in
neigh
){
// nodeVec = partialGraph._core.graph.nodesIndex[neigh[i]];
// // vec.color = vec.attr['true_color'];
// // vec.attr['grey'] = 0;
// // pr("nodeselected: "+nodeSel.id+"\t"+nodeSel.label+"\t\t||\t\tvecino: "+vec.id+"\t"+vec.label)
// possibledge1 = partialGraph._core.graph.edgesIndex[nodeVec.id+";"+nodeSel.id]
// possibledge2 = partialGraph._core.graph.edgesIndex[nodeSel.id+";"+nodeVec.id]
// an_edge = (!isUndef(possibledge1))?possibledge1:possibledge2;
// if(!isUndef(an_edge) && !an_edge.hidden) {
// //highlight node
// nodeVec.hidden = false;
// nodeVec.color = nodeVec.attr['true_color'];
// nodeVec.attr['grey'] = 0;
// //highlight edge
// an_edge.color = an_edge.attr['true_color'];
// an_edge.attr['grey'] = 0;
// }
// if (NOW=="a" || NOW=="b" && nodeVec.color==greyColor)
// nodeVec.hidden = true
vec
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
neigh
[
i
]];
vec
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
neigh
[
i
]];
vec
.
color
=
vec
.
attr
[
'true_color'
];
vec
.
color
=
vec
.
attr
[
'true_color'
];
vec
.
attr
[
'grey'
]
=
0
;
vec
.
attr
[
'grey'
]
=
0
;
...
@@ -754,7 +776,7 @@ function markAsSelected(n_id,sel) {
...
@@ -754,7 +776,7 @@ function markAsSelected(n_id,sel) {
}
}
}
}
}
}
}
}
// two categories network:
else
{
else
{
if
(
swclickActual
==
"social"
)
{
if
(
swclickActual
==
"social"
)
{
if
(
nodeSel
.
type
==
catSoc
){
if
(
nodeSel
.
type
==
catSoc
){
...
@@ -763,23 +785,45 @@ function markAsSelected(n_id,sel) {
...
@@ -763,23 +785,45 @@ function markAsSelected(n_id,sel) {
){
){
neigh
=
nodes1
[
nodeSel
.
id
].
neighbours
;
/**/
neigh
=
nodes1
[
nodeSel
.
id
].
neighbours
;
/**/
for
(
var
i
in
neigh
){
for
(
var
i
in
neigh
){
vec
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
neigh
[
i
]];
vec
.
color
=
vec
.
attr
[
'true_color'
];
nodeVec
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
neigh
[
i
]];
vec
.
attr
[
'grey'
]
=
0
;
// vec.color = vec.attr['true_color'];
an_edge
=
partialGraph
.
_core
.
graph
.
edgesIndex
[
vec
.
id
+
";"
+
nodeSel
.
id
];
// vec.attr['grey'] = 0;
if
(
!
isUndef
(
an_edge
)
&&
!
an_edge
.
hidden
){
// pr("nodeselected: "+nodeSel.id+"\t"+nodeSel.label+"\t\t||\t\tvecino: "+vec.id+"\t"+vec.label)
an_edge
.
color
=
an_edge
.
attr
[
'true_color'
];
an_edge
.
attr
[
'grey'
]
=
0
;
possibledge1
=
partialGraph
.
_core
.
graph
.
edgesIndex
[
nodeVec
.
id
+
";"
+
nodeSel
.
id
]
}
possibledge2
=
partialGraph
.
_core
.
graph
.
edgesIndex
[
nodeSel
.
id
+
";"
+
nodeVec
.
id
]
an_edge
=
partialGraph
.
_core
.
graph
.
edgesIndex
[
nodeSel
.
id
+
";"
+
vec
.
id
];
if
(
!
isUndef
(
an_edge
)
&&
!
an_edge
.
hidden
){
an_edge
=
(
!
isUndef
(
possibledge1
))?
possibledge1
:
possibledge2
;
if
(
!
isUndef
(
an_edge
)
&&
!
an_edge
.
hidden
)
{
//highlight node
// nodeVec.hidden = false;
nodeVec
.
color
=
nodeVec
.
attr
[
'true_color'
];
nodeVec
.
attr
[
'grey'
]
=
0
;
//highlight edge
an_edge
.
color
=
an_edge
.
attr
[
'true_color'
];
an_edge
.
color
=
an_edge
.
attr
[
'true_color'
];
an_edge
.
attr
[
'grey'
]
=
0
;
an_edge
.
attr
[
'grey'
]
=
0
;
}
}
// if ( (NOW=="a" || NOW=="b") && nodeVec.color==grey)
// pr(nodeVec)
// nodeVec.hidden = true
// an_edge=partialGraph._core.graph.edgesIndex[vec.id+";"+nodeSel.id];
// if(!isUndef(an_edge) && !an_edge.hidden){
// an_edge.color = an_edge.attr['true_color'];
// an_edge.attr['grey'] = 0;
// }
// an_edge=partialGraph._core.graph.edgesIndex[nodeSel.id+";"+vec.id];
// if(!isUndef(an_edge) && !an_edge.hidden){
// an_edge.color = an_edge.attr['true_color'];
// an_edge.attr['grey'] = 0;
// }
}
}
}
}
}
}
else
{
else
{
if
(
!
isUndef
(
bipartiteN2D
[
nodeSel
.
id
])
&&
if
(
!
isUndef
(
bipartiteN2D
[
nodeSel
.
id
])
&&
!
isUndef
(
bipartiteN2D
[
nodeSel
.
id
].
neighbours
)
!
isUndef
(
bipartiteN2D
[
nodeSel
.
id
].
neighbours
)
...
@@ -832,19 +876,46 @@ function markAsSelected(n_id,sel) {
...
@@ -832,19 +876,46 @@ function markAsSelected(n_id,sel) {
){
){
neigh
=
nodes2
[
nodeSel
.
id
].
neighbours
;
/**/
neigh
=
nodes2
[
nodeSel
.
id
].
neighbours
;
/**/
for
(
var
i
in
neigh
){
for
(
var
i
in
neigh
){
vec
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
neigh
[
i
]];
vec
.
color
=
vec
.
attr
[
'true_color'
];
nodeVec
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
neigh
[
i
]];
vec
.
attr
[
'grey'
]
=
0
;
// vec.color = vec.attr['true_color'];
an_edge
=
partialGraph
.
_core
.
graph
.
edgesIndex
[
vec
.
id
+
";"
+
nodeSel
.
id
];
// vec.attr['grey'] = 0;
if
(
!
isUndef
(
an_edge
)
&&
!
an_edge
.
hidden
){
// pr("nodeselected: "+nodeSel.id+"\t"+nodeSel.label+"\t\t||\t\tvecino: "+vec.id+"\t"+vec.label)
an_edge
.
color
=
an_edge
.
attr
[
'true_color'
];
an_edge
.
attr
[
'grey'
]
=
0
;
possibledge1
=
partialGraph
.
_core
.
graph
.
edgesIndex
[
nodeVec
.
id
+
";"
+
nodeSel
.
id
]
}
possibledge2
=
partialGraph
.
_core
.
graph
.
edgesIndex
[
nodeSel
.
id
+
";"
+
nodeVec
.
id
]
an_edge
=
partialGraph
.
_core
.
graph
.
edgesIndex
[
nodeSel
.
id
+
";"
+
vec
.
id
];
if
(
!
isUndef
(
an_edge
)
&&
!
an_edge
.
hidden
){
an_edge
=
(
!
isUndef
(
possibledge1
))?
possibledge1
:
possibledge2
;
if
(
!
isUndef
(
an_edge
)
&&
!
an_edge
.
hidden
)
{
//highlight node
// nodeVec.hidden = false;
nodeVec
.
color
=
nodeVec
.
attr
[
'true_color'
];
nodeVec
.
attr
[
'grey'
]
=
0
;
//highlight edge
an_edge
.
color
=
an_edge
.
attr
[
'true_color'
];
an_edge
.
color
=
an_edge
.
attr
[
'true_color'
];
an_edge
.
attr
[
'grey'
]
=
0
;
an_edge
.
attr
[
'grey'
]
=
0
;
}
}
// if ( (NOW=="a" || NOW=="b") && nodeVec.color==grey)
// pr(nodeVec)
// nodeVec.hidden = true
// vec = partialGraph._core.graph.nodesIndex[neigh[i]];
// vec.color = vec.attr['true_color'];
// vec.attr['grey'] = 0;
// an_edge=partialGraph._core.graph.edgesIndex[vec.id+";"+nodeSel.id];
// if(!isUndef(an_edge) && !an_edge.hidden){
// an_edge.color = an_edge.attr['true_color'];
// an_edge.attr['grey'] = 0;
// }
// an_edge=partialGraph._core.graph.edgesIndex[nodeSel.id+";"+vec.id];
// if(!isUndef(an_edge) && !an_edge.hidden){
// an_edge.color = an_edge.attr['true_color'];
// an_edge.attr['grey'] = 0;
// }
}
}
}
}
}
}
...
@@ -942,7 +1013,7 @@ function markAsSelected(n_id,sel) {
...
@@ -942,7 +1013,7 @@ function markAsSelected(n_id,sel) {
}
}
// /* Just in case of unselection */
// /* Just in case of unselection */
// /* Finally I decide not using this unselection. */
// /* Finally I decide not using this unselection. */
// /* We just gr
a
yEverything and color the selections[] */
// /* We just gr
e
yEverything and color the selections[] */
// else { // sel=false <-> unselect(nodeSel)
// else { // sel=false <-> unselect(nodeSel)
//
//
// nodeSel.color = greyColor;
// nodeSel.color = greyColor;
...
@@ -1097,6 +1168,31 @@ function markAsSelected(n_id,sel) {
...
@@ -1097,6 +1168,31 @@ function markAsSelected(n_id,sel) {
// }
// }
}
}
function
DrawAsSelectedNodes
(
nodeskeys
)
{
greyEverything
();
var
ndsids
=
[]
if
(
$
.
isArray
(
nodeskeys
)
)
{
if
(
nodeskeys
.
length
==
0
&&
!
is_empty
(
nodeskeys
))
ndsids
=
Object
.
keys
(
nodeskeys
)
else
ndsids
=
nodeskeys
;
}
else
ndsids
.
push
(
nodeskeys
);
if
(
!
checkBox
)
{
checkBox
=
true
;
for
(
var
i
in
ndsids
){
nodeid
=
ndsids
[
i
]
markAsSelected
(
nodeid
,
true
);
}
checkBox
=
false
;
}
overNodes
=
true
;
}
function
MultipleSelection
(
nodes
){
function
MultipleSelection
(
nodes
){
pr
(
"IN MULTIPLE SELECTION"
)
pr
(
"IN MULTIPLE SELECTION"
)
...
@@ -1349,9 +1445,15 @@ function unHide(id){
...
@@ -1349,9 +1445,15 @@ function unHide(id){
}
}
}
}
function
add1Edge
(
ID
)
{
if
(
gete
(
edgeid
))
return
;
function
pushFilterValue
(
filtername
,
arg
){
lastFilter
[
filtername
]
=
arg
;
}
function
add1Edge
(
ID
)
{
if
(
gete
(
ID
))
return
;
var
s
=
Edges
[
ID
].
sourceID
var
s
=
Edges
[
ID
].
sourceID
var
t
=
Edges
[
ID
].
targetID
var
t
=
Edges
[
ID
].
targetID
var
edge
=
{
var
edge
=
{
...
@@ -1366,10 +1468,6 @@ function add1Edge(ID) {
...
@@ -1366,10 +1468,6 @@ function add1Edge(ID) {
}
}
function
remove1Edge
(
ID
)
{
partialGraph
.
dropEdge
(
ID
);
}
function
hideElem
(
id
){
function
hideElem
(
id
){
if
(
id
.
split
(
";"
).
length
==
1
){
if
(
id
.
split
(
";"
).
length
==
1
){
//updateSearchLabels(id,Nodes[id].label,Nodes[id].type);
//updateSearchLabels(id,Nodes[id].label,Nodes[id].type);
...
@@ -1403,13 +1501,13 @@ function changeToMeso(iwannagraph) {
...
@@ -1403,13 +1501,13 @@ function changeToMeso(iwannagraph) {
// for(var i in partialGraph._core.graph.edgesIndex){
// for(var i in partialGraph._core.graph.edgesIndex){
// e=partialGraph._core.graph.edgesIndex[i];
// e=partialGraph._core.graph.edgesIndex[i];
// if(e.color==
"#9b9e9e"
) {
// if(e.color==
greyColor
) {
// e.hidden=true;
// e.hidden=true;
// }
// }
// }
// }
// for(var i in partialGraph._core.graph.nodesIndex){
// for(var i in partialGraph._core.graph.nodesIndex){
// n=partialGraph._core.graph.nodesIndex[i];
// n=partialGraph._core.graph.nodesIndex[i];
// if(n.color==
"#9b9e9e"
) {
// if(n.color==
greyColor
) {
// n.hidden=true;
// n.hidden=true;
// }
// }
// }
// }
...
@@ -1471,7 +1569,6 @@ function changeToMeso(iwannagraph) {
...
@@ -1471,7 +1569,6 @@ function changeToMeso(iwannagraph) {
}
}
overNodes
=
true
;
overNodes
=
true
;
}
}
updateEdgeFilter
(
iwannagraph
);
}
}
}
}
...
@@ -1490,8 +1587,6 @@ function changeToMeso(iwannagraph) {
...
@@ -1490,8 +1587,6 @@ function changeToMeso(iwannagraph) {
partialGraph
.
startForceAtlas2
();
partialGraph
.
startForceAtlas2
();
socsemFlag
=
true
;
socsemFlag
=
true
;
updateBothEdgeFilters
();
updateBothNodeFilters
();
}
}
}
}
...
@@ -1545,8 +1640,6 @@ function changeToMeso(iwannagraph) {
...
@@ -1545,8 +1640,6 @@ function changeToMeso(iwannagraph) {
}
}
}
}
}
}
updateEdgeFilter
(
iwannagraph
);
updateNodeFilter
(
"semantic"
);
}
}
}
}
// highlightSelectedNodes(true);
// highlightSelectedNodes(true);
...
@@ -1581,9 +1674,6 @@ function changeToMacro(iwannagraph) {
...
@@ -1581,9 +1674,6 @@ function changeToMacro(iwannagraph) {
MultipleSelection
(
Object
.
keys
(
chosenones
))
MultipleSelection
(
Object
.
keys
(
chosenones
))
});
});
updateEdgeFilter
(
iwannagraph
);
updateNodeFilter
(
iwannagraph
);
}
else
{
}
else
{
//iwantograph socio-semantic
//iwantograph socio-semantic
for
(
var
n
in
Nodes
)
unHide
(
n
);
for
(
var
n
in
Nodes
)
unHide
(
n
);
...
@@ -1613,8 +1703,6 @@ function changeToMacro(iwannagraph) {
...
@@ -1613,8 +1703,6 @@ function changeToMacro(iwannagraph) {
unHide
(
e
);
unHide
(
e
);
}
}
}
}
updateBothEdgeFilters
();
updateBothNodeFilters
();
}
}
// highlightSelectedNodes(true);
// highlightSelectedNodes(true);
// // partialGraph.stopForceAtlas2();
// // partialGraph.stopForceAtlas2();
...
...
tinawebJS/js/sigma.min.js
View file @
b8ef076d
...
@@ -1138,6 +1138,7 @@ sigma.classes.Cascade = function() {
...
@@ -1138,6 +1138,7 @@ sigma.classes.Cascade = function() {
function
addEdge
(
id
,
source
,
target
,
params
)
{
function
addEdge
(
id
,
source
,
target
,
params
)
{
if
(
self
.
edgesIndex
[
id
])
{
if
(
self
.
edgesIndex
[
id
])
{
//console.log('Edge "' + id + '" already exists.');
//console.log('Edge "' + id + '" already exists.');
return
;
}
}
if
(
!
self
.
nodesIndex
[
source
])
{
if
(
!
self
.
nodesIndex
[
source
])
{
...
@@ -1150,7 +1151,8 @@ sigma.classes.Cascade = function() {
...
@@ -1150,7 +1151,8 @@ sigma.classes.Cascade = function() {
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);
var
color
;
var
color
;
//pr(params.label);
//pr(params.label);
if
(
params
.
label
==
"nodes1"
)
{
if
(
params
.
label
==
"nodes1"
)
{
...
@@ -1162,12 +1164,12 @@ sigma.classes.Cascade = function() {
...
@@ -1162,12 +1164,12 @@ sigma.classes.Cascade = function() {
if
(
params
.
label
==
"bipartite"
)
{
if
(
params
.
label
==
"bipartite"
)
{
color
=
"#7e9bc2"
;
color
=
"#7e9bc2"
;
}
}
params
=
params
||
{};
params
=
params
||
{};
var
e
=
{
var
e
=
{
'source'
:
self
.
nodesIndex
[
source
],
'source'
:
self
.
nodesIndex
[
source
],
'target'
:
self
.
nodesIndex
[
target
],
'target'
:
self
.
nodesIndex
[
target
],
'size'
:
1
,
'size'
:
1
,
'dead'
:
false
,
'weight'
:
1
,
'weight'
:
1
,
'displaySize'
:
0.5
,
'displaySize'
:
0.5
,
'color'
:
color
,
'color'
:
color
,
...
@@ -1184,7 +1186,6 @@ sigma.classes.Cascade = function() {
...
@@ -1184,7 +1186,6 @@ sigma.classes.Cascade = function() {
for
(
var
k
in
params
)
{
for
(
var
k
in
params
)
{
switch
(
k
)
{
switch
(
k
)
{
case
'id'
:
case
'id'
:
case
'dead'
:
case
'source'
:
case
'source'
:
case
'target'
:
case
'target'
:
break
;
break
;
...
@@ -1209,6 +1210,18 @@ sigma.classes.Cascade = function() {
...
@@ -1209,6 +1210,18 @@ sigma.classes.Cascade = function() {
e
[
'attr'
][
k
]
=
params
[
k
];
e
[
'attr'
][
k
]
=
params
[
k
];
}
}
}
}
// var colS = self.nodesIndex[source].color
// var colT = self.nodesIndex[target].color
// e.attr['true_color'] = color
// e.attr['grey'] = 0
// // if node source and target are inactive, grey edge
// if ( colS==greyColor || colT==greyColor ) {
// e.attr['grey'] = 1
// e.color = greyColor
// }
self
.
edges
.
push
(
e
);
self
.
edges
.
push
(
e
);
self
.
edgesIndex
[
id
.
toString
()]
=
e
;
self
.
edgesIndex
[
id
.
toString
()]
=
e
;
...
@@ -1228,7 +1241,6 @@ sigma.classes.Cascade = function() {
...
@@ -1228,7 +1241,6 @@ sigma.classes.Cascade = function() {
'size'
:
edge
[
'size'
],
'size'
:
edge
[
'size'
],
'type'
:
edge
[
'type'
],
'type'
:
edge
[
'type'
],
'weight'
:
edge
[
'weight'
],
'weight'
:
edge
[
'weight'
],
'dead'
:
edge
[
'dead'
],
'displaySize'
:
edge
[
'displaySize'
],
'displaySize'
:
edge
[
'displaySize'
],
'label'
:
edge
[
'label'
],
'label'
:
edge
[
'label'
],
'hidden'
:
edge
[
'hidden'
],
'hidden'
:
edge
[
'hidden'
],
...
@@ -1251,7 +1263,6 @@ sigma.classes.Cascade = function() {
...
@@ -1251,7 +1263,6 @@ sigma.classes.Cascade = function() {
for
(
var
k
in
copy
)
{
for
(
var
k
in
copy
)
{
switch
(
k
)
{
switch
(
k
)
{
case
'id'
:
case
'id'
:
case
'dead'
:
case
'displaySize'
:
case
'displaySize'
:
break
;
break
;
case
'weight'
:
case
'weight'
:
...
@@ -2379,7 +2390,7 @@ sigma.classes.Cascade = function() {
...
@@ -2379,7 +2390,7 @@ sigma.classes.Cascade = function() {
case
'curve'
:
case
'curve'
:
ctx
.
strokeStyle
=
color
;
ctx
.
strokeStyle
=
color
;
if
(
overNodes
==
false
)
{
if
(
overNodes
==
false
)
{
if
(
color
==
'#9b9e9e'
)
{
if
(
color
==
greyColor
)
{
ctx
.
lineWidth
=
edge
[
'displaySize'
]
/
16
;
ctx
.
lineWidth
=
edge
[
'displaySize'
]
/
16
;
}
}
else
{
else
{
...
@@ -2387,7 +2398,7 @@ sigma.classes.Cascade = function() {
...
@@ -2387,7 +2398,7 @@ sigma.classes.Cascade = function() {
}
}
}
}
else
{
else
{
if
(
color
==
'#9b9e9e'
)
{
if
(
color
==
greyColor
)
{
ctx
.
lineWidth
=
edge
[
'displaySize'
]
/
16
;
ctx
.
lineWidth
=
edge
[
'displaySize'
]
/
16
;
}
}
else
{
else
{
...
...
tinawebJS/js/sigma.parseCustom.js
View file @
b8ef076d
...
@@ -647,6 +647,7 @@ function extractFromJson(data,seed){
...
@@ -647,6 +647,7 @@ function extractFromJson(data,seed){
partialGraph
.
addNode
(
i
,
Nodes
[
i
]);
partialGraph
.
addNode
(
i
,
Nodes
[
i
]);
unHide
(
i
);
unHide
(
i
);
}
}
// pr(Nodes[i])
}
}
var
edgeId
=
0
;
var
edgeId
=
0
;
...
...
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