Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pierre-Jean CHANCELLIER
Wotmap
Commits
8d0f1b0e
Commit
8d0f1b0e
authored
Apr 08, 2021
by
Chancellier Pierre-Jean
Browse files
v.0.4.0 - fa2rs implementation
parent
6e1de3a4
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
8d0f1b0e
...
...
@@ -35,7 +35,22 @@ Exploration de la Toile de Confiance de Duniter utilisant la librairie javascrip
### I. Installer Python et les paquets nécessaires
sudo apt-get update && sudo apt-get install python3 python3-pip
sudo pip3 install plyvel networkx numpy
sudo pip3 install plyvel networkx numpy fa2rs
Si, au lancement du script wot_json.py, vous obtenez une erreur liée à GLIBC c'est que vous devez compiler le paquet pour votre machine et cela nécessire Rust.
# On installe Rust
sudo curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
sudo rustup install nightly
sudo rustup default nightly
# On récupère les sources
mkdir sources_fa2rs && cd sources_fa2rs
git clone https://framagit.org/ZettaScript/forceatlas2-rs forceatlas2
git clone https://framagit.org/ZettaScript/fa2rs-py
cd fa2rs-py
sh build_wheel.sh
sudo pip3 install --user --force-reinstall target/wheel/dist/fa2rs-0.1.0-py3-none-any.whl
### II. Récupérer les sources du projet
Rendez-vous dans le dossier HOME de votre utilisateur duniter (par ex : /var/lib/duniter/) et récupérez les sources :
...
...
@@ -49,8 +64,8 @@ Rendez-vous dans le dossier HOME de votre utilisateur duniter (par ex : /var/lib
*
Créez le fichier
***/etc/cron.d/wotmap**
*
sur votre serveur pour automatiser le lancement du script :
30 3 * * 0-5 duniter python3 /var/lib/duniter/wotmap/script/wot_json.py --ns >> /var/log/wotmap/wotmap.log 2>&1
30 3 * * 6 duniter python3 /var/lib/duniter/wotmap/script/wot_json.py -d --ns >> /var/log/wotmap/wotmap.log 2>&1
30 3 * * 0-5 duniter python3 /var/lib/duniter/wotmap/script/wot_json.py --ns
--fa2rs
>> /var/log/wotmap/wotmap.log 2>&1
30 3 * * 6 duniter python3 /var/lib/duniter/wotmap/script/wot_json.py -d --ns
--fa2rs
>> /var/log/wotmap/wotmap.log 2>&1
### IV. Paramétrage d'Apache
...
...
data/stats.json
View file @
8d0f1b0e
{
"instance"
:
{
"custom"
:
{
"block"
:
370119
,
"currency"
:
"g1"
},
"version"
:
"0.3.4"
,
"software"
:
"wotmap"
,
"working"
:
true
,
"maintainers"
:
[]},
"stats"
:
{
"total_edges"
:
24612
,
"total_nodes"
:
2824
,
"total_communities"
:
30
,
"crit_referent"
:
5
,
"total_members"
:
2824
,
"median_time"
:
1604365971
,
"centrality_extrema"
:
{
"c_information"
:
[
0.0002875808249263121
,
0.0022201090432376162
],
"c_degree"
:
[
0.00035423308537017357
,
0.03506907545164718
],
"c_load"
:
[
0.0
,
0.059693668770354855
],
"c_betweenness"
:
[
0.0
,
0.06409975639544824
],
"c_closeness"
:
[
0.19909725650610058
,
0.3809202536769667
],
"c_harmonic"
:
[
583.0142857142847
,
1164.3333333333385
],
"c_eigenvector"
:
[
0.00026499413746909915
,
0.1665531170499599
]},
"total_referents"
:
1698
,
"total_noreferents"
:
1126
}}
\ No newline at end of file
{
"stats"
:
{
"median_time"
:
1617667618
,
"total_edges"
:
26070
,
"total_nodes"
:
3003
,
"total_members"
:
3003
,
"total_communities"
:
30
,
"crit_referent"
:
5
,
"total_referents"
:
1835
,
"total_noreferents"
:
1168
,
"centrality_extrema"
:
{}},
"instance"
:
{
"software"
:
"wotmap"
,
"version"
:
"0.4.0"
,
"working"
:
true
,
"maintainers"
:
[],
"custom"
:
{
"currency"
:
"g1"
,
"block"
:
412938
}}}
\ No newline at end of file
data/wot.json
View file @
8d0f1b0e
This diff is collapsed.
Click to expand it.
index.html
View file @
8d0f1b0e
...
...
@@ -18,7 +18,7 @@
<link
rel=
"stylesheet"
href=
"css/main.min.css"
>
</head>
<body
id=
"body"
>
<!--
<div id="loader" class="w3-modal" style="display: block;">
<div
id=
"loader"
class=
"w3-modal"
style=
"display: block;"
>
<div
class=
"w3-modal-content w3-round-large w3-card-4 w3-animate-zoom w3-black"
>
<div
class=
"w3-container"
>
<img
src=
"img/G1.gif"
>
...
...
@@ -28,7 +28,7 @@
</div>
</div>
</div>
</div>
-->
</div>
<div
id=
"myProgress"
>
<div
class=
"w3-text-white"
>
Chargement des avatars
</div>
<div
class=
"w3-light-grey w3-round"
>
...
...
js/custom/main.min.js
View file @
8d0f1b0e
This diff is collapsed.
Click to expand it.
js/custom/main/graph.js
View file @
8d0f1b0e
...
...
@@ -18,6 +18,8 @@ function displayGraph(s){
cam
=
s
.
camera
,
cesium
=
'
https://demo.cesium.app
'
+
'
/#/app/wot/
'
;
_
.
$
(
'
loader
'
).
style
.
display
=
"
none
"
;
// Browse all the nodes to retrieve the maxDegree and to sort the labels for autocompletion search
s
.
graph
.
nodes
().
forEach
(
function
(
node
,
i
,
a
)
{
var
tabnode
=
[
node
.
label
,
node
.
url
];
...
...
@@ -38,7 +40,7 @@ function displayGraph(s){
easing
:
'
cubicInOut
'
,
scalingRatio
:
.
1
});
// Bind the events for displaying the loader during the calculation of nodes position
fa
.
bind
(
'
start
'
,
function
(
e
)
{
_
.
$
(
'
loader
'
).
style
.
display
=
'
block
'
;
...
...
script/wot_json.py
View file @
8d0f1b0e
...
...
@@ -10,7 +10,7 @@ $ sudo pip3 install plyvel networkx numpy
import
sys
,
os
,
time
,
math
,
json
,
urllib
.
request
,
plyvel
,
subprocess
,
networkx
,
random
VERSION
=
"0.
3.4
"
VERSION
=
"0.
4.0
"
STEPMAX
=
5
def
getargv
(
arg
,
default
=
""
):
...
...
@@ -361,7 +361,7 @@ Default options:
log
(
"Updating coords..."
)
if
"--fa2rs"
in
sys
.
argv
:
import
fa2rs
layout
=
fa2rs
.
Layout
.
from_graph
(
graph
.
edges
,
len
(
graph
.
nodes
),
fa2rs
.
Settings
(
kr
=
0.
0
02
,
kg
=
0
.001
,
ka
=
0.01
,
dissuade_hubs
=
False
,
barnes_hut
=
None
,
strong_gravity
=
False
,
prevent_overlapping
=
False
,
jitter_tolerance
=
0.1
))
layout
=
fa2rs
.
Layout
.
from_graph
(
graph
.
edges
,
len
(
graph
.
nodes
),
fa2rs
.
Settings
(
kr
=
0.02
,
kg
=
0
,
ka
=
0.01
,
dissuade_hubs
=
False
,
barnes_hut
=
None
,
strong_gravity
=
False
,
prevent_overlapping
=
False
,
jitter_tolerance
=
0.1
))
for
i
in
range
(
1000
):
print
(
"{} / 1000"
.
format
(
i
),
end
=
"
\r
"
)
layout
.
iteration
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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