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
bf555062
Commit
bf555062
authored
Jul 05, 2021
by
Pascal Engélibert
🚴
Browse files
Update fa2rs
parent
6e1de3a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
script/wot_json.py
View file @
bf555062
...
...
@@ -107,6 +107,7 @@ Options:
-C <int> Number of communities
--ns Disable strict mode (ignore incoherent data)
--fa2rs Use fa2rs implementation
--it <int> Number of iterations for layout
--csv <file> Export WoT graph to CSV (for Gephi)
-v Verbose
...
...
@@ -120,6 +121,7 @@ Default options:
-m 604800 (7 days)
-M img/logo-g1.png
-C 30
--it 50 (3000 with --fa2rs)
--csv ~/wotmap/data/wot.csv"""
)
exit
()
...
...
@@ -360,13 +362,15 @@ Default options:
if
gencoords
:
log
(
"Updating coords..."
)
if
"--fa2rs"
in
sys
.
argv
:
niters
=
int
(
getargv
(
"--it"
,
3000
))
import
fa2rs
layout
=
fa2rs
.
Layout
.
from_graph
(
graph
.
edges
,
len
(
graph
.
nodes
),
fa2rs
.
Settings
(
kr
=
0.002
,
kg
=
0.00
1
,
ka
=
0.0
1
,
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
=
fa2rs
.
Layout
.
from_graph
(
graph
.
edges
,
fa2rs
.
Settings
(
kr
=
1
,
kg
=
1
,
ka
=
1
,
dissuade_hubs
=
False
,
barnes_hut
=
None
,
strong_gravity
=
False
,
prevent_overlapping
=
False
,
speed
=
0.01
),
nb_nodes
=
len
(
graph
.
nodes
))
for
i
in
range
(
niters
):
print
(
"{} /
{}
"
.
format
(
i
,
niters
),
end
=
"
\r
"
)
layout
.
iteration
()
#print(layout.get_point(0))
#print(min(layout.points, key=lambda x:min(x)), max(layout.points, key=lambda x:max(x)), max(layout.points, key=lambda x:math.sqrt(x[0]**2+x[1]**2)))
# TODO ça plante à layout.points
i
=
0
for
point
in
layout
.
points
:
outdata_wot
[
"nodes"
][
i
][
"x"
]
=
point
[
0
]
...
...
@@ -379,7 +383,7 @@ Default options:
layout = forceatlas2.forceatlas2_networkx_layout(graph, niter=10)
"""
layout
=
networkx
.
layout
.
fruchterman_reingold_layout
(
graph
)
layout
=
networkx
.
layout
.
fruchterman_reingold_layout
(
graph
,
iterations
=
int
(
getargv
(
"--it"
,
50
))
)
i
=
0
for
dot
in
layout
:
outdata_wot
[
"nodes"
][
i
][
"x"
]
=
layout
[
dot
][
0
]
...
...
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