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
2
Issues
2
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
gargantext
gargantext-graph
Commits
d13b3802
Commit
d13b3802
authored
Jul 08, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TESTS] ready for optim
parent
13f59d55
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
81 additions
and
34 deletions
+81
-34
Main.hs
app/Main.hs
+21
-10
Main2.hs
app/Main2.hs
+18
-0
gargantext-graph.cabal
gargantext-graph.cabal
+2
-1
install
install
+2
-2
package.yaml
package.yaml
+2
-0
run
run
+2
-1
ProxemyOptim.hs
src/Graph/BAC/ProxemyOptim.hs
+9
-9
Spec.hs
test/Spec.hs
+25
-11
No files found.
app/Main.hs
View file @
d13b3802
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE NoImplicitPrelude
#-}
module
Main
where
import
Graph.Tools
import
Graph.BAC.Clustering
import
System.Environment
(
getArgs
)
import
Data.Set
as
Set
import
Data.String.Conversions
(
cs
)
import
Data.Text
(
Text
)
import
Graph.BAC.ProxemyOptim
import
Graph.BAC.ProxemyOptim
import
Graph.FGL
import
Prelude
(
String
)
import
Protolude
import
qualified
Data.IntMap
as
Dict
import
qualified
Data.List
as
List
import
qualified
Eigen.Matrix
as
Matrix
import
qualified
Eigen.SparseMatrix
as
SMatrix
import
qualified
Prelude
as
Prelude
main
::
IO
()
main
=
do
[
fp
]
<-
getArgs
graph
<-
readFileGraph
TestGraph
fp
print
(
clusterGraph
3
graph
)
m
<-
randomAdjacency
let
g
::
Graph
()
()
g
=
mkGraphUfromEdges
$
List
.
map
(
\
(
x
,
y
,
_
)
->
(
x
,
y
))
$
SMatrix
.
toList
m
result
=
withG
g
(
identity
.
(
clusteringOptim
3
Conf
))
print
(
result
)
app/Main2.hs
0 → 100644
View file @
d13b3802
{-# LANGUAGE NoImplicitPrelude #-}
module
Main2
where
import
Graph.Tools
import
Graph.BAC.Clustering
import
System.Environment
(
getArgs
)
import
Protolude
main
::
IO
()
main
=
do
[
fp
]
<-
getArgs
graph
<-
readFileGraph
TestGraph
fp
print
(
clusterGraph
3
graph
)
gargantext-graph.cabal
View file @
d13b3802
...
...
@@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash:
0738cfbe36f67275fe7fcd289fd26bddd3727957358ad06543242f719c4f34f1
-- hash:
4cecc6b992a2dda8a33d66136d8ffcda1eb4fcfed9fb2a21df529821278d524d
name: gargantext-graph
version: 0.1.0.0
...
...
@@ -68,6 +68,7 @@ library
executable gargantext-graph-exe
main-is: Main.hs
other-modules:
Main2
Paths_gargantext_graph
hs-source-dirs:
app
...
...
install
View file @
d13b3802
#!/bin/bash
#
stack
install
--profile
# --test
stack
install
--profile
# --test
# --haddock
package.yaml
View file @
d13b3802
...
...
@@ -58,6 +58,8 @@ executables:
-
-rtsopts
-
-with-rtsopts=-N
-
-fprof-auto
# - -Wmissing-signatures
# - -Wcompat
dependencies
:
-
gargantext-graph
...
...
run
View file @
d13b3802
#!/bin/bash
~/.local/bin/gargantext-graph-exe
$1
+RTS
-p
# -sstderr
#~/.local/bin/gargantext-graph-exe $1 +RTS -p # -sstderr
time
~/.local/bin/gargantext-graph-exe +RTS
-p
# -sstderr
src/Graph/BAC/ProxemyOptim.hs
View file @
d13b3802
...
...
@@ -97,13 +97,13 @@ data ClusteringMode = Part | Over | Both
type
StrictClustering
a
=
Clustering
a
type
OverlapsClustering
a
=
Clustering
a
data
Clustering
a
=
ClusteringIs
{
parts
::
Dict
(
Set
a
)
,
index
::
Dict
Int
,
score
::
Double
,
mode
::
ClusteringMode
data
Clustering
a
=
ClusteringIs
{
parts
::
!
(
Dict
(
Set
a
)
)
,
index
::
!
(
Dict
Int
)
,
score
::
!
(
Double
)
,
mode
::
!
ClusteringMode
}
|
Clusterings
{
strict
::
StrictClustering
a
,
over
::
OverlapsClustering
a
|
Clusterings
{
strict
::
!
(
StrictClustering
a
)
,
over
::
!
(
OverlapsClustering
a
)
}
deriving
(
Show
,
Eq
)
---------------------------------------------------------------
...
...
@@ -122,8 +122,8 @@ type MatrixS n = SparseMatrix n n Double
data
Similarity
=
Conf
|
Mod
data
SimilarityMatrix
n
=
SimConf
(
ConfluenceMatrix
n
)
|
SimMod
(
ModularityMatrix
n
)
data
SimilarityMatrix
n
=
SimConf
!
(
ConfluenceMatrix
n
)
|
SimMod
!
(
ModularityMatrix
n
)
type
Dict
=
IntMap
...
...
@@ -460,5 +460,5 @@ randomAdjacency = do
m1
<-
randomMatrix
m2
<-
randomMatrix
pure
$
SMatrix
.
fromMatrix
$
DMatrix
.
imap
(
\
i
j
v
->
if
i
<
j
&&
v
>
0.
5
then
1
else
0
)
$
DMatrix
.
imap
(
\
i
j
v
->
if
i
<
j
&&
v
>
0.
9
then
1
else
0
)
$
DMatrix
.
mul
m1
m2
test/Spec.hs
View file @
d13b3802
{-# LANGUAGE NoImplicitPrelude #-}
module
Spec
where
import
Data.Set
as
Set
import
Data.String.Conversions
(
cs
)
import
Data.Text
(
Text
)
...
...
@@ -15,25 +17,37 @@ import qualified Eigen.SparseMatrix as SMatrix
import
qualified
Prelude
as
Prelude
import
qualified
Data.List
as
List
edges_test
::
[(
Int
,
Int
)]
edges_test
=
[(
0
,
1
),(
0
,
2
),(
0
,
4
),(
0
,
5
),(
0
,
3
),(
0
,
6
)
,(
1
,
2
),(
1
,
3
),(
2
,
3
),(
4
,
5
),(
4
,
6
),(
5
,
6
)
,(
7
,
8
),(
7
,
3
),(
7
,
4
),(
8
,
2
),(
8
,
5
)
]
main
_test
::
IO
()
main
_test
=
do
main
::
IO
()
main
=
do
let
edges_test
::
[(
Int
,
Int
)]
edges_test
=
[(
0
,
1
),(
0
,
2
),(
0
,
4
),(
0
,
5
),(
0
,
3
),(
0
,
6
)
,(
1
,
2
),(
1
,
3
),(
2
,
3
),(
4
,
5
),(
4
,
6
),(
5
,
6
)
,(
7
,
8
),(
7
,
3
),(
7
,
4
),(
8
,
2
),(
8
,
5
)
]
clustering_result
=
ClusteringIs
{
parts
=
Dict
.
fromList
[(
0
,
Set
.
fromList
[
0
,
4
,
5
,
6
])
,(
1
,
Set
.
fromList
[
1
,
2
,
3
])
,(
7
,
Set
.
fromList
[
7
,
8
])]
,
index
=
Dict
.
fromList
[(
0
,
0
),(
1
,
1
),(
2
,
1
)
,(
3
,
1
),(
4
,
0
),(
5
,
0
)
,(
6
,
0
),(
7
,
7
),(
8
,
7
)
]
,
score
=
3.0558391780792453
,
mode
=
Part
}
g
::
Graph
()
()
g
=
mkGraphUfromEdges
edges_test
result
=
withG
g
(
identity
.
(
clusteringOptim
3
Conf
))
test
=
ClusteringIs
{
parts
=
Dict
.
fromList
[(
0
,
Set
.
fromList
[
0
,
4
,
5
,
6
]),(
1
,
Set
.
fromList
[
1
,
2
,
3
]),(
7
,
Set
.
fromList
[
7
,
8
])],
index
=
Dict
.
fromList
[(
0
,
0
),(
1
,
1
),(
2
,
1
),(
3
,
1
),(
4
,
0
),(
5
,
0
),(
6
,
0
),(
7
,
7
),(
8
,
7
)],
score
=
3.0558391780792453
,
mode
=
Part
}
print
$
result
==
test
print
$
result
==
clustering_result
test_random
::
IO
()
test_random
=
do
m
<-
randomAdjacency
let
...
...
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