dawg-ord-0.3: Directed acyclic word graphs

Safe HaskellNone
LanguageHaskell98

Data.DAWG.Int

Contents

Synopsis

DAWG type

data DAWG a Source

A directed acyclic word graph with phantom type a representing the type of alphabet elements.

Instances

type ID = Int Source

Node identifier.

root :: DAWG a -> ID Source

Query

member :: Enum a => [a] -> DAWG a -> Bool Source

Find value associated with the key.

numStates :: DAWG a -> Int Source

Number of states in the automaton.

numEdges :: DAWG a -> Int Source

Number of edges in the automaton.

Traversal

accept :: ID -> DAWG a -> Bool Source

Value stored in the given state.

edges :: Enum a => ID -> DAWG a -> [(a, ID)] Source

A list of outgoing edges.

follow :: Enum a => ID -> a -> DAWG a -> Maybe ID Source

Follow the given transition from the given state.

Construction

empty :: DAWG a Source

Empty DAWG.

fromList :: Enum a => [[a]] -> DAWG a Source

Construct DAWG from the list of (word, value) pairs.

Insertion

insert :: Enum a => [a] -> DAWG a -> DAWG a Source

Insert the (key, value) pair into the DAWG.

Conversion

keys :: Enum a => DAWG a -> [[a]] Source

Return all key/value pairs in the DAWG in ascending key order.