net-spider-0.4.3.7: A graph database middleware to maintain a time-varying graph.
MaintainerToshio Ito <debug.ito@gmail.com>
Safe HaskellNone
LanguageHaskell2010

NetSpider.SeqID

Description

Since: 0.4.3.0

Synopsis

Type

data SeqIDMaker n i Source #

SeqIDMaker converts node ID type n into the new node ID type i. The type i is supposed to be an Enum, and it generates the node ID of type i sequentially for each node ID of type n.

SeqIDMaker is useful to convert the SnapshotGraph into a graph representation of another graph library such as fgl. Note that the target graph library can provide a better way for conversion. For example, fgl has NodeMap type to do basically the same thing.

Instances

Instances details
(Eq n, Eq i) => Eq (SeqIDMaker n i) Source # 
Instance details

Defined in NetSpider.SeqID

Methods

(==) :: SeqIDMaker n i -> SeqIDMaker n i -> Bool #

(/=) :: SeqIDMaker n i -> SeqIDMaker n i -> Bool #

(Show n, Show i) => Show (SeqIDMaker n i) Source # 
Instance details

Defined in NetSpider.SeqID

Methods

showsPrec :: Int -> SeqIDMaker n i -> ShowS #

show :: SeqIDMaker n i -> String #

showList :: [SeqIDMaker n i] -> ShowS #

Construction

newSeqIDMaker Source #

Arguments

:: i

Initial ID

-> SeqIDMaker n i 

Make a SeqIDMaker with the given initial ID.

Conversion

convertGraph :: (Eq n, Hashable n, Enum i, Eq i, Hashable i) => SeqIDMaker n i -> SnapshotGraph n na la -> (SeqIDMaker n i, SnapshotGraph i na la) Source #

Convert node IDs in the SnapshotGraph.

convertLink :: (Eq n, Hashable n, Enum i, Eq i, Hashable i) => SeqIDMaker n i -> SnapshotLink n la -> (SeqIDMaker n i, SnapshotLink i la) Source #

Convert node IDs in the SnapshotLink.

convertNode :: (Eq n, Hashable n, Enum i, Eq i, Hashable i) => SeqIDMaker n i -> SnapshotNode n na -> (SeqIDMaker n i, SnapshotNode i na) Source #

Convert node ID in the SnapshotNode.

convertNodeID Source #

Arguments

:: (Eq n, Hashable n, Enum i, Eq i, Hashable i) 
=> SeqIDMaker n i 
-> n

Old ID

-> (SeqIDMaker n i, i)

Updated SeqIDMaker and the new ID.

Convert the given node ID of type n into the sequential ID of type i.

originalIDFor :: (Eq i, Hashable i) => SeqIDMaker n i -> i -> Maybe n Source #

Get the original ID of type n for the new ID of type i.