Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clustering-louvain
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
gargantext
clustering-louvain
Commits
89f88ad5
Commit
89f88ad5
authored
Jul 28, 2016
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FUNC] uniq -> nub
parent
e11beb6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
Louvain.hs
src/Data/Louvain.hs
+3
-2
Utils.hs
src/Data/Utils.hs
+2
-4
No files found.
src/Data/Louvain.hs
View file @
89f88ad5
module
Data.Louvain
where
import
Data.Utils
import
Data.List
(
maximumBy
)
import
Data.List
(
maximumBy
,
nub
)
import
Data.Graph.Inductive
type
Modularity
=
Double
...
...
@@ -13,11 +13,12 @@ inducedGraph gr (a,b) = delNodes b (insEdges newEdges gr')
gr'
=
undir
gr
newEdges
=
Prelude
.
map
(
\
(
n
,
l
)
->
(
a
,
n
,
l
))
(
uniq
$
concat
$
Prelude
.
map
(
lsuc
gr'
)
b
)
-- | TODO exducedGraph (inverse for tests with quickCheck)
inducedGraph'
::
(
Ord
b
,
DynGraph
gr
)
=>
gr
a
b
->
[(
Node
,
[
Node
])]
->
gr
a
b
inducedGraph'
gr
ns
=
Prelude
.
foldl
(
\
gr'
n
->
inducedGraph
gr'
n
)
gr
ns
neighbors''
::
DynGraph
gr
=>
gr
a
b
->
[
Node
]
->
[
Node
]
neighbors''
gr
ns
=
uniq
$
concat
(
Prelude
.
map
(
neighbors
gr
)
ns
)
neighbors''
gr
ns
=
nub
$
concat
(
Prelude
.
map
(
neighbors
gr
)
ns
)
neighcom
::
DynGraph
gr
=>
gr
a
b
->
Node
->
[[
Node
]]
neighcom
gr
n
=
scanl
(
\
x
y
->
take
1
x
++
[
y
])
[
n
]
(
neighbors
gr
n
)
...
...
src/Data/Utils.hs
View file @
89f88ad5
...
...
@@ -2,11 +2,9 @@ module Data.Utils where
import
Data.Graph.Inductive
import
Data.Set
as
S
(
toList
,
fromList
)
import
qualified
Data.List
(
nub
)
uniq
::
Ord
a
=>
[
a
]
->
[
a
]
uniq
=
toList
.
fromList
label'
::
(
Graph
gr
)
=>
gr
a
b
->
Edge
->
Maybe
b
label'
gr
(
u
,
v
)
=
lookup
v
(
lsuc
gr
u
)
...
...
@@ -19,7 +17,7 @@ mkGraph' es = mkGraph ns es
where
ns
::
[
LNode
()
]
ns
=
zip
[
1
..
(
fromIntegral
.
length
)
ns'
]
(
repeat
()
)
where
ns'
=
uniq
$
concat
(
Prelude
.
map
edge2nodes
es
)
where
ns'
=
nub
$
concat
(
Prelude
.
map
edge2nodes
es
)
edge2nodes
::
LEdge
b
->
[
Node
]
...
...
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