graph:union normalize/dedupe test

This was already happening, but formally test and document it, since
it's a very useful property.

* src/graph.xsl (graph:union): Document dedupe behavior
* test/graph-test.xsl: Add test data
* test/graph.xspec: Add dedupe test for graph:union
master
Mike Gerwitz 2016-07-05 16:14:15 -04:00
parent bcf1e0457f
commit 641147cd8f
2 changed files with 30 additions and 0 deletions

View File

@ -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 )*" />

View File

@ -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 )" />