Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitm@lovullo.com>2016-07-05 16:14:57 -0400
committerMike Gerwitz <gerwitm@lovullo.com>2016-07-06 00:16:12 -0400
commite5da6f8ce10f9b7cd5e11ffe7a3ba4302ba6c216 (patch)
tree0b6424d2d57b408495af2c92bc18bc0db2a3d4a0 /src
parent641147cd8ff84755b640869e55c8be48cc566b31 (diff)
downloadtame-e5da6f8ce10f9b7cd5e11ffe7a3ba4302ba6c216.tar.gz
tame-e5da6f8ce10f9b7cd5e11ffe7a3ba4302ba6c216.tar.bz2
tame-e5da6f8ce10f9b7cd5e11ffe7a3ba4302ba6c216.zip
Add graph:make-from-vertices
* src/graph.xsl (graph:make-from-vertices): Added * test/graph-test.xsl (foo:graph-with-dupes): Added duplicate edges * test/graph.xspec: Added tests
Diffstat (limited to 'src')
-rw-r--r--src/graph.xsl24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/graph.xsl b/src/graph.xsl
index 6950c03..25fdad6 100644
--- a/src/graph.xsl
+++ b/src/graph.xsl
@@ -29,6 +29,7 @@
<import href="../hoxsl/src/apply.xsl" />
+
<!--
@node Dependency Graph
@section Dependency Graph
@@ -51,6 +52,29 @@
use the node QNames for type checks.}
-->
+
+<!--
+ Create a graph from the given vertex set @var{$vertices}.
+ The resulting graph will be normalized with duplicate vertices and
+ edges removed,
+ making it suitable for ad hoc graph generation.@c
+ @footnote{This is done by calling @ref{graph:union}.}
+-->
+<function name="graph:make-from-vertices"
+ as="element( preproc:sym-deps )">
+ <param name="vertices" as="element( preproc:sym-dep )*" />
+
+ <variable name="graph" as="element( preproc:sym-deps )">
+ <preproc:sym-deps>
+ <sequence select="$vertices" />
+ </preproc:sym-deps>
+ </variable>
+
+ <!-- dedupe/normalize -->
+ <sequence select="graph:union( $graph )" />
+</function>
+
+
<!--
Produce a new graph that is the transpose of
@var{$graph}@mdash{}that is,