Overview  Index  Help 
SMLDoc

DEPENDENCY_GRAPH

All Known Implementing Modules:

DependencyGraph


signature DEPENDENCY_GRAPH =
sig
  type 'a graph
  val create : int -> 'a graph
  val dependsOn : 'a graph -> {src : int, dest : int, attr : 'a} -> unit
  val isDependsOn : 'a graph -> {src : int, dest : int} -> 'a option * bool
  val getClosure : 'a graph -> ('a -> bool) * int -> int list
  val getClosureRev : 'a graph -> ('a -> bool) * int -> int list
  val sort : 'a graph -> ('a -> bool) -> int list
end

the signature of the module which provides operations on the dependency graph.

Author:
YAMATODANI Kiyoshi
Version:
$Id: SigDEPENDENCY_GRAPH.html,v 1.9 2007/02/17 07:01:57 kiyoshiy Exp $

 
Type detail

graph

type 'a graph

dependency graph

     
Value detail

create

fun create nodes : int -> 'a graph

creates a initial graph contains no edges between the nodes.

Parameters:
nodes
the number of the nodes in the graph
Returns:
the dependency graph

dependsOn

fun dependsOn graph {src = src, dest = dest, attr = attr}
    : 'a graph -> {src : int, dest : int, attr : 'a} -> unit

Put a edge between the specified nodes. This function updates the graph.

Parameters:
graph
the dependency graph
src
the index of the node which depends on the dest.
dest
the index of the node which is depended on by the src.
attr
additional attributes of this dependency.
Returns:
unit

isDependsOn

fun isDependsOn graph {src = src, dest = dest}
    : 'a graph -> {src : int, dest : int} -> 'a option * bool

indicates whether there is a edge between the specified nodes.

Parameters:
graph
the dependency graph
src
the index of the node which may depend on the dest.
dest
the index of the node which may be depended on by the src.
Returns:
a pair of the additional attribute if there is a link and the boolean value which is true if there is a link.

getClosure

fun getClosure graph (traceFun, start)
    : 'a graph -> ('a -> bool) * int -> int list

get the closure of the dependency relation.

Parameters:
graph
the dependency graph
traceFun
a function which is given an attribute of a link and returns true if this link should be traced.
start
the index of the node of the start point of trace
Returns:
a list of indexes of nodes reachable from the start by tracing dependency links.

getClosureRev

val getClosureRev : 'a graph -> ('a -> bool) * int -> int list

the reverse version of the getClosure. This function trace links from the node which is depended on and to the node which depends on.


sort

fun sort graph traceFun : 'a graph -> ('a -> bool) -> int list

topological sort on the dependency graph

Parameters:
graph
the dependency graph
traceFun
a function which is given attribute of link and returns if this link should be traced.
Returns:
a list of node indexes sorted. The index A precedes the index B in this list if the node A depends on the node B.

 


Overview  Index  Help 
SMLDoc: Documentation generator for SML