data-named-0.6.2: Data types for named entities

Safe HaskellSafe
LanguageHaskell2010

Data.Named.Graph

Description

Implementation of a graph with each internal node identified by a unique key and each leaf represented by a position in the sentence.

Synopsis

Documentation

data Graph n w Source #

A graph over a sentence.

Constructors

Graph 

Fields

mkGraph :: (Ord n, Ix w) => (w, w) -> [(n, [Either n w])] -> Graph n w Source #

Make a graph given the bounds and list of edges.

edges :: Ord n => Graph n w -> n -> [Either n w] Source #

Get keys of adjacent nodes for the given node key.

roots :: Ord n => Graph n w -> [n] Source #

Return all graph roots (i.e. nodes with no parents).

toForest :: (Ord n, Ix w) => Graph n w -> NeForest n w Source #

Transform a graph into a disjoint forest, i.e. a forest with no mutually overlapping trees. The process is lossy, discontinuity and overlapping cannot be represented with the NeForest data type.