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
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
gargantext
haskell-igraph
Commits
329c4c03
Commit
329c4c03
authored
Nov 05, 2015
by
Kai Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add nodeLabMaybe and edgeLabMaybe
parent
1cd91ff1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
IGraph.hs
src/IGraph.hs
+14
-0
Attribute.chs
src/IGraph/Internal/Attribute.chs
+2
-1
Constants.chs
src/IGraph/Internal/Constants.chs
+2
-0
No files found.
src/IGraph.hs
View file @
329c4c03
...
@@ -69,11 +69,25 @@ class MGraph d => Graph d where
...
@@ -69,11 +69,25 @@ class MGraph d => Graph d where
nodeLab
(
LGraph
g
_
)
i
=
read
$
igraphCattributeVAS
g
vertexAttr
i
nodeLab
(
LGraph
g
_
)
i
=
read
$
igraphCattributeVAS
g
vertexAttr
i
{-# INLINE nodeLab #-}
{-# INLINE nodeLab #-}
nodeLabMaybe
::
Read
v
=>
LGraph
d
v
e
->
Node
->
Maybe
v
nodeLabMaybe
gr
@
(
LGraph
g
_
)
i
=
if
igraphCattributeHasAttr
g
IgraphAttributeVertex
vertexAttr
then
Just
$
nodeLab
gr
i
else
Nothing
{-# INLINE nodeLabMaybe #-}
edgeLab
::
Read
e
=>
LGraph
d
v
e
->
Edge
->
e
edgeLab
::
Read
e
=>
LGraph
d
v
e
->
Edge
->
e
edgeLab
(
LGraph
g
_
)
(
fr
,
to
)
=
read
$
igraphCattributeEAS
g
edgeAttr
$
edgeLab
(
LGraph
g
_
)
(
fr
,
to
)
=
read
$
igraphCattributeEAS
g
edgeAttr
$
igraphGetEid
g
fr
to
True
True
igraphGetEid
g
fr
to
True
True
{-# INLINE edgeLab #-}
{-# INLINE edgeLab #-}
edgeLabMaybe
::
Read
e
=>
LGraph
d
v
e
->
Edge
->
Maybe
e
edgeLabMaybe
gr
@
(
LGraph
g
_
)
i
=
if
igraphCattributeHasAttr
g
IgraphAttributeEdge
edgeAttr
then
Just
$
edgeLab
gr
i
else
Nothing
{-# INLINE edgeLabMaybe #-}
edgeLabByEid
::
Read
e
=>
LGraph
d
v
e
->
Int
->
e
edgeLabByEid
::
Read
e
=>
LGraph
d
v
e
->
Int
->
e
edgeLabByEid
(
LGraph
g
_
)
i
=
read
$
igraphCattributeEAS
g
edgeAttr
i
edgeLabByEid
(
LGraph
g
_
)
i
=
read
$
igraphCattributeEAS
g
edgeAttr
i
{-# INLINE edgeLabByEid #-}
{-# INLINE edgeLabByEid #-}
...
...
src/IGraph/Internal/Attribute.chs
View file @
329c4c03
...
@@ -11,6 +11,7 @@ import System.IO.Unsafe (unsafePerformIO)
...
@@ -11,6 +11,7 @@ import System.IO.Unsafe (unsafePerformIO)
{#import IGraph.Internal.Graph #}
{#import IGraph.Internal.Graph #}
{#import IGraph.Internal.Data #}
{#import IGraph.Internal.Data #}
{#import IGraph.Internal.Constants #}
#include "igraph/igraph.h"
#include "igraph/igraph.h"
...
@@ -37,7 +38,7 @@ instance Storable AttributeRecord where
...
@@ -37,7 +38,7 @@ instance Storable AttributeRecord where
withStrVectorPtr vptr $ \ptr ->
withStrVectorPtr vptr $ \ptr ->
{#set igraph_attribute_record_t.value #} p $ castPtr ptr
{#set igraph_attribute_record_t.value #} p $ castPtr ptr
{#fun pure igraph_cattribute_has_attr as ^ { `IGraphPtr', `
Int
', `String' } -> `Bool' #}
{#fun pure igraph_cattribute_has_attr as ^ { `IGraphPtr', `
AttributeElemtype
', `String' } -> `Bool' #}
{#fun igraph_cattribute_GAN_set as ^ { `IGraphPtr', `String', `Double' } -> `Int' #}
{#fun igraph_cattribute_GAN_set as ^ { `IGraphPtr', `String', `Double' } -> `Int' #}
...
...
src/IGraph/Internal/Constants.chs
View file @
329c4c03
...
@@ -12,3 +12,5 @@ import Foreign
...
@@ -12,3 +12,5 @@ import Foreign
{#enum igraph_spincomm_update_t as SpincommUpdate {underscoreToCase} deriving (Show, Eq) #}
{#enum igraph_spincomm_update_t as SpincommUpdate {underscoreToCase} deriving (Show, Eq) #}
{#enum igraph_spinglass_implementation_t as SpinglassImplementation {underscoreToCase} deriving (Show, Eq) #}
{#enum igraph_spinglass_implementation_t as SpinglassImplementation {underscoreToCase} deriving (Show, Eq) #}
{#enum igraph_attribute_elemtype_t as AttributeElemtype {underscoreToCase} deriving (Show, Eq) #}
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