## graph-layout.pkg
#
# Some graph layout annotations.
#
# -- Allen Leung
# Compiled by:
#
src/lib/compiler/back/low/lib/visual.libstipulate
package mdv = mapped_digraph_view; # mapped_digraph_view is from
src/lib/graph/mapped-digraph-view.pkg package nt = note; # note is from
src/lib/src/note.pkg package odg = oop_digraph; # oop_digraph is from
src/lib/graph/oop-digraph.pkgherein
package graph_layout {
#
Format
= LABEL String
| COLOR String
| NODE_COLOR String
| EDGE_COLOR String
| TEXT_COLOR String
| ARROW_COLOR String
| BACKARROW_COLOR String
| BORDER_COLOR String
| BORDERLESS
| SHAPE String
| ALGORITHM String
| EDGEPATTERN String
| DIR
# For internal use only!
;
style = nt::make_notekind (THE (\\ _ = "STYLE"))
: nt::Notekind( List( Format ) );
Style (N,E,G) = # Here N,E,G stand stead for the types of client-package-supplied records associated with (respectively) nodes, edges and graphs.
{ edge: odg::Edge(E) -> List(Format),
node: odg::Node(N) -> List(Format),
graph: G -> List( Format )
};
Layout = odg::Digraph ( List(Format), List(Format), List(Format) );
fun make_layout { node_fn, edge_fn, info_fn } ggg
=
mdv::make_mapped_digraph_view node_fn edge_fn info_fn ggg;
fun make_layout' ggg
=
{ edge_color = [COLOR "red"];
make_layout { node_fn => \\ (i, _) = [LABEL (int::to_string i)],
edge_fn => \\ _ = edge_color,
info_fn => \\ _ = []
}
ggg;
};
};
end;