Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
ecb87d35
Commit
ecb87d35
authored
Dec 11, 2014
by
PkSM3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implicit-clusters experiment
parent
2bef5f55
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
118 deletions
+89
-118
enviroment.js
tinawebJS/enviroment.js
+3
-3
methods.js
tinawebJS/methods.js
+3
-2
sigma.min.js
tinawebJS/sigma.min.js
+78
-109
sigma.parseCustom.js
tinawebJS/sigma.parseCustom.js
+5
-4
No files found.
tinawebJS/enviroment.js
View file @
ecb87d35
...
@@ -279,8 +279,8 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
...
@@ -279,8 +279,8 @@ function EdgeWeightFilter(sliderDivID , type_attrb , type , criteria) {
sid
=
Edges
[
ID
].
sourceID
sid
=
Edges
[
ID
].
sourceID
tid
=
Edges
[
ID
].
targetID
tid
=
Edges
[
ID
].
targetID
if
(
sid
==
n
||
tid
==
n
)
{
if
(
sid
==
n
||
tid
==
n
)
{
if
(
isUndef
(
getn
(
sid
))
&&
!
Nodes
[
sid
].
hidden
)
unHide
(
sid
)
if
(
isUndef
(
getn
(
sid
)))
unHide
(
sid
)
if
(
isUndef
(
getn
(
tid
))
&&
!
Nodes
[
tid
].
hidden
)
unHide
(
tid
)
if
(
isUndef
(
getn
(
tid
)))
unHide
(
tid
)
add1Edge
(
ID
)
add1Edge
(
ID
)
// pr("\tADD "+ID)
// pr("\tADD "+ID)
}
}
...
@@ -399,7 +399,7 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
...
@@ -399,7 +399,7 @@ function NodeWeightFilter(sliderDivID , type_attrb , type , criteria) {
for
(
var
id
in
ids
)
{
for
(
var
id
in
ids
)
{
ID
=
ids
[
id
]
ID
=
ids
[
id
]
Nodes
[
ID
].
lock
=
false
;
Nodes
[
ID
].
lock
=
false
;
if
(
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
]
&&
!
Nodes
[
ID
].
hidden
)
if
(
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
])
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
].
hidden
=
false
;
partialGraph
.
_core
.
graph
.
nodesIndex
[
ID
].
hidden
=
false
;
}
}
}
else
{
}
else
{
...
...
tinawebJS/methods.js
View file @
ecb87d35
...
@@ -1426,19 +1426,20 @@ function unHide(id){
...
@@ -1426,19 +1426,20 @@ function unHide(id){
//visibleEdges.push(id);
//visibleEdges.push(id);
if
(
!
isUndef
(
gete
(
id
)))
return
;
if
(
!
isUndef
(
gete
(
id
)))
return
;
if
(
Edges
[
id
]
&&
!
Edges
[
id
].
lock
){
if
(
Edges
[
id
]
&&
!
Edges
[
id
].
lock
){
if
(
!
Nodes
[
Edges
[
id
].
sourceID
].
hidden
&&
!
Nodes
[
Edges
[
id
].
targetID
].
hidden
)
{
//
if (!Nodes[Edges[id].sourceID].hidden && !Nodes[Edges[id].targetID].hidden) {
var
anedge
=
{
var
anedge
=
{
id
:
id
,
id
:
id
,
sourceID
:
Edges
[
id
].
sourceID
,
sourceID
:
Edges
[
id
].
sourceID
,
targetID
:
Edges
[
id
].
targetID
,
targetID
:
Edges
[
id
].
targetID
,
lock
:
false
,
lock
:
false
,
iscluster
:
(
!
Nodes
[
Edges
[
id
].
sourceID
].
iscluster
&&
!
Nodes
[
Edges
[
id
].
targetID
].
iscluster
)?
false
:
true
,
label
:
Edges
[
id
].
label
,
label
:
Edges
[
id
].
label
,
weight
:
(
swMacro
&&
(
iwantograph
==
"sociosemantic"
))?
Edges
[
id
].
bweight
:
Edges
[
id
].
weight
weight
:
(
swMacro
&&
(
iwantograph
==
"sociosemantic"
))?
Edges
[
id
].
bweight
:
Edges
[
id
].
weight
};
};
partialGraph
.
addEdge
(
id
,
anedge
.
sourceID
,
anedge
.
targetID
,
anedge
);
partialGraph
.
addEdge
(
id
,
anedge
.
sourceID
,
anedge
.
targetID
,
anedge
);
return
;
return
;
}
//
}
}
}
}
}
}
}
...
...
tinawebJS/sigma.min.js
View file @
ecb87d35
...
@@ -620,30 +620,13 @@ sigma.classes.Cascade = function() {
...
@@ -620,30 +620,13 @@ sigma.classes.Cascade = function() {
clearSchedule
();
clearSchedule
();
// Rescale graph:
// Rescale graph:
self
.
graph
.
rescale
(
self
.
graph
.
rescale
(
self
.
width
,
self
.
height
,
n
>
0
,
e
>
0
).
setBorders
();
self
.
width
,
self
.
height
,
n
>
0
,
e
>
0
).
setBorders
();
self
.
mousecaptor
.
checkBorders
(
self
.
graph
.
borders
,
self
.
width
,
self
.
height
);
self
.
graph
.
translate
(
self
.
mousecaptor
.
checkBorders
(
self
.
graph
.
borders
,
self
.
width
,
self
.
height
);
self
.
mousecaptor
.
stageX
,
self
.
mousecaptor
.
stageY
,
self
.
mousecaptor
.
ratio
,
n
>
0
,
e
>
0
);
self
.
dispatch
(
self
.
graph
.
translate
(
self
.
mousecaptor
.
stageX
,
self
.
mousecaptor
.
stageY
,
self
.
mousecaptor
.
ratio
,
n
>
0
,
e
>
0
);
'graphscaled'
);
self
.
dispatch
(
'graphscaled'
);
// Clear scene:
// Clear scene:
for
(
var
k
in
self
.
domElements
)
{
for
(
var
k
in
self
.
domElements
)
{
...
@@ -670,13 +653,8 @@ sigma.classes.Cascade = function() {
...
@@ -670,13 +653,8 @@ sigma.classes.Cascade = function() {
if
(
n
)
{
if
(
n
)
{
if
(
n
>
1
)
{
if
(
n
>
1
)
{
while
(
self
.
plotter
.
task_drawNode
())
{}
while
(
self
.
plotter
.
task_drawNode
())
{}
}
else
{
}
else
{
sigma
.
chronos
.
addTask
(
sigma
.
chronos
.
addTask
(
self
.
plotter
.
task_drawNode
,
'node_'
+
self
.
id
,
false
);
self
.
plotter
.
task_drawNode
,
'node_'
+
self
.
id
,
false
);
start
=
true
;
start
=
true
;
previous
=
'node_'
+
self
.
id
;
previous
=
'node_'
+
self
.
id
;
}
}
...
@@ -687,19 +665,10 @@ sigma.classes.Cascade = function() {
...
@@ -687,19 +665,10 @@ sigma.classes.Cascade = function() {
while
(
self
.
plotter
.
task_drawLabel
())
{}
while
(
self
.
plotter
.
task_drawLabel
())
{}
}
else
{
}
else
{
if
(
previous
)
{
if
(
previous
)
{
sigma
.
chronos
.
queueTask
(
sigma
.
chronos
.
queueTask
(
self
.
plotter
.
task_drawLabel
,
'label_'
+
self
.
id
,
previous
);
self
.
plotter
.
task_drawLabel
,
'label_'
+
self
.
id
,
previous
);
}
else
{
}
else
{
sigma
.
chronos
.
addTask
(
sigma
.
chronos
.
addTask
(
self
.
plotter
.
task_drawLabel
,
'label_'
+
self
.
id
,
false
);
self
.
plotter
.
task_drawLabel
,
'label_'
+
self
.
id
,
false
);
}
}
start
=
true
;
start
=
true
;
previous
=
'label_'
+
self
.
id
;
previous
=
'label_'
+
self
.
id
;
}
}
...
@@ -710,17 +679,9 @@ sigma.classes.Cascade = function() {
...
@@ -710,17 +679,9 @@ sigma.classes.Cascade = function() {
while
(
self
.
plotter
.
task_drawEdge
())
{}
while
(
self
.
plotter
.
task_drawEdge
())
{}
}
else
{
}
else
{
if
(
previous
)
{
if
(
previous
)
{
sigma
.
chronos
.
queueTask
(
sigma
.
chronos
.
queueTask
(
self
.
plotter
.
task_drawEdge
,
'edge_'
+
self
.
id
,
previous
);
self
.
plotter
.
task_drawEdge
,
'edge_'
+
self
.
id
,
previous
);
}
else
{
}
else
{
sigma
.
chronos
.
addTask
(
sigma
.
chronos
.
addTask
(
self
.
plotter
.
task_drawEdge
,
'edge_'
+
self
.
id
,
false
);
self
.
plotter
.
task_drawEdge
,
'edge_'
+
self
.
id
,
false
);
}
}
start
=
true
;
start
=
true
;
...
@@ -728,9 +689,7 @@ sigma.classes.Cascade = function() {
...
@@ -728,9 +689,7 @@ sigma.classes.Cascade = function() {
}
}
}
}
self
.
dispatch
(
self
.
dispatch
(
'draw'
);
'draw'
);
self
.
refresh
();
self
.
refresh
();
...
@@ -873,6 +832,7 @@ sigma.classes.Cascade = function() {
...
@@ -873,6 +832,7 @@ sigma.classes.Cascade = function() {
'x'
:
0
,
'x'
:
0
,
'y'
:
0
,
'y'
:
0
,
'size'
:
1
,
'size'
:
1
,
'iscluster'
:
false
,
'degree'
:
0
,
'degree'
:
0
,
'inDegree'
:
0
,
'inDegree'
:
0
,
'outDegree'
:
0
,
'outDegree'
:
0
,
...
@@ -911,6 +871,9 @@ sigma.classes.Cascade = function() {
...
@@ -911,6 +871,9 @@ sigma.classes.Cascade = function() {
case
'label'
:
case
'label'
:
n
[
k
]
=
params
[
k
];
n
[
k
]
=
params
[
k
];
break
;
break
;
case
'iscluster'
:
n
[
k
]
=
params
[
k
];
break
;
default
:
default
:
n
[
'attr'
][
k
]
=
params
[
k
];
n
[
'attr'
][
k
]
=
params
[
k
];
}
}
...
@@ -945,6 +908,7 @@ sigma.classes.Cascade = function() {
...
@@ -945,6 +908,7 @@ sigma.classes.Cascade = function() {
'shape'
:
node
[
'shape'
],
'shape'
:
node
[
'shape'
],
'fixed'
:
node
[
'fixed'
],
'fixed'
:
node
[
'fixed'
],
'active'
:
node
[
'active'
],
'active'
:
node
[
'active'
],
'iscluster'
:
node
[
'iscluster'
],
'hidden'
:
node
[
'hidden'
],
'hidden'
:
node
[
'hidden'
],
'forceLabel'
:
node
[
'forceLabel'
],
'forceLabel'
:
node
[
'forceLabel'
],
'attr'
:
node
[
'attr'
]
'attr'
:
node
[
'attr'
]
...
@@ -979,6 +943,7 @@ sigma.classes.Cascade = function() {
...
@@ -979,6 +943,7 @@ sigma.classes.Cascade = function() {
break
;
break
;
case
'fixed'
:
case
'fixed'
:
case
'active'
:
case
'active'
:
case
'iscluster'
:
case
'hidden'
:
case
'hidden'
:
case
'forceLabel'
:
case
'forceLabel'
:
node
[
k
]
=
!!
copy
[
k
];
node
[
k
]
=
!!
copy
[
k
];
...
@@ -1121,6 +1086,7 @@ sigma.classes.Cascade = function() {
...
@@ -1121,6 +1086,7 @@ sigma.classes.Cascade = function() {
'label'
:
id
.
toString
(),
'label'
:
id
.
toString
(),
'id'
:
id
.
toString
(),
'id'
:
id
.
toString
(),
'hidden'
:
false
,
'hidden'
:
false
,
'iscluster'
:
false
,
'attr'
:
{}
'attr'
:
{}
};
};
e
[
'source'
][
'degree'
]
++
;
e
[
'source'
][
'degree'
]
++
;
...
@@ -1137,6 +1103,9 @@ sigma.classes.Cascade = function() {
...
@@ -1137,6 +1103,9 @@ sigma.classes.Cascade = function() {
case
'hidden'
:
case
'hidden'
:
e
[
k
]
=
!!
params
[
k
];
e
[
k
]
=
!!
params
[
k
];
break
;
break
;
case
'iscluster'
:
e
[
k
]
=
!!
params
[
k
];
break
;
case
'size'
:
case
'size'
:
case
'weight'
:
case
'weight'
:
e
[
k
]
=
+
params
[
k
];
e
[
k
]
=
+
params
[
k
];
...
@@ -1185,6 +1154,7 @@ sigma.classes.Cascade = function() {
...
@@ -1185,6 +1154,7 @@ sigma.classes.Cascade = function() {
'target'
:
edge
[
'target'
][
'id'
],
'target'
:
edge
[
'target'
][
'id'
],
'size'
:
edge
[
'size'
],
'size'
:
edge
[
'size'
],
'type'
:
edge
[
'type'
],
'type'
:
edge
[
'type'
],
'iscluster'
:
edge
[
'iscluster'
],
'weight'
:
edge
[
'weight'
],
'weight'
:
edge
[
'weight'
],
'displaySize'
:
edge
[
'displaySize'
],
'displaySize'
:
edge
[
'displaySize'
],
'label'
:
edge
[
'label'
],
'label'
:
edge
[
'label'
],
...
@@ -2211,15 +2181,14 @@ sigma.classes.Cascade = function() {
...
@@ -2211,15 +2181,14 @@ sigma.classes.Cascade = function() {
* @return {Plotter} Returns itself.
* @return {Plotter} Returns itself.
*/
*/
function
drawNode
(
node
)
{
function
drawNode
(
node
)
{
if
(
node
.
iscluster
)
return
self
;
size
=
Math
.
round
(
node
[
'displaySize'
]
*
10
)
/
10
;
size
=
Math
.
round
(
node
[
'displaySize'
]
*
10
)
/
10
;
shape
=
node
[
'shape'
];
shape
=
node
[
'shape'
];
if
(
!
shape
)
{
shape
=
self
.
p
.
defaultNodeShape
;
}
ctx
=
nodesCtx
;
ctx
.
fillStyle
=
node
[
'color'
]
;
if
(
!
shape
)
shape
=
self
.
p
.
defaultNodeShape
;
ctx
=
nodesCtx
;
ctx
.
fillStyle
=
node
[
'color'
];
// Node border:
// Node border:
ctx
.
beginPath
();
ctx
.
beginPath
();
...
@@ -2231,12 +2200,8 @@ sigma.classes.Cascade = function() {
...
@@ -2231,12 +2200,8 @@ sigma.classes.Cascade = function() {
node
[
'displayY'
]
-
wh
/
2
,
node
[
'displayY'
]
-
wh
/
2
,
wh
,
wh
,
wh
);
wh
);
// ctx.strokeRect(node['displayX']-size-(1.3),
// node['displayY']-size-(1.3),
// (node['displaySize'] * 2) + self.p.borderSize,
// (node['displaySize'] * 2) + self.p.borderSize);
break
;
break
;
default
:
default
:
ctx
.
fillStyle
=
self
.
p
.
nodeBorderColor
==
'node'
?
ctx
.
fillStyle
=
self
.
p
.
nodeBorderColor
==
'node'
?
(
node
[
'color'
]
||
self
.
p
.
defaultNodeColor
)
:
(
node
[
'color'
]
||
self
.
p
.
defaultNodeColor
)
:
...
@@ -2304,6 +2269,7 @@ sigma.classes.Cascade = function() {
...
@@ -2304,6 +2269,7 @@ sigma.classes.Cascade = function() {
* @return {Plotter} Returns itself.
* @return {Plotter} Returns itself.
*/
*/
function
drawEdge
(
edge
)
{
function
drawEdge
(
edge
)
{
if
(
edge
.
iscluster
)
return
self
;
var
x1
=
edge
[
'source'
][
'displayX'
];
var
x1
=
edge
[
'source'
][
'displayX'
];
var
y1
=
edge
[
'source'
][
'displayY'
];
var
y1
=
edge
[
'source'
][
'displayY'
];
var
x2
=
edge
[
'target'
][
'displayX'
];
var
x2
=
edge
[
'target'
][
'displayX'
];
...
@@ -2389,6 +2355,7 @@ sigma.classes.Cascade = function() {
...
@@ -2389,6 +2355,7 @@ sigma.classes.Cascade = function() {
* @return {Plotter} Returns itself.
* @return {Plotter} Returns itself.
*/
*/
function
drawLabel
(
node
)
{
function
drawLabel
(
node
)
{
if
(
node
.
iscluster
)
return
self
;
var
ctx
=
labelsCtx
;
var
ctx
=
labelsCtx
;
var
thethreshold
=
self
.
p
.
labelThreshold
;
var
thethreshold
=
self
.
p
.
labelThreshold
;
...
@@ -2424,6 +2391,7 @@ sigma.classes.Cascade = function() {
...
@@ -2424,6 +2391,7 @@ sigma.classes.Cascade = function() {
* @return {Plotter} Returns itself.
* @return {Plotter} Returns itself.
*/
*/
function
drawHoverNode
(
node
)
{
function
drawHoverNode
(
node
)
{
if
(
node
.
iscluster
)
return
self
;
size
=
Math
.
round
(
node
[
'displaySize'
]
*
10
)
/
10
;
size
=
Math
.
round
(
node
[
'displaySize'
]
*
10
)
/
10
;
ctx
=
hoverCtx
;
ctx
=
hoverCtx
;
...
@@ -2547,6 +2515,7 @@ sigma.classes.Cascade = function() {
...
@@ -2547,6 +2515,7 @@ sigma.classes.Cascade = function() {
* @return {Plotter} Returns itself.
* @return {Plotter} Returns itself.
*/
*/
function
drawActiveNode
(
node
)
{
function
drawActiveNode
(
node
)
{
if
(
node
.
iscluster
)
return
self
;
size
=
Math
.
round
(
node
[
'displaySize'
]
*
10
)
/
10
;
size
=
Math
.
round
(
node
[
'displaySize'
]
*
10
)
/
10
;
ctx
=
hoverCtx
;
ctx
=
hoverCtx
;
...
@@ -2683,7 +2652,7 @@ sigma.classes.Cascade = function() {
...
@@ -2683,7 +2652,7 @@ sigma.classes.Cascade = function() {
);
);
}
}
return
!
node
[
'hidden'
]
&&
return
!
node
[
'hidden'
]
&&
!
node
[
"iscluster"
]
&&
(
node
[
'displayX'
]
+
node
[
'displaySize'
]
>
-
width
/
3
)
&&
(
node
[
'displayX'
]
+
node
[
'displaySize'
]
>
-
width
/
3
)
&&
(
node
[
'displayX'
]
-
node
[
'displaySize'
]
<
width
*
4
/
3
)
&&
(
node
[
'displayX'
]
-
node
[
'displaySize'
]
<
width
*
4
/
3
)
&&
(
node
[
'displayY'
]
+
node
[
'displaySize'
]
>
-
height
/
3
)
&&
(
node
[
'displayY'
]
+
node
[
'displaySize'
]
>
-
height
/
3
)
&&
...
...
tinawebJS/sigma.parseCustom.js
View file @
ecb87d35
...
@@ -669,8 +669,8 @@ function parseSimpleJSON( data , seed ) {
...
@@ -669,8 +669,8 @@ function parseSimpleJSON( data , seed ) {
label
=
(
isUndef
(
nodesNodes
[
i
].
label
))
?
(
"node_"
+
i
):
nodesNodes
[
i
].
label
;
label
=
(
isUndef
(
nodesNodes
[
i
].
label
))
?
(
"node_"
+
i
):
nodesNodes
[
i
].
label
;
size
=
(
isUndef
(
nodesNodes
[
i
].
size
))?
1
:
nodesNodes
[
i
].
size
;
size
=
(
isUndef
(
nodesNodes
[
i
].
size
))?
1
:
nodesNodes
[
i
].
size
;
group
=
(
isUndef
(
nodesNodes
[
i
].
group
))?
1
:
nodesNodes
[
i
].
group
;
group
=
(
isUndef
(
nodesNodes
[
i
].
group
))?
1
:
nodesNodes
[
i
].
group
;
is
hidden
=
(
isUndef
(
nodesNodes
[
i
].
hidden
))?
false
:
nodesNodes
[
i
].
hidden
;
is
cluster
=
(
isUndef
(
nodesNodes
[
i
].
hidden
))?
false
:
nodesNodes
[
i
].
hidden
;
if
(
is
hidden
==
1
)
ishidden
=
true
;
if
(
is
cluster
==
1
)
iscluster
=
true
;
var
node
=
({
var
node
=
({
id
:
i
,
id
:
i
,
...
@@ -682,7 +682,7 @@ function parseSimpleJSON( data , seed ) {
...
@@ -682,7 +682,7 @@ function parseSimpleJSON( data , seed ) {
htmlCont
:
""
,
htmlCont
:
""
,
group
:
group
,
group
:
group
,
color
:
color
,
color
:
color
,
hidden
:
false
iscluster
:
iscluster
});
// The graph node
});
// The graph node
Nodes
[
i
]
=
node
;
Nodes
[
i
]
=
node
;
...
@@ -698,7 +698,7 @@ function parseSimpleJSON( data , seed ) {
...
@@ -698,7 +698,7 @@ function parseSimpleJSON( data , seed ) {
partialGraph
.
addNode
(
i
,
Nodes
[
i
]);
partialGraph
.
addNode
(
i
,
Nodes
[
i
]);
if
(
!
Nodes
[
i
].
hidden
)
if
(
!
Nodes
[
i
].
iscluster
)
updateSearchLabels
(
i
,
Nodes
[
i
].
label
,
Nodes
[
i
].
type
);
updateSearchLabels
(
i
,
Nodes
[
i
].
label
,
Nodes
[
i
].
type
);
}
}
...
@@ -716,6 +716,7 @@ function parseSimpleJSON( data , seed ) {
...
@@ -716,6 +716,7 @@ function parseSimpleJSON( data , seed ) {
targetID
:
target
,
targetID
:
target
,
lock
:
false
,
lock
:
false
,
label
:
""
,
label
:
""
,
iscluster
:(
!
Nodes
[
source
].
iscluster
&&
!
Nodes
[
target
].
iscluster
)?
false
:
true
,
weight
:
(
edgesNodes
[
i
].
w
)?
edgesNodes
[
i
].
w
:
1
weight
:
(
edgesNodes
[
i
].
w
)?
edgesNodes
[
i
].
w
:
1
};
};
...
...
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