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
00b529b7
Commit
00b529b7
authored
Jul 26, 2021
by
Alp Mestanogullari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve performance
parent
67a730e4
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
220 additions
and
144 deletions
+220
-144
Main.hs
app/Main.hs
+8
-8
gargantext-graph.cabal
gargantext-graph.cabal
+19
-11
package.yaml
package.yaml
+1
-1
ProxemyOptim.hs
src/Graph/BAC/ProxemyOptim.hs
+160
-104
CSV.hs
src/Graph/Tools/CSV.hs
+0
-1
Import.hs
src/Graph/Tools/Import.hs
+3
-2
Random.hs
src/Graph/Tools/Random.hs
+12
-8
Types.hs
src/Graph/Types.hs
+8
-7
stack.yaml
stack.yaml
+9
-2
No files found.
app/Main.hs
View file @
00b529b7
...
@@ -16,8 +16,6 @@ import Prelude (String)
...
@@ -16,8 +16,6 @@ import Prelude (String)
import
Protolude
import
Protolude
import
qualified
Data.IntMap
as
Dict
import
qualified
Data.IntMap
as
Dict
import
qualified
Data.List
as
List
import
qualified
Data.List
as
List
import
qualified
Eigen.Matrix
as
Matrix
import
qualified
Eigen.SparseMatrix
as
SMatrix
import
qualified
Prelude
as
Prelude
import
qualified
Prelude
as
Prelude
import
qualified
Data.Graph.Inductive.PatriciaTree
as
DGIP
import
qualified
Data.Graph.Inductive.PatriciaTree
as
DGIP
...
@@ -31,9 +29,11 @@ setupEnv _ = getUnlabGraph Random
...
@@ -31,9 +29,11 @@ setupEnv _ = getUnlabGraph Random
main
::
IO
()
main
::
IO
()
main
=
do
main
=
do
fp
<-
getArgs
fp
<-
getArgs
setupEnv
fp
>>=
\
(
_
,
~
g
)
->
withArgs
[]
$
evaluate
$
withG
g
(
clusteringOptim
3
Conf
)
defaultMain
return
()
[
env
(
snd
<$>
setupEnv
fp
)
$
\
~
g
->
-- withArgs [] $
bench
"bench"
(
nf
(
\
x
->
withG
x
(
parts
.
clusteringOptim
3
Conf
))
g
)
-- defaultMain
]
-- [ env (snd <$> setupEnv fp) $ \ ~g ->
-- bench "bench" (nf (\ x -> withG x (parts . clusteringOptim 3 Conf)) g)
-- ]
gargantext-graph.cabal
View file @
00b529b7
cabal-version: 1.12
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.3
3.0
.
-- This file has been generated from package.yaml by hpack version 0.3
4.4
.
--
--
-- see: https://github.com/sol/hpack
-- see: https://github.com/sol/hpack
--
--
...
@@ -9,8 +9,8 @@ cabal-version: 1.12
...
@@ -9,8 +9,8 @@ cabal-version: 1.12
name: gargantext-graph
name: gargantext-graph
version: 0.1.0.0
version: 0.1.0.0
description: Please see the README on GitHub at <https://github.com/githubuser/gargantext-graph#readme>
description: Please see the README on GitHub at <https://github.com/githubuser/gargantext-graph#readme>
homepage: https://github.com/
https://gitlab.iscpif.fr/
gargantext/gargantext-graph#readme
homepage: https://github.com/gargantext/gargantext-graph#readme
bug-reports: https://github.com/
https://gitlab.iscpif.fr/
gargantext/gargantext-graph/issues
bug-reports: https://github.com/gargantext/gargantext-graph/issues
author: Alexandre Delanoë
author: Alexandre Delanoë
maintainer: alexandre+dev@delanoe.org
maintainer: alexandre+dev@delanoe.org
copyright: 2021 CNRS / Alexandre Delanoë
copyright: 2021 CNRS / Alexandre Delanoë
...
@@ -23,12 +23,12 @@ extra-source-files:
...
@@ -23,12 +23,12 @@ extra-source-files:
source-repository head
source-repository head
type: git
type: git
location: https://github.com/
https://gitlab.iscpif.fr/
gargantext/gargantext-graph
location: https://github.com/gargantext/gargantext-graph
library
library
exposed-modules:
exposed-modules:
Data.Array.Accelerate.Utils
Data.Array.Accelerate.Utils
Data.Eigen.Coeff
--
Data.Eigen.Coeff
Graph.BAC.Clustering
Graph.BAC.Clustering
Graph.BAC.Proxemy
Graph.BAC.Proxemy
Graph.BAC.ProxemyOptim
Graph.BAC.ProxemyOptim
...
@@ -45,7 +45,10 @@ library
...
@@ -45,7 +45,10 @@ library
Paths_gargantext_graph
Paths_gargantext_graph
hs-source-dirs:
hs-source-dirs:
src
src
default-extensions: DataKinds FlexibleInstances OverloadedStrings
default-extensions:
DataKinds
FlexibleInstances
OverloadedStrings
build-depends:
build-depends:
accelerate
accelerate
, accelerate-arithmetic
, accelerate-arithmetic
...
@@ -55,14 +58,16 @@ library
...
@@ -55,14 +58,16 @@ library
, cassava
, cassava
, cereal
, cereal
, containers
, containers
, eigen
--
, eigen
, fgl
, fgl
, haskell-igraph >=0.6.0
, haskell-igraph >=0.6.0
, hmatrix
, lens
, lens
, pretty-simple
, pretty-simple
, protolude
, protolude
, reflection
, reflection
, singletons
, singletons == 2.7
, sparse-linear
, string-conversions
, string-conversions
, text
, text
, vector
, vector
...
@@ -86,7 +91,7 @@ executable gargantext-graph-exe
...
@@ -86,7 +91,7 @@ executable gargantext-graph-exe
, cereal
, cereal
, containers
, containers
, criterion
, criterion
, eigen
--
, eigen
, fgl
, fgl
, gargantext-graph
, gargantext-graph
, haskell-igraph >=0.6.0
, haskell-igraph >=0.6.0
...
@@ -107,7 +112,10 @@ test-suite gargantext-graph-test
...
@@ -107,7 +112,10 @@ test-suite gargantext-graph-test
Paths_gargantext_graph
Paths_gargantext_graph
hs-source-dirs:
hs-source-dirs:
test
test
default-extensions: DataKinds FlexibleInstances OverloadedStrings
default-extensions:
DataKinds
FlexibleInstances
OverloadedStrings
ghc-options: -threaded -rtsopts -with-rtsopts=-N
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
build-depends:
QuickCheck
QuickCheck
...
@@ -119,7 +127,7 @@ test-suite gargantext-graph-test
...
@@ -119,7 +127,7 @@ test-suite gargantext-graph-test
, cassava
, cassava
, cereal
, cereal
, containers
, containers
, eigen
--
, eigen
, fgl
, fgl
, gargantext-graph
, gargantext-graph
, haskell-igraph >=0.6.0
, haskell-igraph >=0.6.0
...
...
package.yaml
View file @
00b529b7
name
:
gargantext-graph
name
:
gargantext-graph
version
:
0.1.0.0
version
:
0.1.0.0
github
:
"
https://gitlab.iscpif.fr/gargantext/gargantext-graph"
github
:
gargantext/gargantext-graph
license
:
AGPL
license
:
AGPL
author
:
"
Alexandre
Delanoë"
author
:
"
Alexandre
Delanoë"
maintainer
:
"
alexandre+dev@delanoe.org"
maintainer
:
"
alexandre+dev@delanoe.org"
...
...
src/Graph/BAC/ProxemyOptim.hs
View file @
00b529b7
This diff is collapsed.
Click to expand it.
src/Graph/Tools/CSV.hs
View file @
00b529b7
...
@@ -22,7 +22,6 @@ import Data.Vector hiding (map, uniq)
...
@@ -22,7 +22,6 @@ import Data.Vector hiding (map, uniq)
import
Prelude
(
read
)
import
Prelude
(
read
)
import
Protolude
import
Protolude
import
Graph.Types
import
Graph.Types
import
qualified
Eigen.SparseMatrix
as
SMatrix
import
qualified
Data.Map
as
Map
import
qualified
Data.Map
as
Map
import
qualified
Data.ByteString.Lazy
as
BL
import
qualified
Data.ByteString.Lazy
as
BL
import
qualified
Data.Graph.Inductive
as
DGI
import
qualified
Data.Graph.Inductive
as
DGI
...
...
src/Graph/Tools/Import.hs
View file @
00b529b7
{-# LANGUAGE TypeApplications #-}
{-| Module : Graph.Tools
{-| Module : Graph.Tools
Description :
Description :
Copyright : (c) CNRS, Alexandre Delanoë
Copyright : (c) CNRS, Alexandre Delanoë
...
@@ -25,7 +26,7 @@ import Graph.Types
...
@@ -25,7 +26,7 @@ import Graph.Types
import
Graph.Tools.Random
import
Graph.Tools.Random
import
Graph.Tools.CSV
import
Graph.Tools.CSV
import
Graph.FGL
import
Graph.FGL
import
qualified
Eigen.SparseMatrix
as
SMatrix
import
qualified
Data.Matrix.Sparse.Static
as
SMatrix
import
qualified
Data.IntMap
as
Dict
import
qualified
Data.IntMap
as
Dict
import
qualified
Data.Map
as
Map
import
qualified
Data.Map
as
Map
import
qualified
Data.ByteString.Lazy
as
BL
import
qualified
Data.ByteString.Lazy
as
BL
...
@@ -44,7 +45,7 @@ data GraphData = LightGraph { lightGraph :: Graph () () }
...
@@ -44,7 +45,7 @@ data GraphData = LightGraph { lightGraph :: Graph () () }
getGraph
::
GetGraph
->
IO
GraphData
getGraph
::
GetGraph
->
IO
GraphData
getGraph
Random
=
randomAdjacency
getGraph
Random
=
randomAdjacency
@
100
>>=
\
m
->
pure
$
LightGraph
>>=
\
m
->
pure
$
LightGraph
$
mkGraphUfromEdges
$
mkGraphUfromEdges
$
List
.
map
(
\
(
x
,
y
,
_
)
->
(
x
,
y
))
$
List
.
map
(
\
(
x
,
y
,
_
)
->
(
x
,
y
))
...
...
src/Graph/Tools/Random.hs
View file @
00b529b7
...
@@ -6,7 +6,6 @@ Maintainer : alexandre+dev@delanoe.org
...
@@ -6,7 +6,6 @@ Maintainer : alexandre+dev@delanoe.org
Stability : experimental
Stability : experimental
Portability : POSIX
Portability : POSIX
-}
-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE ConstraintKinds #-}
...
@@ -22,18 +21,21 @@ import Data.Vector hiding (map, uniq)
...
@@ -22,18 +21,21 @@ import Data.Vector hiding (map, uniq)
import
Prelude
(
read
)
import
Prelude
(
read
)
import
Protolude
import
Protolude
import
Graph.Types
import
Graph.Types
import
qualified
Eigen.SparseMatrix
as
SMatrix
--
import qualified Eigen.SparseMatrix as SMatrix
import
qualified
Eigen.Matrix
as
DMatrix
--
import qualified Eigen.Matrix as DMatrix
import
qualified
Data.Graph.Inductive.PatriciaTree
as
DGIP
import
qualified
Data.Graph.Inductive.PatriciaTree
as
DGIP
import
qualified
Data.Set
as
Set
import
qualified
Data.Set
as
Set
import
qualified
Data.Vector
as
Vector
import
qualified
Data.Vector
as
Vector
import
qualified
Data.Matrix.Sparse.Static
as
SMatrix
import
qualified
Numeric.LinearAlgebra.Static
as
DMatrix
-- Random Matrix
-- Random Matrix
-- | Random Matrix && Graph
-- | Random Matrix && Graph
-- TODO random matrix of any size for the tests
-- TODO random matrix of any size for the tests
randomMatrix
::
IO
(
MatrixD
100
)
randomMatrix
::
KnownNat
n
=>
IO
(
MatrixD
n
)
randomMatrix
=
DMatrix
.
rand
om
randomMatrix
=
DMatrix
.
rand
{-
{-
matrix2graph :: forall n
matrix2graph :: forall n
...
@@ -44,10 +46,12 @@ matrix2graph m = withG (mkGraphUfromEdges $ map (\(x,y,_) -> (x,y)) $ SMatrix.to
...
@@ -44,10 +46,12 @@ matrix2graph m = withG (mkGraphUfromEdges $ map (\(x,y,_) -> (x,y)) $ SMatrix.to
identity
identity
-}
-}
randomAdjacency
::
IO
(
MatrixS
100
)
randomAdjacency
::
KnownNat
n
=>
IO
(
MatrixS
n
)
randomAdjacency
=
do
randomAdjacency
=
do
m1
<-
randomMatrix
m1
<-
randomMatrix
m2
<-
randomMatrix
m2
<-
randomMatrix
pure
$
SMatrix
.
fromMatrix
pure
$
SMatrix
.
sparsify
(
\
(
i
,
j
)
v
->
if
i
<
j
&&
v
>
0.9
then
Just
1
else
Nothing
)
$
DMatrix
.
imap
(
\
i
j
v
->
if
i
<
j
&&
v
>
0.9
then
1
else
0
)
$
DMatrix
.
mul
m1
m2
$
DMatrix
.
mul
m1
m2
-- pure $ SMatrix.fromMatrix
-- $ DMatrix.imapL (\(i, j) v -> if i < j && v > 0.9 then 1 else 0)
-- $ DMatrix.mul m1 m2
src/Graph/Types.hs
View file @
00b529b7
...
@@ -15,8 +15,12 @@ module Graph.Types where
...
@@ -15,8 +15,12 @@ module Graph.Types where
import
qualified
Data.Graph.Inductive.PatriciaTree
as
DGIP
import
qualified
Data.Graph.Inductive.PatriciaTree
as
DGIP
import
Data.IntMap
(
IntMap
)
import
Data.IntMap
(
IntMap
)
import
qualified
Eigen.Matrix
as
DenseMatrix
-- import qualified Eigen.Matrix as DenseMatrix
import
Eigen.SparseMatrix
(
SparseMatrix
)
-- import Eigen.SparseMatrix (SparseMatrix)
import
qualified
Data.Matrix.Sparse.Static
as
Sparse
import
qualified
Data.Vector.Unboxed
as
VU
import
qualified
Numeric.LinearAlgebra.Static
as
Dense
-- | Main Types use in this libray
-- | Main Types use in this libray
...
@@ -26,8 +30,5 @@ type Dict = IntMap
...
@@ -26,8 +30,5 @@ type Dict = IntMap
type
Graph
a
b
=
DGIP
.
Gr
a
b
type
Graph
a
b
=
DGIP
.
Gr
a
b
-- | Type for Matrix computation optimizations (with Eigen)
-- | Type for Matrix computation optimizations (with Eigen)
type
MatrixD
n
=
DenseMatrix
.
Matrix
n
n
Double
type
MatrixD
n
=
Dense
.
L
n
n
type
MatrixS
n
=
SparseMatrix
n
n
Double
type
MatrixS
n
=
Sparse
.
Matrix
n
n
Double
stack.yaml
View file @
00b529b7
...
@@ -44,8 +44,16 @@ extra-deps:
...
@@ -44,8 +44,16 @@ extra-deps:
commit
:
f5c0e0071ec7b6532f9a9cd3eb33d14f340fbcc9
commit
:
f5c0e0071ec7b6532f9a9cd3eb33d14f340fbcc9
-
git
:
https://gitlab.iscpif.fr/anoe/accelerate-utility.git
-
git
:
https://gitlab.iscpif.fr/anoe/accelerate-utility.git
commit
:
83ada76e78ac10d9559af8ed6bd4064ec81308e4
commit
:
83ada76e78ac10d9559af8ed6bd4064ec81308e4
-
git
:
https://github.com/alpmestan/sparse-linear.git
commit
:
785f12c99615907b207f5499dd3b70a486a0249b
subdirs
:
-
sparse-linear
-
git
:
https://github.com/alpmestan/hmatrix.git
commit
:
39155c60c97ba8cd5c8ab9c202b428fec42faa3c
subdirs
:
-
packages/base
-
accelerate-arithmetic-1.0.0.1@sha256:555639232aa5cad411e89247b27871d09352b987a754230a288c690b6de6d888,2096
-
accelerate-arithmetic-1.0.0.1@sha256:555639232aa5cad411e89247b27871d09352b987a754230a288c690b6de6d888,2096
-
eigen-3.3.7.0@sha256:7c24a86426b238e02ba0ac2179cc44997518b443a13828ed7a791fe49a6dffa5,82060
#
- eigen-3.3.7.0@sha256:7c24a86426b238e02ba0ac2179cc44997518b443a13828ed7a791fe49a6dffa5,82060
# Override default flag values for local packages and extra-deps
# Override default flag values for local packages and extra-deps
...
@@ -64,7 +72,6 @@ extra-deps:
...
@@ -64,7 +72,6 @@ extra-deps:
# Override the architecture used by stack, especially useful on Windows
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: i386
# arch: x86_64
# arch: x86_64
#
# Extra directories used by stack for building
# Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir]
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
...
...
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