haskell-igraph-0.6.0: Haskell interface of the igraph library.

Safe HaskellNone
LanguageHaskell2010

IGraph

Synopsis

Documentation

data Graph (d :: EdgeType) v e Source #

Graph with labeled nodes and edges.

Constructors

Graph 
Instances
(SingI d, Serialize v, Serialize e, Hashable v, Eq v) => Serialize (Graph d v e) Source # 
Instance details

Methods

put :: Putter (Graph d v e) #

get :: Get (Graph d v e) #

data EdgeType Source #

Constructors

D 
U 
Instances
Eq EdgeType Source # 
Instance details
Read EdgeType Source # 
Instance details
Show EdgeType Source # 
Instance details
Generic EdgeType Source # 
Instance details

Associated Types

type Rep EdgeType :: * -> * #

Methods

from :: EdgeType -> Rep EdgeType x #

to :: Rep EdgeType x -> EdgeType #

Serialize EdgeType Source # 
Instance details
PShow EdgeType Source # 
Instance details

Associated Types

type ShowsPrec arg arg1 arg2 :: Symbol #

type Show_ arg :: Symbol #

type ShowList arg arg1 :: Symbol #

SShow EdgeType Source # 
Instance details

Methods

sShowsPrec :: Sing t1 -> Sing t2 -> Sing t3 -> Sing (Apply (Apply (Apply ShowsPrecSym0 t1) t2) t3) #

sShow_ :: Sing t -> Sing (Apply Show_Sym0 t) #

sShowList :: Sing t1 -> Sing t2 -> Sing (Apply (Apply ShowListSym0 t1) t2) #

ShowSing EdgeType Source # 
Instance details

Methods

showsSingPrec :: Int -> Sing a -> ShowS #

SEq EdgeType Source # 
Instance details

Methods

(%==) :: Sing a -> Sing b -> Sing (a == b) #

(%/=) :: Sing a -> Sing b -> Sing (a /= b) #

PEq EdgeType Source # 
Instance details

Associated Types

type x == y :: Bool #

type x /= y :: Bool #

SDecide EdgeType Source # 
Instance details

Methods

(%~) :: Sing a -> Sing b -> Decision (a :~: b) #

SingKind EdgeType Source # 
Instance details

Associated Types

type Demote EdgeType = (r :: *) #

SingI D Source # 
Instance details

Methods

sing :: Sing D #

SingI U Source # 
Instance details

Methods

sing :: Sing U #

Show (Sing z) Source # 
Instance details

Methods

showsPrec :: Int -> Sing z -> ShowS #

show :: Sing z -> String #

showList :: [Sing z] -> ShowS #

SuppressUnusedWarnings ShowsPrec_6989586621679101596Sym2 Source # 
Instance details
SuppressUnusedWarnings ShowsPrec_6989586621679101596Sym1 Source # 
Instance details
SuppressUnusedWarnings ShowsPrec_6989586621679101596Sym0 Source # 
Instance details
type Rep EdgeType Source # 
Instance details
type Rep EdgeType = D1 (MetaData "EdgeType" "IGraph.Types" "haskell-igraph-0.6.0-CwDJnuyOC563EnfndzRe4g" False) (C1 (MetaCons "D" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "U" PrefixI False) (U1 :: * -> *))
data Sing (z :: EdgeType) Source # 
Instance details
data Sing (z :: EdgeType) where
type Demote EdgeType Source # 
Instance details
type Show_ (arg :: EdgeType) Source # 
Instance details
type Show_ (arg :: EdgeType) = Apply (Show__6989586621679871872Sym0 :: TyFun EdgeType Symbol -> *) arg
type ShowList (arg :: [EdgeType]) arg1 Source # 
Instance details
type ShowList (arg :: [EdgeType]) arg1 = Apply (Apply (ShowList_6989586621679871890Sym0 :: TyFun [EdgeType] (TyFun Symbol Symbol -> Type) -> *) arg) arg1
type (x :: EdgeType) /= (y :: EdgeType) Source # 
Instance details
type (x :: EdgeType) /= (y :: EdgeType) = Not (x == y)
type (a :: EdgeType) == (b :: EdgeType) Source # 
Instance details
type ShowsPrec a1 (a2 :: EdgeType) a3 Source # 
Instance details
type Apply ShowsPrec_6989586621679101596Sym0 (l :: Nat) Source # 
Instance details
type Apply (ShowsPrec_6989586621679101596Sym1 l1 :: TyFun EdgeType (TyFun Symbol Symbol -> Type) -> *) (l2 :: EdgeType) Source # 
Instance details

