Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-igraph
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
haskell-igraph
Commits
c6153226
Commit
c6153226
authored
8 years ago
by
Kai Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add triadCensus
parent
1bb94810
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
+33
-3
haskell-igraph.cabal
haskell-igraph.cabal
+1
-0
Motif.chs
src/IGraph/Internal/Motif.chs
+17
-0
Motif.hs
src/IGraph/Motif.hs
+15
-3
No files found.
haskell-igraph.cabal
View file @
c6153226
...
...
@@ -31,6 +31,7 @@ library
IGraph.Internal.Isomorphism
IGraph.Internal.Selector
IGraph.Internal.Structure
IGraph.Internal.Motif
IGraph.Internal.Clique
IGraph.Internal.Community
IGraph.Internal.Layout
...
...
This diff is collapsed.
Click to expand it.
src/IGraph/Internal/Motif.chs
0 → 100644
View file @
c6153226
{-# LANGUAGE ForeignFunctionInterface #-}
module IGraph.Internal.Motif where
import qualified Foreign.Marshal.Utils as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import Foreign
import Foreign.C.Types
{#import IGraph.Internal.Graph #}
{#import IGraph.Internal.Selector #}
{#import IGraph.Internal.Constants #}
{#import IGraph.Internal.Data #}
#include "igraph/igraph.h"
{#fun igraph_triad_census as ^ { `IGraphPtr'
, `VectorPtr' } -> `Int' #}
This diff is collapsed.
Click to expand it.
src/IGraph/Motif.hs
View file @
c6153226
module
IGraph.Motif
(
triad
)
where
(
triad
,
triadCensus
)
where
import
Data.Hashable
(
Hashable
)
import
System.IO.Unsafe
(
unsafePerformIO
)
import
IGraph
import
IGraph.Internal.Motif
import
IGraph.Internal.Data
-- | Every triple of vertices in a directed graph
-- 003: A, B, C, the empty graph.
...
...
@@ -40,6 +47,11 @@ triad = map make xs
,
[(
0
,
1
),
(
1
,
2
),
(
2
,
1
),
(
0
,
2
),
(
2
,
0
)]
,
[(
0
,
1
),
(
1
,
2
),
(
1
,
2
),
(
2
,
1
),
(
0
,
2
),
(
2
,
0
)]
]
make
::
[(
Int
,
Int
)]
->
LGraph
D
()
()
make
xs
=
mkGraph
(
replicate
(
length
xs
)
()
)
$
zip
xs
$
repeat
()
make
::
[(
Int
,
Int
)]
->
LGraph
D
()
()
make
xs
=
mkGraph
(
replicate
(
length
xs
)
()
)
$
zip
xs
$
repeat
()
triadCensus
::
(
Hashable
v
,
Eq
v
,
Read
v
)
=>
LGraph
d
v
e
->
[
Int
]
triadCensus
gr
=
unsafePerformIO
$
do
vptr
<-
igraphVectorNew
0
igraphTriadCensus
(
_graph
gr
)
vptr
map
truncate
<$>
vectorPtrToList
vptr
This diff is collapsed.
Click to expand it.
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