tct-2.0.1: A Complexity Analyser for Term Rewrite Systems

Portabilityunportable
Stabilityunstable
MaintainerMartin Avanzini <martin.avanzini@uibk.ac.at>
Safe HaskellSafe-Infered

Tct.Method.DP.DependencyGraph

Contents

Description

This module provides dependency graphs.

Synopsis

Unified Graph Interface

Datatypes

type DependencyGraph n e = Gr n e

DependencyGraph n e is a Graph with node-labels n and edge-labels e

type NodeId = Node

A node in the dependency graph. Most operations work on NodeIds. Use lookupNodeLabel to get the label of the node

Operations

Returns the set of nodes.

lnodes :: DependencyGraph n e -> [(NodeId, n)]

Returns the set of nodes together with their labels.

Returns the list of nodes without predecessor.

Returns the list of nodes without successor.

Returns the label of the given node, if present.

Returns the label of the given node, if present. Otherwise an exception is raised

Returns the node with given label.

lookupNode' :: Eq n => DependencyGraph n e -> n -> NodeId

Returns the node with given label. Otherwise an exception is raised

List version of lookupNodeLabel.

List version of lookupNodeLabel'.

Returns the same graph with edges inversed.

returns a topologically sorted set of nodes.

returns the list of strongly connected components, including trivial ones.

Make the graph undirected, i.e. for every edge from A to B, there exists an edge from B to A.

Returns the list of successors in a given node.

reachable gr ns closes the list of nodes ns under the successor relation with respect to ns in a depth-first manner.

reachable gr ns closes the list of nodes ns under the successor relation with respect to ns in a breath-first manner.

lsuccessors :: DependencyGraph n e -> NodeId -> [(NodeId, n, e)]

Returns the list of successors in a given node, including their labels.

Returns the list of predecessors in a given node.

Returns the list of predecessors in a given node, including their labels.

isEdgeTo dg n1 n2 checks wheter n2 is a successor of n1 in the dependency graph dg

isLEdgeTo :: Eq e => DependencyGraph n e -> NodeId -> e -> NodeId -> Bool

isLEdgeTo dg n1 l n2 checks wheter n2 is a successor of n1 in the dependency graph dg, where the edge from n1 to n2 is labeled by l.

Computes the subgraph based on the given nodes.

Dependency Graph

Datatype

The dependency graph.

Nodes of the DG are labeled by rules and their strictness-annotation.

data Approximation

Constructors

EdgStar

EDG* approximation

Trivial

Fully connected graph

ICapStar

Generalised EDG*

Construct an estimated dependency graph, using the given approximation.

Congruence Graph

Datatype

The congruence dependency graph.

data CDGNode

Constructors

CongrNode 

Fields

theSCC :: [(NodeId, DGNode)]
 
isCyclic :: Bool
 

Operations

Computes the congruence graph of a given dependency graph.

Returns the list of annotated rules of the given node.

List version of allRulesFromNode.

congruence cdg n returns the nodes from the original dependency graph (i.e., the one given to toCongruenceGraph) that is denoted by the congruence-node n.

isCyclicNode cdg n returns True iff there is an edge from a node in congruence cdg n to congruence cdg n in the original dependency graph (i.e., the one given to toCongruenceGraph).

Utilities

pprintCWDGNode cdg sig vars node is a default printer for the CDG-node node. It shows the nodes of the dependency graph denoted by node as a set.

Default pretty printer for CDGs. Prints the given CDG in a tree-like shape.

Default pretty printer for set of nodes.

toGraphViz :: [(DG, Signature, Variables)] -> Bool -> DotGraph String

translates DG into a GraphViz graph.

output DG as Svg.

show a DG in a GraphViz canvas. * Misc