raft-0.3.7.0: Miscellaneous Haskell utilities for data structures and data manipulation.

Safe HaskellSafe
LanguageHaskell2010

Data.EdgeTree

Contents

Description

Trees with data on vertices and edges.

Synopsis

Types

data EdgeTree e v Source #

A tree with data at the vertex and edges radiating from it.

Constructors

EdgeTree 

Fields

Instances

Functor (EdgeTree e) Source # 

Methods

fmap :: (a -> b) -> EdgeTree e a -> EdgeTree e b #

(<$) :: a -> EdgeTree e b -> EdgeTree e a #

Foldable (EdgeTree e) Source # 

Methods

fold :: Monoid m => EdgeTree e m -> m #

foldMap :: Monoid m => (a -> m) -> EdgeTree e a -> m #

foldr :: (a -> b -> b) -> b -> EdgeTree e a -> b #

foldr' :: (a -> b -> b) -> b -> EdgeTree e a -> b #

foldl :: (b -> a -> b) -> b -> EdgeTree e a -> b #

foldl' :: (b -> a -> b) -> b -> EdgeTree e a -> b #

foldr1 :: (a -> a -> a) -> EdgeTree e a -> a #

foldl1 :: (a -> a -> a) -> EdgeTree e a -> a #

toList :: EdgeTree e a -> [a] #

null :: EdgeTree e a -> Bool #

length :: EdgeTree e a -> Int #

elem :: Eq a => a -> EdgeTree e a -> Bool #

maximum :: Ord a => EdgeTree e a -> a #

minimum :: Ord a => EdgeTree e a -> a #

sum :: Num a => EdgeTree e a -> a #

product :: Num a => EdgeTree e a -> a #

Traversable (EdgeTree e) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> EdgeTree e a -> f (EdgeTree e b) #

sequenceA :: Applicative f => EdgeTree e (f a) -> f (EdgeTree e a) #

mapM :: Monad m => (a -> m b) -> EdgeTree e a -> m (EdgeTree e b) #

sequence :: Monad m => EdgeTree e (m a) -> m (EdgeTree e a) #

(Read e, Read v) => Read (EdgeTree e v) Source # 
(Show e, Show v) => Show (EdgeTree e v) Source # 

Methods

showsPrec :: Int -> EdgeTree e v -> ShowS #

show :: EdgeTree e v -> String #

showList :: [EdgeTree e v] -> ShowS #

data TreeEdge e v Source #

An edge with data and connecting to a tree.

Constructors

TreeEdge 

Fields

Instances

Functor (TreeEdge e) Source # 

Methods

fmap :: (a -> b) -> TreeEdge e a -> TreeEdge e b #

(<$) :: a -> TreeEdge e b -> TreeEdge e a #

Foldable (TreeEdge e) Source # 

Methods

fold :: Monoid m => TreeEdge e m -> m #

foldMap :: Monoid m => (a -> m) -> TreeEdge e a -> m #

foldr :: (a -> b -> b) -> b -> TreeEdge e a -> b #

foldr' :: (a -> b -> b) -> b -> TreeEdge e a -> b #

foldl :: (b -> a -> b) -> b -> TreeEdge e a -> b #

foldl' :: (b -> a -> b) -> b -> TreeEdge e a -> b #

foldr1 :: (a -> a -> a) -> TreeEdge e a -> a #

foldl1 :: (a -> a -> a) -> TreeEdge e a -> a #

toList :: TreeEdge e a -> [a] #

null :: TreeEdge e a -> Bool #

length :: TreeEdge e a -> Int #

elem :: Eq a => a -> TreeEdge e a -> Bool #

maximum :: Ord a => TreeEdge e a -> a #

minimum :: Ord a => TreeEdge e a -> a #

sum :: Num a => TreeEdge e a -> a #

product :: Num a => TreeEdge e a -> a #

Traversable (TreeEdge e) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> TreeEdge e a -> f (TreeEdge e b) #

sequenceA :: Applicative f => TreeEdge e (f a) -> f (TreeEdge e a) #

mapM :: Monad m => (a -> m b) -> TreeEdge e a -> m (TreeEdge e b) #

sequence :: Monad m => TreeEdge e (m a) -> m (TreeEdge e a) #

(Read e, Read v) => Read (TreeEdge e v) Source # 
(Show e, Show v) => Show (TreeEdge e v) Source # 

Methods

showsPrec :: Int -> TreeEdge e v -> ShowS #

show :: TreeEdge e v -> String #

showList :: [TreeEdge e v] -> ShowS #

