data-named-0.5.1: Data types for named entities

Safe HaskellSafe-Inferred

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

bounds :: (w, w)
 
edgeMap :: Map n [Either n w]
 

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

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 wSource

Transform graph into a disjoint forest, i.e. with no mutually overlapping trees.