isDirected :: forall d v e. SingI d => Graph d v e -> Bool Source #

Is the graph directed or not.

nNodes :: Graph d v e -> Int Source #

Return the number of nodes in a graph.

nodeLab :: Serialize v => Graph d v e -> Node -> v Source #

Return the label of given node.

nodes :: Graph d v e -> [Node] Source #

Return all nodes. nodes gr == [0 .. nNodes gr - 1].

labNodes :: Serialize v => Graph d v e -> [LNode v] Source #

nEdges :: Graph d v e -> Int Source #

Return the number of edges in a graph.

edgeLab :: Serialize e => Graph d v e -> Edge -> e Source #

Return the label of given edge.

edges :: Graph d v e -> [Edge] Source #

Return all edges.

labEdges :: Serialize e => Graph d v e -> [LEdge e] Source #

hasEdge :: Graph d v e -> Edge -> Bool Source #

Whether a edge exists in the graph.

getNodes :: (Hashable v, Eq v) => Graph d v e -> v -> [Node] Source #

Return all nodes that are associated with given label.

getEdgeByEid :: Graph d v e -> Int -> Edge Source #

Find the edge by edge ID.

getEdgeLabByEid :: Serialize e => Graph d v e -> Int -> e Source #

Find the edge label by edge ID.

empty :: (SingI d, Hashable v, Serialize v, Eq v, Serialize e) => Graph d v e Source #

Create a empty graph.

mkGraph Source #

Arguments

:: (SingI d, Hashable v, Serialize v, Eq v, Serialize e) 
=> [v]

Nodes. Each will be assigned a ID from 0 to N.

-> [LEdge e]

Labeled edges.

-> Graph d v e 

Create a graph.

fromLabeledEdges :: (SingI d, Hashable v, Serialize v, Eq v, Serialize e) => [((v, v), e)] -> Graph d v e Source #

Create a graph from labeled edges.

fromLabeledEdges' Source #

Arguments

:: (MonadUnliftIO m, SingI d, Hashable v, Serialize v, Eq v, Serialize e) 
=> a

Input, usually a file

-> (a -> ConduitT () ((v, v), e) m ())

deserialize the input into a stream of edges

-> m (Graph d v e) 

Create a graph from a stream of labeled edges.

unsafeFreeze :: (Hashable v, Eq v, Serialize v, PrimMonad m) => MGraph (PrimState m) d v e -> m (Graph d v e) Source #

Convert a mutable graph to immutable graph. The original graph may not be used afterwards.

freeze :: (Hashable v, Eq v, Serialize v, PrimMonad m) => MGraph (PrimState m) d v e -> m (Graph d v e) Source #

Convert a mutable graph to immutable graph.

unsafeThaw :: PrimMonad m => Graph d v e -> m (MGraph (PrimState m) d v e) Source #

Create a mutable graph. The original graph may not be used afterwards.

thaw :: PrimMonad m => Graph d v e -> m (MGraph (PrimState m) d v e) Source #

Create a mutable graph.

neighbors :: Graph d v e -> Node -> [Node] Source #

Find all neighbors of the given node.

pre :: Graph D v e -> Node -> [Node] Source #

Find all nodes that link to to the given node.

suc :: Graph D v e -> Node -> [Node] Source #

Find all nodes that have a link from the given node.

nmap :: (Serialize v1, Serialize v2, Hashable v2, Eq v2) => (LNode v1 -> v2) -> Graph d v1 e -> Graph d v2 e Source #

Apply a function to change nodes' labels.

emap :: (Serialize e1, Serialize e2, Hashable v, Eq v, Serialize v) => (LEdge e1 -> e2) -> Graph d v e1 -> Graph d v e2 Source #

Apply a function to change edges' labels.

nfilter :: (Hashable v, Eq v, Serialize v) => (LNode v -> Bool) -> Graph d v e -> Graph d v e Source #

Keep nodes that satisfy the constraint.

efilter :: (SingI d, Hashable v, Eq v, Serialize v, Serialize e) => (LEdge e -> Bool) -> Graph d v e -> Graph d v e Source #

Keep edges that satisfy the constraint.