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
673ee45f
Commit
673ee45f
authored
Oct 20, 2014
by
PkSM3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
isolatedNodes inside FA2
parent
a9d885b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
162 additions
and
21 deletions
+162
-21
explorerjs.html
explorerjs.html
+2
-1
enviroment.js
tinawebJS/js/enviroment.js
+14
-2
sigma.forceatlas2.js
tinawebJS/js/sigma.forceatlas2.js
+146
-18
No files found.
explorerjs.html
View file @
673ee45f
...
...
@@ -101,12 +101,13 @@
</a>
</li>
<!--
<li>
<a>
<button type="button" onclick="partialGraph.stopForceAtlas2();" class="btn btn-sm">wu</button>
</a>
</li>
-->
</ul>
...
...
tinawebJS/js/enviroment.js
View file @
673ee45f
...
...
@@ -228,8 +228,8 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
return
false
}
// partialGraph.stopForceAtlas2();
// partialGraph.stopForceAtlas2()
for
(
var
i
in
finalarray
)
{
ids
=
finalarray
[
i
]
if
(
i
>=
low
&&
i
<=
high
){
...
...
@@ -267,9 +267,13 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
partialGraph
.
refresh
()
partialGraph
.
draw
()
// fa2enabled=true; partialGraph.startForceAtlas2()
// $.doTimeout(300,function(){
// fa2enabled=true; partialGraph.startForceAtlas2();
// });
}
});
//doTimeout
}
...
...
@@ -339,6 +343,9 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
}
// $.doTimeout(300,function (){
// pr(finalarray)
partialGraph
.
stopForceAtlas2
();
for
(
var
i
in
finalarray
)
{
ids
=
finalarray
[
i
]
if
(
i
>=
low
&&
i
<=
high
){
...
...
@@ -362,6 +369,11 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
partialGraph
.
refresh
()
partialGraph
.
draw
()
$
.
doTimeout
(
300
,
function
(){
fa2enabled
=
true
;
partialGraph
.
startForceAtlas2
();
});
// fa2enabled=true; partialGraph.startForceAtlas2()
}
...
...
tinawebJS/js/sigma.forceatlas2.js
View file @
673ee45f
...
...
@@ -9,6 +9,22 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
var
self
=
this
;
this
.
graph
=
graph
;
this
.
count
=
0
;
this
.
isolated
=
0
;
this
.
stepDeg
=
0
;
this
.
minx
=
1000.0
;
this
.
maxx
=
0.0
;
this
.
miny
=
1000.0
;
this
.
maxy
=
0.0
;
this
.
Ox
=
0.0
;
//(this.minx+self.maxx)/2;
this
.
Oy
=
0.0
;
//(self.miny+self.maxy)/2;
this
.
Px
=
0.0
;
this
.
Py
=
0.0
;
this
.
firstit
=
true
;
this
.
R
=
100
;
this
.
p
=
{
linLogMode
:
false
,
...
...
@@ -38,15 +54,29 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
// Runtime (the ForceAtlas2 itself)
this
.
init
=
function
()
{
self
.
firstit
=
true
;
self
.
isolated
=
0
;
// console.log("#Nodes: "+V)
// console.log("#Edges: "+E)
self
.
state
=
{
step
:
0
,
index
:
0
};
// calc dimensions of connected subgraphs
self
.
minx
=
1000.0
;
self
.
maxx
=
0.0
;
self
.
miny
=
1000.0
;
self
.
maxy
=
0.0
;
self
.
graph
.
nodes
.
forEach
(
function
(
n
)
{
if
(
n
.
degree
>
0
)
{
if
(
n
.
x
<
self
.
minx
)
self
.
minx
=
n
.
x
if
(
n
.
x
>
self
.
maxx
)
self
.
maxx
=
n
.
x
if
(
n
.
y
<
self
.
miny
)
self
.
miny
=
n
.
y
if
(
n
.
y
>
self
.
maxy
)
self
.
maxy
=
n
.
y
n
.
fa2
=
{
mass
:
1
+
n
.
degree
,
old_dx
:
0
,
...
...
@@ -55,10 +85,12 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
dy
:
0
};
}
}
else
self
.
isolated
++
;
});
self
.
stepDeg
=
2
/
parseFloat
(
self
.
isolated
);
return
self
;
}
...
...
@@ -78,6 +110,21 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
case
0
:
// Pass init
// Initialise layout data
self
.
count
++
;
if
(
self
.
firstit
)
{
self
.
Ox
=
(
self
.
minx
+
self
.
maxx
)
/
2
;
self
.
Oy
=
(
self
.
miny
+
self
.
maxy
)
/
2
;
self
.
Px
=
self
.
minx
;
self
.
Py
=
self
.
miny
;
self
.
R
=
Math
.
sqrt
(
Math
.
pow
((
self
.
Ox
-
self
.
Px
),
2
)
+
Math
.
pow
((
self
.
Oy
-
self
.
Py
),
2
)
);
self
.
R
=
self
.
R
*
1.2
;
}
var
mult
=
1
;
nodes
.
forEach
(
function
(
n
)
{
if
(
n
.
degree
>
0
)
{
...
...
@@ -98,10 +145,21 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
};
}
}
else
{
if
(
self
.
firstit
)
{
n
.
x
=
self
.
Ox
+
self
.
R
*
Math
.
cos
(
Math
.
PI
*
self
.
stepDeg
*
mult
);
n
.
y
=
self
.
Oy
+
self
.
R
*
Math
.
sin
(
Math
.
PI
*
self
.
stepDeg
*
mult
);
mult
++
;
}
}
});
self
.
firstit
=
false
;
// If Barnes Hut active, initialize root region
if
(
self
.
p
.
barnesHutOptimize
)
{
self
.
rootRegion
=
new
sigma
.
forceatlas2
.
Region
(
nodes
,
0
);
...
...
@@ -310,6 +368,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
case
5
:
// Apply forces
var
i
=
self
.
state
.
index
;
if
(
self
.
p
.
adjustSizes
)
{
pr
(
"en este caso"
);
var
speed
=
self
.
p
.
speed
;
// If nodes overlap prevention is active,
// it's not possible to trust the swinging mesure.
...
...
@@ -336,26 +395,84 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
n
.
y
+=
n
.
fa2
.
dy
*
factor
;
}
}
if
(
self
.
count
%
50
==
0
)
{
nodes
.
forEach
(
function
(
n
)
{
if
(
n
.
degree
>
0
)
{
if
(
n
.
x
<
self
.
minx
)
self
.
minx
=
n
.
x
if
(
n
.
x
>
self
.
maxx
)
self
.
maxx
=
n
.
x
if
(
n
.
y
<
self
.
miny
)
self
.
miny
=
n
.
y
if
(
n
.
y
>
self
.
maxy
)
self
.
maxy
=
n
.
y
}
});
self
.
Ox
=
(
self
.
minx
+
self
.
maxx
)
/
2
;
self
.
Oy
=
(
self
.
miny
+
self
.
maxy
)
/
2
;
self
.
Px
=
self
.
minx
;
self
.
Py
=
self
.
miny
;
self
.
R
=
Math
.
sqrt
(
Math
.
pow
((
self
.
Ox
-
self
.
Px
),
2
)
+
Math
.
pow
((
self
.
Oy
-
self
.
Py
),
2
)
);
self
.
R
=
self
.
R
*
1.2
;
var
mult
=
1
;
nodes
.
forEach
(
function
(
n
)
{
if
(
n
.
degree
==
0
)
{
n
.
x
=
self
.
Ox
+
self
.
R
*
Math
.
cos
(
Math
.
PI
*
self
.
stepDeg
*
mult
);
n
.
y
=
self
.
Oy
+
self
.
R
*
Math
.
sin
(
Math
.
PI
*
self
.
stepDeg
*
mult
);
mult
++
;
}
});
}
}
else
{
var
speed
=
self
.
p
.
speed
;
while
(
i
<
nodes
.
length
&&
i
<
self
.
state
.
index
+
sInt
)
{
var
n
=
nodes
[
i
++
];
var
fixed
=
n
.
fixed
||
false
;
if
(
!
fixed
&&
!
n
.
hidden
&&
n
.
degree
>
0
&&
n
.
fa2
)
{
// Adaptive auto-speed: the speed of each node is lowered
// when the node swings.
var
swinging
=
Math
.
sqrt
(
(
n
.
fa2
.
old_dx
-
n
.
fa2
.
dx
)
*
(
n
.
fa2
.
old_dx
-
n
.
fa2
.
dx
)
+
(
n
.
fa2
.
old_dy
-
n
.
fa2
.
dy
)
*
(
n
.
fa2
.
old_dy
-
n
.
fa2
.
dy
)
);
var
factor
=
speed
/
(
1
+
speed
*
Math
.
sqrt
(
swinging
));
var
speed
=
self
.
p
.
speed
;
while
(
i
<
nodes
.
length
&&
i
<
self
.
state
.
index
+
sInt
)
{
var
n
=
nodes
[
i
++
];
var
fixed
=
n
.
fixed
||
false
;
if
(
!
fixed
&&
!
n
.
hidden
&&
n
.
degree
>
0
&&
n
.
fa2
)
{
// Adaptive auto-speed: the speed of each node is lowered
// when the node swings.
var
swinging
=
Math
.
sqrt
(
(
n
.
fa2
.
old_dx
-
n
.
fa2
.
dx
)
*
(
n
.
fa2
.
old_dx
-
n
.
fa2
.
dx
)
+
(
n
.
fa2
.
old_dy
-
n
.
fa2
.
dy
)
*
(
n
.
fa2
.
old_dy
-
n
.
fa2
.
dy
)
);
var
factor
=
speed
/
(
1
+
speed
*
Math
.
sqrt
(
swinging
));
n
.
x
+=
n
.
fa2
.
dx
*
factor
;
n
.
y
+=
n
.
fa2
.
dy
*
factor
;
}
}
n
.
x
+=
n
.
fa2
.
dx
*
factor
;
n
.
y
+=
n
.
fa2
.
dy
*
factor
;
if
(
self
.
count
%
50
==
0
)
{
nodes
.
forEach
(
function
(
n
)
{
if
(
n
.
degree
>
0
)
{
if
(
n
.
x
<
self
.
minx
)
self
.
minx
=
n
.
x
if
(
n
.
x
>
self
.
maxx
)
self
.
maxx
=
n
.
x
if
(
n
.
y
<
self
.
miny
)
self
.
miny
=
n
.
y
if
(
n
.
y
>
self
.
maxy
)
self
.
maxy
=
n
.
y
}
});
self
.
Ox
=
(
self
.
minx
+
self
.
maxx
)
/
2
;
self
.
Oy
=
(
self
.
miny
+
self
.
maxy
)
/
2
;
self
.
Px
=
self
.
minx
;
self
.
Py
=
self
.
miny
;
self
.
R
=
Math
.
sqrt
(
Math
.
pow
((
self
.
Ox
-
self
.
Px
),
2
)
+
Math
.
pow
((
self
.
Oy
-
self
.
Py
),
2
)
);
self
.
R
=
self
.
R
*
1.2
;
var
mult
=
1
;
nodes
.
forEach
(
function
(
n
)
{
if
(
n
.
degree
==
0
)
{
n
.
x
=
self
.
Ox
+
self
.
R
*
Math
.
cos
(
Math
.
PI
*
self
.
stepDeg
*
mult
);
n
.
y
=
self
.
Oy
+
self
.
R
*
Math
.
sin
(
Math
.
PI
*
self
.
stepDeg
*
mult
);
mult
++
;
}
});
}
}
}
if
(
i
==
nodes
.
length
)
{
...
...
@@ -993,6 +1110,7 @@ sigma.publicPrototype.startForceAtlas2 = function() {
//if(!this.forceatlas2) {
if
(
fa2enabled
)
{
/*
isolatedBCauseFilter = 0;
for (var i in this._core.graph.nodesIndex) {
...
...
@@ -1001,6 +1119,13 @@ sigma.publicPrototype.startForceAtlas2 = function() {
isolatedBCauseFilter++;
}
}
*/
// // -- UPDATING THE DEGREE --
// for (var i in this._core.graph.nodesIndex) {
...
...
@@ -1081,6 +1206,7 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
partialGraph
.
refresh
();
if
(
minimap
)
$
(
"#overviewzone"
).
show
();
/*
// calc dimensions of connected subgraphs
minx=1000.0;
...
...
@@ -1154,5 +1280,7 @@ sigma.publicPrototype.stopForceAtlas2 = function() {
}
}
*/
};
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