Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/graph.xsl5
-rw-r--r--test/graph-test.xsl25
2 files changed, 30 insertions, 0 deletions
diff --git a/src/graph.xsl b/src/graph.xsl
index 0a80861..6950c03 100644
--- a/src/graph.xsl
+++ b/src/graph.xsl
@@ -136,6 +136,11 @@
@end verbatim
@caption{(G₁ ∪ G₂ ∪ G₃)}
@end float
+
+ This function also removes duplicate vertices and edges,
+ so it can be used with a single (or multiple) graphs to normalize
+ and tidy things up.
+ Any unknown XML nodes are removed.
-->
<function name="graph:union" as="element( preproc:sym-deps )*">
<param name="graphs" as="element( preproc:sym-deps )*" />
diff --git a/test/graph-test.xsl b/test/graph-test.xsl
index 63cf618..e8f7b5b 100644
--- a/test/graph-test.xsl
+++ b/test/graph-test.xsl
@@ -169,6 +169,31 @@
</variable>
+<variable name="foo:graph-with-dupes" as="element( preproc:sym-deps )">
+ <preproc:sym-deps>
+ <preproc:sym-dep name="dup">
+ <preproc:sym-ref name="a" />
+ </preproc:sym-dep>
+
+ <preproc:sym-dep name="dup">
+ <preproc:sym-ref name="b" />
+ <preproc:sym-ref name="b" />
+ <preproc:sym-ref name="b" />
+ </preproc:sym-dep>
+ </preproc:sym-deps>
+</variable>
+
+
+<variable name="foo:graph-deduped" as="element( preproc:sym-deps )">
+ <preproc:sym-deps>
+ <preproc:sym-dep name="dup">
+ <preproc:sym-ref name="a" />
+ <preproc:sym-ref name="b" />
+ </preproc:sym-dep>
+ </preproc:sym-deps>
+</variable>
+
+
<function name="foo:lookup">
<param name="yield" as="element()" />
<param name="symbol" as="element( preproc:sym )" />