Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-graph
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
Julien Moutinho
gargantext-graph
Commits
505cb059
Commit
505cb059
authored
Sep 06, 2021
by
Alp Mestanogullari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ability to run GC phase or not, and pick beta, through CLI
parent
9b340ca4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
10 deletions
+23
-10
Main.hs
app/Main.hs
+9
-6
ProxemyOptim.hs
src/Graph/BAC/ProxemyOptim.hs
+14
-4
No files found.
app/Main.hs
View file @
505cb059
...
...
@@ -46,12 +46,16 @@ setupEnv (Right n) = getUnlabGraph (Random n)
main
::
IO
()
main
=
do
[
fpin
,
fpout
]
<-
getArgs
>>=
\
xs
->
if
length
xs
/=
2
then
Prelude
.
error
"Usage: gargantext-graph-exe input_graph.csv output_file.txt"
[
fpin
,
fpout
,
gcstr
,
betastr
]
<-
getArgs
>>=
\
xs
->
if
length
xs
/=
4
then
Prelude
.
error
"Usage: gargantext-graph-exe input_graph.csv output_file.txt
<'gc' or 'nogc'> <beta>
"
else
return
xs
let
gc
=
if
gcstr
==
"gc"
then
True
else
False
beta
=
case
readMaybe
betastr
of
Just
d
->
d
_
->
Prelude
.
error
"beta must be a Double"
setupEnv
(
Left
fpin
)
>>=
\
(
dico
,
~
g
)
->
do
let
(
clusts
,
score
)
=
withG
g
(
\
fg
->
clusteringOptim
3
Conf
fg
beta
)
let
(
clusts
,
score
)
=
withG
g
(
\
fg
->
clusteringOptim
3
Conf
fg
beta
gc
)
clusts'
=
Prelude
.
map
(
sort
.
Prelude
.
map
(
lkp
dico
)
.
IntSet
.
toList
)
$
sortBy
(
\
a
b
->
flipOrd
$
comparing
IntSet
.
size
a
b
)
$
Prelude
.
map
(
\
(
n
,
ns
)
->
IntSet
.
insert
n
ns
)
...
...
@@ -65,8 +69,7 @@ main = do
"len="
++
show
(
length
clust
)
++
" ["
++
intercalate
", "
[
"'"
++
Text
.
unpack
w
++
"'"
|
[
w
]
<-
clust
]
++
"]
\n
"
where
beta
=
0.0
flipOrd
LT
=
GT
where
flipOrd
LT
=
GT
flipOrd
GT
=
LT
flipOrd
EQ
=
EQ
lkp
dico
i
=
fromMaybe
(
Prelude
.
error
"Node not in dictionary?!"
)
$
...
...
src/Graph/BAC/ProxemyOptim.hs
View file @
505cb059
...
...
@@ -73,8 +73,9 @@ clusteringOptim :: forall n a b. KnownNat n
->
Similarity
->
FiniteGraph
n
a
b
->
Double
-- beta
->
Bool
-- True = run GC, False = don't
->
(
Dict
IntSet
,
Double
)
clusteringOptim
l
s
fg
@
(
FiniteGraph
g
)
beta
=
runClustering
beta
adj'
prox
sorted_edges
clusteringOptim
l
s
fg
@
(
FiniteGraph
g
)
beta
gc
=
runClustering
gc
beta
adj'
prox
sorted_edges
where
!
adj'
=
symAdjacent
fg
True
!
tra'
=
symTransition
adj'
...
...
@@ -474,15 +475,24 @@ data Clust = Clust
runClustering
::
forall
(
n
::
Nat
)
.
KnownNat
n
=>
Double
-- ^ beta
=>
Bool
-- ^ do we run the 'garbage collector'?
->
Double
-- ^ beta
->
SMatrix
.
Matrix
n
n
Double
-- ^ adjacency
->
SMatrix
.
Matrix
n
n
Double
-- ^ proxemie
->
SortedEdges
->
(
Dict
IntSet
,
Double
)
runClustering
beta
adj
prox
se
=
trace
"clustering starts"
$
runST
$
do
runClustering
gc
beta
adj
prox
se
=
trace
"clustering starts"
$
runST
$
do
mclust
<-
newMClustering
n
forM_
se
$
\
(
x
,
y
,
_
)
->
clusteringStep
beta
adj
prox
mclust
(
x
,
y
)
trace
"basic clusters done, running collector now"
$
clusteringCollector
beta
adj
prox
mclust
if
gc
then
trace
"basic clusters done, running collector now"
$
clusteringCollector
beta
adj
prox
mclust
else
do
cps
<-
V
.
unsafeFreeze
(
mparts
mclust
)
let
cps'
=
Dict
.
fromList
[
(
n
,
xs
)
|
(
n
,
Just
(
PartData
xs
_
))
<-
zip
[
0
..
]
(
V
.
toList
cps
)
]
sc
<-
MVU
.
unsafeRead
(
mscore
mclust
)
0
return
(
cps'
,
sc
)
where
n
=
fromIntegral
$
natVal
(
Proxy
::
Proxy
n
)
sestr
=
intercalate
"
\n
"
...
...
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