Functions

createEdgeTree Source #

Arguments

:: (a -> v)

Function for labelling vertices.

-> (a -> e)

Function for labelling edges.

-> (a -> [a])

Function for generating objects radiating from the starting object.

-> a

The starting objects.

-> EdgeTree e v

The tree.

Create a tree.

filterEdgeTree Source #

Arguments

:: ((v, e, v) -> Bool)

Function for filtering based on vertex-edge-vertex labelling.

-> EdgeTree e v

The tree.

-> EdgeTree e v

The filtered tree.

Filter a tree.

filterEdgeTree' Source #

Arguments

:: (v -> e -> Bool)

Function for filtering based on vextex-edge labelling.

-> EdgeTree e v

The tree.

-> EdgeTree e v

The filtered tree.

Filter a tree.

mapEdgeTree Source #

Arguments

:: ((v, e, v) -> w)

Function for evaluating vertex-edge-vertex triplets.

-> w

The new value for the root of the tree.

-> EdgeTree e v

The tree.

-> EdgeTree e w

The transformed tree.

Evaluate a function on vertices of a tree.

mapEdgeTree' Source #

Arguments

:: (v -> e -> w)

Function for evaluating vertex-edge-vertex triplets.

-> w

The new value for the root of the tree.

-> EdgeTree e v

The tree.

-> EdgeTree e w

The transformed tree.

Evaluate a function on vertices of a tree.

mapTop :: (EdgeTree e v -> a) -> EdgeTree e v -> [(e, a)] Source #

Apply a function to the first subtrees.

truncateEdgeTree :: Int -> EdgeTree e v -> EdgeTree e v Source #

Truncate a tree at a particular depth.

Input/output

putEdgeForest Source #

Arguments

:: Int

How many levels to print.

-> (a -> String)

Function for rendering the label for a tree.

-> (v -> String)

Function for rendering vertex labels.

-> (e -> String)

Function for rendering edge labels.

-> [(a, EdgeTree e v)]

The forest.

-> IO ()

The action for printing the forest.

Print a forest.

hPutEdgeForest Source #

Arguments

:: Handle

Where to print the forest.

-> Int

How many levels to print.

-> (a -> String)

Function for rendering the label for a tree.

-> (v -> String)

Function for rendering vertex labels.

-> (e -> String)

Function for rendering edge labels.

-> [(a, EdgeTree e v)]

The forest.

-> IO ()

The action for printing the forest.

Print a forest.

putEdgeTree Source #

Arguments

:: Int

How many levels to print.

-> (v -> String)

Function for rendering vertex labels.

-> (e -> String)

Function for rendering edge labels.

-> EdgeTree e v

The tree.

-> IO ()

The action for printing the tree.

Print a tree.

putEdgeTree' Source #

Arguments

:: Int

How many levels to print.

-> String

The string for indentation, which will be prefixed to each line output.

-> (v -> String)

Function for rendering vertex labels.

-> (e -> String)

Function for rendering edge labels.

-> EdgeTree e v

The tree.

-> IO ()

The action for printing the tree.

Print a tree.

hPutEdgeTree Source #

Arguments

:: Handle

Where to print the tree.

-> Int

How many levels to print.

-> (v -> String)

Function for rendering vertex labels.

-> (e -> String)

Function for rendering edge labels.

-> EdgeTree e v

The tree.

-> IO ()

The action for printing the tree.

Print a tree.

hPutEdgeTree' Source #

Arguments

:: Handle

Where to print the tree.

-> Int

How many levels to print.

-> String

The string for indentation, which will be prefixed to each line output.

-> (v -> String)

Function for rendering vertex labels.

-> (e -> String)

Function for rendering edge labels.

-> EdgeTree e v

The tree.

-> IO ()

The action for printing the tree.

Print a tree.

putTreeEdge' Source #

Arguments

:: Int

How many levels to print.

-> String

The string for indentation, which will be prefixed to each line output.

-> (v -> String)

Function for rendering vertex labels.

-> (e -> String)

Function for rendering edge labels.

-> TreeEdge e v

The edge.

-> IO ()

THe action for printing the edge.

Print an edge.

hPutTreeEdge' Source #

Arguments

:: Handle

Where to print the tree.

-> Int

How many levels to print.

-> String

The string for indentation, which will be prefixed to each line output.

-> (v -> String)

Function for rendering vertex labels.

-> (e -> String)

Function for rendering edge labels.

-> TreeEdge e v

The edge.

-> IO ()

THe action for printing the edge.

Print an edge.