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
1
Merge Requests
1
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
4b8b45aa
Commit
4b8b45aa
authored
Jul 09, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[OPTIM] worse with list
parent
f00fcfaa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1984 additions
and
9 deletions
+1984
-9
gargantext-graph-exe.prof
gargantext-graph-exe.prof
+1961
-0
ProxemyOptim.hs
src/Graph/BAC/ProxemyOptim.hs
+21
-9
Spec.hs
test/Spec.hs
+2
-0
No files found.
gargantext-graph-exe.prof
View file @
4b8b45aa
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/Graph/BAC/ProxemyOptim.hs
View file @
4b8b45aa
...
...
@@ -152,9 +152,9 @@ adjacent (FiniteGraph g) isReflexive =
transition
::
KnownNat
n
=>
AdjacencyMatrix
n
->
TransitionMatrix
n
transition
m
=
SMatrix
.
imap
(
\
i
j
v
->
v
*
(
VS
.
!
)
s
i
)
m
transition
m
=
SMatrix
.
imap
(
\
i
j
v
->
v
*
(
List
.!
!
)
s
i
)
m
where
s
=
sumWith
Colonne
(
\
s
->
1
/
s
)
m
s
=
sumWith
'
Colonne
(
\
s
->
1
/
s
)
m
proxemie
::
KnownNat
n
...
...
@@ -175,13 +175,13 @@ matconf :: forall n. KnownNat n
matconf
False
a
p
=
symmetry
confmat
where
-- vcount = natToInt @n
degs
=
sumWith
Colonne
identity
a
sumdeg
=
VS
.
sum
degs
degs
=
sumWith
'
Colonne
identity
a
sumdeg
=
List
.
sum
degs
confmat
=
DMatrix
.
imap
(
\
x
y
v
->
if
x
<
y
then
let
prox_y_x_length
=
v
prox_y_x_infini
=
((
VS
.
!
)
degs
x
)
/
sumdeg
prox_y_x_infini
=
((
List
.!
!
)
degs
x
)
/
sumdeg
in
(
prox_y_x_length
-
prox_y_x_infini
)
/
(
prox_y_x_length
+
prox_y_x_infini
)
...
...
@@ -219,15 +219,15 @@ edges_confluence l am tm = -- traceShow ("degs", degs) $
SMatrix
.
toList
matconf'
where
vcount
=
natToInt
@
n
degs
=
sumWith
Colonne
identity
am
sumdeg
=
VS
.
sum
degs
degs
=
sumWith
'
Colonne
identity
am
sumdeg
=
List
.
sum
degs
matconf'
=
SMatrix
.
imap
(
\
x
y
_
->
if
x
<
y
then
let
deg_x
=
(
VS
.
!
)
degs
x
-
1
deg_y
=
(
VS
.
!
)
degs
y
-
1
deg_x
=
(
List
.!
!
)
degs
x
-
1
deg_y
=
(
List
.!
!
)
degs
y
-
1
tm'
=
SMatrix
.
imap
(
\
i
j
v
->
if
(
i
==
x
&&
j
==
y
)
||
(
i
==
y
&&
j
==
x
)
then
0
...
...
@@ -440,5 +440,17 @@ sumWith dir f m = VS.fromList
where
somme
m'
=
map
(
sum
.
SMatrix
.
toMatrix
)
m'
sumWith'
::
(
Elem
a
,
Elem
t
,
KnownNat
n
)
=>
Direction
->
(
t
->
a
)
->
SparseMatrix
n
n
t
->
[
a
]
sumWith'
dir
f
m
=
map
(
\
v
->
f
v
)
$
case
dir
of
Colonne
->
somme
$
SMatrix
.
getCols
m
Ligne
->
somme
$
SMatrix
.
getRows
m
where
somme
m'
=
map
(
sum
.
SMatrix
.
toMatrix
)
m'
--------------------------------------------
test/Spec.hs
View file @
4b8b45aa
...
...
@@ -9,6 +9,8 @@ import Data.Text (Text)
import
qualified
Eigen.Matrix
as
Matrix
import
Graph.BAC.ProxemyOptim
import
Graph.FGL
import
Graph.Types
import
Graph.Tools.Random
import
Prelude
(
String
)
import
Protolude
import
Graph.BAC.ProxemyOptim
...
...
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