Ammend merge: Misc stuff
[shapes.git] / doc / parts / types / hierarchical-graphs.sxml
blob032074db39a184e3bc4f97a26c6a44d601d9c916
1 <!-- This file is part of Shapes.                                           -->
2 <!--                                                                        -->
3 <!-- Shapes is free software: you can redistribute it and/or modify         -->
4 <!-- it under the terms of the GNU General Public License as published by   -->
5 <!-- the Free Software Foundation, either version 3 of the License, or      -->
6 <!-- any later version.                                                     -->
7 <!--                                                                        -->
8 <!-- Shapes is distributed in the hope that it will be useful,              -->
9 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of         -->
10 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          -->
11 <!-- GNU General Public License for more details.                           -->
12 <!--                                                                        -->
13 <!-- You should have received a copy of the GNU General Public License      -->
14 <!-- along with Shapes.  If not, see <http://www.gnu.org/licenses/>.        -->
15 <!--                                                                        -->
16 <!-- Copyright 2013, 2014 Henrik Tidefelt                                   -->
18 <section id="types/hierarchical-graphs">
19 <title>Hierarchical graphs</title>
20 <top>
21         <p>Hierarchical graphs have many things in common with the ordinary graphs, but at the same time definitely more complex.  To avoid introducing the complexity of hierarchical graphs in the presentation of <a id="types/graphs">types related to ordinary graph</a>, the current section collects all types that only relate to the hierarchical graphs.</p>
22 </top>
24   <coretype name="FlatGraphNode">
25                 <type-parameters>
26                         <parameter name="N">
27                                 <description>
28                                         <p>Type of node values.</p>
29                                 </description>
30                         </parameter>
31                         <parameter name="E">
32                                 <description>
33                                         <p>Type of edge values.</p>
34                                 </description>
35                         </parameter>
36                 </type-parameters>
37     <abstraction>
38       <p>The <self /> type is a reference to a node belonging to the flat graph of a hierarchical graph.</p>
39     </abstraction>
40     <isa>
41         <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
42     </isa>
43                 <see-also>
44                         <named-type name="Edge" /> <named-type name="Graph" /> <named-type name="NodeData" />
45                 </see-also>
46     <construction>
47     </construction>
48                 <fields>
49                         <type-field name="hierarchy_node">
50                                 <type><parameterized-type name="LeafNode"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type></type>
51                                 <description><p>The leaf node in a hierarchical graph mapping to the current node in the flat graph.</p></description>
52                         </type-field>
53                         <type-field name="key">
54                                 <type><named-type name="GraphKey" /></type>
55                                 <description><p>The key used to retrieve the <self /> from the <named-type name="Graph" />.</p></description>
56                         </type-field>
57                         <type-field name="partition">
58                                 <type><union-type><named-type name="GraphKey" /><named-type name="Void" /></union-type></type>
59                                 <description>
60                                         <p>Graph partition.  Unless <value-the-void />, the node will not be adjacent to other nodes in the same partition.</p>
61                                 </description>
62                         </type-field>
63                         <type-field name="index">
64                                 <type><named-type name="Integer" /></type>
65                                 <description><p>Each node in the graph has a unique value in a range starting from zero.  It is generally not identical to the <field name="key" /> even if all keys are of type <named-type name="Integer" />.</p></description>
66                         </type-field>
67                         <type-field name="u_degree">
68                                 <type><named-type name="Integer" /></type>
69                                 <description><p>Number of undirected edges incident to the node.  Loop edges count twice.</p></description>
70                         </type-field>
71                         <type-field name="d_degree_in">
72                                 <type><named-type name="Integer" /></type>
73                                 <description><p>Number of directed edges with target at the node.</p></description>
74                         </type-field>
75                         <type-field name="d_degree_out">
76                                 <type><named-type name="Integer" /></type>
77                                 <description><p>Number of directed edges with source at the node.</p></description>
78                         </type-field>
79                         <type-field name="d_degree">
80                                 <type><named-type name="Integer" /></type>
81                                 <description><p>The sum of <field name="d_degree_in" /> and <field name="d_degree_out" />.  Note that loop edges will count twice.</p></description>
82                         </type-field>
83                         <type-field name="degree">
84                                 <type><named-type name="Integer" /></type>
85                                 <description><p>The sum of <field name="u_degree" /> and <field name="d_degree" />.</p></description>
86                         </type-field>
87                         <type-field name="u_loop_count">
88                                 <type><named-type name="Integer" /></type>
89                                 <description><p>Number of undirected loop edges incident to the node.  Each loop counts once.</p></description>
90                         </type-field>
91                         <type-field name="d_loop_count">
92                                 <type><named-type name="Integer" /></type>
93                                 <description><p>Number of directed loop edges incident to the node.  Each loop counts once.</p></description>
94                         </type-field>
95                         <type-field name="loop_count">
96                                 <type><named-type name="Integer" /></type>
97                                 <description><p>The sum of <field name="u_loop_count"/> and <field name="d_loop_count"/>.</p></description>
98                         </type-field>
99                         <type-method name="u_edges">
100                                 <function>
101                                         <case>
102                                                 <arguments>
103                                                         <arg identifier="loops">
104                                                                 <type><named-type name="Boolean"/></type>
105                                                                 <default><value-the-true /></default>
106                                                         </arg>
107                                                 </arguments>
108                                                 <result>
109                                                         <type>
110                                                                 <parameterized-type name="Seq">
111                                                                         <parameterized-type name="UEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
112                                                                 </parameterized-type>
113                                                         </type>
114                                                 </result>
115                                                 <description>
116                                                         <p>Finds all incident undirected edges.  Loops can be excluded by setting <arg name="loops" /> to <value-the-false />.  Loop edges are only included once.</p>
117                                                 </description>
118                                         </case>
119                                 </function>
120                         </type-method>
121                         <type-method name="u_multiedges">
122                                 <function>
123                                         <case>
124                                                 <arguments>
125                                                         <arg identifier="loops">
126                                                                 <type><named-type name="Boolean"/></type>
127                                                                 <default><value-the-true /></default>
128                                                         </arg>
129                                                 </arguments>
130                                                 <result>
131                                                         <type>
132                                                                 <parameterized-type name="Seq">
133                                                                         <parameterized-type name="UMultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
134                                                                 </parameterized-type>
135                                                         </type>
136                                                 </result>
137                                                 <description>
138                                                         <p>Similar to <field name="u_edges" />, but with parallel edges grouped as multiedges.</p>
139                                                 </description>
140                                         </case>
141                                 </function>
142                         </type-method>
143                         <type-method name="d_edges_in">
144                                 <function>
145                                         <case>
146                                                 <arguments>
147                                                         <arg identifier="loops">
148                                                                 <type><named-type name="Boolean"/></type>
149                                                                 <default><value-the-true /></default>
150                                                         </arg>
151                                                 </arguments>
152                                                 <result>
153                                                         <type>
154                                                                 <parameterized-type name="Seq">
155                                                                         <parameterized-type name="DEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
156                                                                 </parameterized-type>
157                                                         </type>
158                                                 </result>
159                                                 <description>
160                                                         <p>Finds all incident directed edges with target at the current node.  Loops can be excluded by setting <arg name="loops" /> to <value-the-false />.</p>
161                                                 </description>
162                                         </case>
163                                 </function>
164                         </type-method>
165                         <type-method name="d_multiedges_in">
166                                 <function>
167                                         <case>
168                                                 <arguments>
169                                                         <arg identifier="loops">
170                                                                 <type><named-type name="Boolean"/></type>
171                                                                 <default><value-the-true /></default>
172                                                         </arg>
173                                                 </arguments>
174                                                 <result>
175                                                         <type>
176                                                                 <parameterized-type name="Seq">
177                                                                         <parameterized-type name="DMultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
178                                                                 </parameterized-type>
179                                                         </type>
180                                                 </result>
181                                                 <description>
182                                                         <p>Similar to <field name="d_edges_in" />, but with parallel edges grouped as multiedges.</p>
183                                                 </description>
184                                         </case>
185                                 </function>
186                         </type-method>
187                         <type-method name="d_edges_out">
188                                 <function>
189                                         <case>
190                                                 <arguments>
191                                                         <arg identifier="loops">
192                                                                 <type><named-type name="Boolean"/></type>
193                                                                 <default><value-the-true /></default>
194                                                         </arg>
195                                                 </arguments>
196                                                 <result>
197                                                         <type>
198                                                                 <parameterized-type name="Seq">
199                                                                         <parameterized-type name="DEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
200                                                                 </parameterized-type>
201                                                         </type>
202                                                 </result>
203                                                 <description>
204                                                         <p>Finds all incident directed edges with source at the curret node.  Loops can be excluded by setting <arg name="loops" /> to <value-the-false />.</p>
205                                                 </description>
206                                         </case>
207                                 </function>
208                         </type-method>
209                         <type-method name="d_multiedges_out">
210                                 <function>
211                                         <case>
212                                                 <arguments>
213                                                         <arg identifier="loops">
214                                                                 <type><named-type name="Boolean"/></type>
215                                                                 <default><value-the-true /></default>
216                                                         </arg>
217                                                 </arguments>
218                                                 <result>
219                                                         <type>
220                                                                 <parameterized-type name="Seq">
221                                                                         <parameterized-type name="DMultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
222                                                                 </parameterized-type>
223                                                         </type>
224                                                 </result>
225                                                 <description>
226                                                         <p>Similar to <field name="d_edges_out" />, but with parallel edges grouped as multiedges.</p>
227                                                 </description>
228                                         </case>
229                                 </function>
230                         </type-method>
231                         <type-method name="edges_in">
232                                 <function>
233                                         <case>
234                                                 <arguments>
235                                                         <arg identifier="loops">
236                                                                 <type><named-type name="Boolean"/></type>
237                                                                 <default><value-the-true /></default>
238                                                         </arg>
239                                                 </arguments>
240                                                 <result>
241                                                         <type>
242                                                                 <parameterized-type name="Seq">
243                                                                         <parameterized-type name="Edge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
244                                                                 </parameterized-type>
245                                                         </type>
246                                                 </result>
247                                                 <description>
248                                                         <p>The union of edges obtained with <field name="u_edges" /> and <field name="d_edges_in" />.</p>
249                                                 </description>
250                                         </case>
251                                 </function>
252                         </type-method>
253                         <type-method name="multiedges_in">
254                                 <function>
255                                         <case>
256                                                 <arguments>
257                                                         <arg identifier="loops">
258                                                                 <type><named-type name="Boolean"/></type>
259                                                                 <default><value-the-true /></default>
260                                                         </arg>
261                                                 </arguments>
262                                                 <result>
263                                                         <type>
264                                                                 <parameterized-type name="Seq">
265                                                                         <parameterized-type name="MultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
266                                                                 </parameterized-type>
267                                                         </type>
268                                                 </result>
269                                                 <description>
270                                                         <p>Similar to <field name="edges_in" />, but with parallel edges grouped as multiedges.</p>
271                                                 </description>
272                                         </case>
273                                 </function>
274                         </type-method>
275                         <type-method name="edges_out">
276                                 <function>
277                                         <case>
278                                                 <arguments>
279                                                         <arg identifier="loops">
280                                                                 <type><named-type name="Boolean"/></type>
281                                                                 <default><value-the-true /></default>
282                                                         </arg>
283                                                 </arguments>
284                                                 <result>
285                                                         <type>
286                                                                 <parameterized-type name="Seq">
287                                                                         <parameterized-type name="Edge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
288                                                                 </parameterized-type>
289                                                         </type>
290                                                 </result>
291                                                 <description>
292                                                         <p>The union of edges obtained with <field name="u_edges" /> and <field name="d_edges_out" />.</p>
293                                                 </description>
294                                         </case>
295                                 </function>
296                         </type-method>
297                         <type-method name="multiedges_out">
298                                 <function>
299                                         <case>
300                                                 <arguments>
301                                                         <arg identifier="loops">
302                                                                 <type><named-type name="Boolean"/></type>
303                                                                 <default><value-the-true /></default>
304                                                         </arg>
305                                                 </arguments>
306                                                 <result>
307                                                         <type>
308                                                                 <parameterized-type name="Seq">
309                                                                         <parameterized-type name="MultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
310                                                                 </parameterized-type>
311                                                         </type>
312                                                 </result>
313                                                 <description>
314                                                         <p>Similar to <field name="edges_out" />, but with parallel edges grouped as multiedges.</p>
315                                                 </description>
316                                         </case>
317                                 </function>
318                         </type-method>
319                         <type-method name="edges">
320                                 <function>
321                                         <case>
322                                                 <arguments>
323                                                         <arg identifier="loops">
324                                                                 <type><named-type name="Boolean"/></type>
325                                                                 <default><value-the-true /></default>
326                                                         </arg>
327                                                 </arguments>
328                                                 <result>
329                                                         <type>
330                                                                 <parameterized-type name="Seq">
331                                                                         <parameterized-type name="Edge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
332                                                                 </parameterized-type>
333                                                         </type>
334                                                 </result>
335                                                 <description>
336                                                         <p>The results of <field name="u_edges" />, <field name="d_edges_in" />, and <field name="d_edges_out" /> taken together, except for directed loops that are only included once.</p>
337                                                 </description>
338                                         </case>
339                                 </function>
340                         </type-method>
341                         <type-method name="multiedges">
342                                 <function>
343                                         <case>
344                                                 <arguments>
345                                                         <arg identifier="loops">
346                                                                 <type><named-type name="Boolean"/></type>
347                                                                 <default><value-the-true /></default>
348                                                         </arg>
349                                                 </arguments>
350                                                 <result>
351                                                         <type>
352                                                                 <parameterized-type name="Seq">
353                                                                         <parameterized-type name="MultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
354                                                                 </parameterized-type>
355                                                         </type>
356                                                 </result>
357                                                 <description>
358                                                         <p>Similar to <field name="multiedges" />, but with parallel edges grouped as multiedges.</p>
359                                                 </description>
360                                         </case>
361                                 </function>
362                         </type-method>
363                         <type-method name="u_loops">
364                                 <function>
365                                         <case>
366                                                 <arguments>
367                                                 </arguments>
368                                                 <result>
369                                                         <type>
370                                                                 <parameterized-type name="Seq">
371                                                                         <parameterized-type name="UEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
372                                                                 </parameterized-type>
373                                                         </type>
374                                                 </result>
375                                                 <description>
376                                                         <p>All undirected loop edges incident to the node.  Each loop edge is only included once.</p>
377                                                 </description>
378                                         </case>
379                                 </function>
380                         </type-method>
381                         <type-method name="u_multiloops">
382                                 <function>
383                                         <case>
384                                                 <arguments>
385                                                 </arguments>
386                                                 <result>
387                                                         <type>
388                                                                 <parameterized-type name="Seq">
389                                                                         <parameterized-type name="UMultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
390                                                                 </parameterized-type>
391                                                         </type>
392                                                 </result>
393                                                 <description>
394                                                         <p>Similar to <field name="u_loops" />, but with parallel edges grouped as multiedges.  Note that the returned sequence will contain at most one element.</p>
395                                                 </description>
396                                         </case>
397                                 </function>
398                         </type-method>
399                         <type-method name="d_loops">
400                                 <function>
401                                         <case>
402                                                 <arguments>
403                                                 </arguments>
404                                                 <result>
405                                                         <type>
406                                                                 <parameterized-type name="Seq">
407                                                                         <parameterized-type name="DEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
408                                                                 </parameterized-type>
409                                                         </type>
410                                                 </result>
411                                                 <description>
412                                                         <p>All directed loop edges incident to the node.  Each loop edge is only included once.</p>
413                                                 </description>
414                                         </case>
415                                 </function>
416                         </type-method>
417                         <type-method name="d_multiloops">
418                                 <function>
419                                         <case>
420                                                 <arguments>
421                                                 </arguments>
422                                                 <result>
423                                                         <type>
424                                                                 <parameterized-type name="Seq">
425                                                                         <parameterized-type name="DMultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
426                                                                 </parameterized-type>
427                                                         </type>
428                                                 </result>
429                                                 <description>
430                                                         <p>Similar to <field name="d_loops" />, but with parallel edges grouped as multiedges.  Note that the returned sequence will contain at most one element.</p>
431                                                 </description>
432                                         </case>
433                                 </function>
434                         </type-method>
435                         <type-method name="loops">
436                                 <function>
437                                         <case>
438                                                 <arguments>
439                                                 </arguments>
440                                                 <result>
441                                                         <type>
442                                                                 <parameterized-type name="Seq">
443                                                                         <parameterized-type name="Edge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
444                                                                 </parameterized-type>
445                                                         </type>
446                                                 </result>
447                                                 <description>
448                                                         <p>The union of edges obtained with <field name="u_loops" /> and <field name="d_loops" />.</p>
449                                                 </description>
450                                         </case>
451                                 </function>
452                         </type-method>
453                         <type-method name="multiloops">
454                                 <function>
455                                         <case>
456                                                 <arguments>
457                                                 </arguments>
458                                                 <result>
459                                                         <type>
460                                                                 <parameterized-type name="Seq">
461                                                                         <parameterized-type name="MultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
462                                                                 </parameterized-type>
463                                                         </type>
464                                                 </result>
465                                                 <description>
466                                                         <p>The union of multiedges obtained with <field name="u_multiloops" /> and <field name="d_multiloops" />.</p>
467                                                 </description>
468                                         </case>
469                                 </function>
470                         </type-method>
471                         <type-method name="trace">
472                                 <function>
473                                         <case>
474                                                 <arguments>
475                                                         <arg identifier="edge">
476                                                                 <type>
477                                                                         <union-type>
478                                                                                 <parameterized-type name="Edge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
479                                                                                 <parameterized-type name="MultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
480                                                                         </union-type>
481                                                                 </type>
482                                                         </arg>
483                                                 </arguments>
484                                                 <result>
485                                                         <type>
486                                                                 <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
487                                                         </type>
488                                                 </result>
489                                                 <description>
490                                                         <p>Get the <named-type name="Node" /> on the other side of <arg name="edge" />.  It is an error if <arg name="edge" /> is not incident to the current node, or if <arg name="edge"/> is directed but does not have the current node as source.</p>
491                                                 </description>
492                                         </case>
493                                 </function>
494                         </type-method>
495                         <type-method name="backtrace">
496                                 <function>
497                                         <case>
498                                                 <arguments>
499                                                         <arg identifier="edge">
500                                                                 <type>
501                                                                         <union-type>
502                                                                                 <parameterized-type name="Edge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
503                                                                                 <parameterized-type name="MultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
504                                                                         </union-type>
505                                                                 </type>
506                                                         </arg>
507                                                 </arguments>
508                                                 <result>
509                                                         <type>
510                                                                 <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
511                                                         </type>
512                                                 </result>
513                                                 <description>
514                                                         <p>Get the <named-type name="Node" /> on the other side of <arg name="edge" />.  It is an error if <arg name="edge" /> is not incident to the current node, or if <arg name="edge"/> is directed but does not have the current node as target.</p>
515                                                 </description>
516                                         </case>
517                                 </function>
518                         </type-method>
519                         <type-method name="u_neighbors">
520                                 <function>
521                                         <case>
522                                                 <arguments>
523                                                         <arg identifier="loops">
524                                                                 <type><named-type name="Boolean"/></type>
525                                                                 <default><value-the-true /></default>
526                                                         </arg>
527                                                         <arg identifier="parallel">
528                                                                 <type><named-type name="Boolean"/></type>
529                                                                 <default><value-the-true /></default>
530                                                         </arg>
531                                                 </arguments>
532                                                 <result>
533                                                         <type>
534                                                                 <parameterized-type name="Seq">
535                                                                         <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
536                                                                 </parameterized-type>
537                                                         </type>
538                                                 </result>
539                                                 <description>
540                                                         <p>All nodes on the other side of an undirected edge incident to the current node.  Loop edges count twice, and each parallel edge counts once.  Loops can be excluded by setting <arg name="loops" /> to <value-the-false />, and setting <arg name="parallel"/> to <value-the-false /> gives only unique nodes in the result.</p>
541                                                 </description>
542                                         </case>
543                                 </function>
544                         </type-method>
545                         <type-method name="d_neighbors_in">
546                                 <function>
547                                         <case>
548                                                 <arguments>
549                                                         <arg identifier="loops">
550                                                                 <type><named-type name="Boolean"/></type>
551                                                                 <default><value-the-true /></default>
552                                                         </arg>
553                                                         <arg identifier="parallel">
554                                                                 <type><named-type name="Boolean"/></type>
555                                                                 <default><value-the-true /></default>
556                                                         </arg>
557                                                 </arguments>
558                                                 <result>
559                                                         <type>
560                                                                 <parameterized-type name="Seq">
561                                                                         <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
562                                                                 </parameterized-type>
563                                                         </type>
564                                                 </result>
565                                                 <description>
566                                                         <p>All nodes on the other side of a directed edge with target at the current node.  Each parallel edge counts once, as do loop edges.  Loops can be excluded by setting <arg name="loops" /> to <value-the-false />, and setting <arg name="parallel"/> to <value-the-false /> gives only unique nodes in the result.</p>
567                                                 </description>
568                                         </case>
569                                 </function>
570                         </type-method>
571                         <type-method name="d_neighbors_out">
572                                 <function>
573                                         <case>
574                                                 <arguments>
575                                                         <arg identifier="loops">
576                                                                 <type><named-type name="Boolean"/></type>
577                                                                 <default><value-the-true /></default>
578                                                         </arg>
579                                                         <arg identifier="parallel">
580                                                                 <type><named-type name="Boolean"/></type>
581                                                                 <default><value-the-true /></default>
582                                                         </arg>
583                                                 </arguments>
584                                                 <result>
585                                                         <type>
586                                                                 <parameterized-type name="Seq">
587                                                                         <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
588                                                                 </parameterized-type>
589                                                         </type>
590                                                 </result>
591                                                 <description>
592                                                         <p>All nodes on the other side of a directed edge with source at the current node.  Each parallel edge counts once, as do loop edges.  Loops can be excluded by setting <arg name="loops" /> to <value-the-false />, and setting <arg name="parallel"/> to <value-the-false /> gives only unique nodes in the result.</p>
593                                                 </description>
594                                         </case>
595                                 </function>
596                         </type-method>
597                         <type-method name="neighbors_in">
598                                 <function>
599                                         <case>
600                                                 <arguments>
601                                                         <arg identifier="loops">
602                                                                 <type><named-type name="Boolean"/></type>
603                                                                 <default><value-the-true /></default>
604                                                         </arg>
605                                                         <arg identifier="parallel">
606                                                                 <type><named-type name="Boolean"/></type>
607                                                                 <default><value-the-true /></default>
608                                                         </arg>
609                                                 </arguments>
610                                                 <result>
611                                                         <type>
612                                                                 <parameterized-type name="Seq">
613                                                                         <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
614                                                                 </parameterized-type>
615                                                         </type>
616                                                 </result>
617                                                 <description>
618                                                         <p>The results of <field name="u_neighbors"/> and <field name="d_neighbors_in"/> taken together.  Loops can be excluded by setting <arg name="loops" /> to <value-the-false />, and setting <arg name="parallel"/> to <value-the-false /> gives only unique nodes in the result.</p>
619                                                 </description>
620                                         </case>
621                                 </function>
622                         </type-method>
623                         <type-method name="neighbors_out">
624                                 <function>
625                                         <case>
626                                                 <arguments>
627                                                         <arg identifier="loops">
628                                                                 <type><named-type name="Boolean"/></type>
629                                                                 <default><value-the-true /></default>
630                                                         </arg>
631                                                         <arg identifier="parallel">
632                                                                 <type><named-type name="Boolean"/></type>
633                                                                 <default><value-the-true /></default>
634                                                         </arg>
635                                                 </arguments>
636                                                 <result>
637                                                         <type>
638                                                                 <parameterized-type name="Seq">
639                                                                         <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
640                                                                 </parameterized-type>
641                                                         </type>
642                                                 </result>
643                                                 <description>
644                                                         <p>The results of <field name="u_neighbors"/> and <field name="d_neighbors_out"/> taken together.  Loops can be excluded by setting <arg name="loops" /> to <value-the-false />, and setting <arg name="parallel"/> to <value-the-false /> gives only unique nodes in the result.</p>
645                                                 </description>
646                                         </case>
647                                 </function>
648                         </type-method>
649                         <type-method name="neighbors">
650                                 <function>
651                                         <case>
652                                                 <arguments>
653                                                         <arg identifier="loops">
654                                                                 <type><named-type name="Boolean"/></type>
655                                                                 <default><value-the-true /></default>
656                                                         </arg>
657                                                         <arg identifier="parallel">
658                                                                 <type><named-type name="Boolean"/></type>
659                                                                 <default><value-the-true /></default>
660                                                         </arg>
661                                                 </arguments>
662                                                 <result>
663                                                         <type>
664                                                                 <parameterized-type name="Seq">
665                                                                         <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
666                                                                 </parameterized-type>
667                                                         </type>
668                                                 </result>
669                                                 <description>
670                                                         <p>The results of <field name="u_neighbors"/>, <field name="d_neighbors_in"/>, and <field name="d_neighbors_out"/> taken together.  Loops can be excluded by setting <arg name="loops" /> to <value-the-false />, and setting <arg name="parallel"/> to <value-the-false /> gives only unique nodes in the result.</p>
671                                                 </description>
672                                         </case>
673                                 </function>
674                         </type-method>
675                         <type-method name="get_graph">
676                                 <function>
677                                         <case>
678                                                 <arguments>
679                                                 </arguments>
680                                                 <result>
681                                                         <type>
682                                                                 <parameterized-type name="Graph">
683                                                                         <parameter-type name="N"/><parameter-type name="E"/>
684                                                                 </parameterized-type>
685                                                         </type>
686                                                 </result>
687                                                 <description>
688                                                         <p>Get the graph to which the node belongs.</p>
689                                                 </description>
690                                         </case>
691                                 </function>
692                         </type-method>
693                 </fields>
694   </coretype>
696   <coretype name="HierarchicalEdge">
697                 <type-parameters>
698                         <parameter name="N">
699                                 <description>
700                                         <p>Type of node values.</p>
701                                 </description>
702                         </parameter>
703                         <parameter name="E">
704                                 <description>
705                                         <p>Type of edge values.</p>
706                                 </description>
707                         </parameter>
708                 </type-parameters>
709     <abstraction>
710       <p>The <self /> type is a reference to an edge belonging to a particular graph.  It gives constant time access to the referenced graph edge.</p>
711     </abstraction>
712                 <see-also>
713                         <named-type name="Node" /> <named-type name="Graph" /> <named-type name="EdgeData" />
714                 </see-also>
715     <construction>
716     </construction>
717                 <fields>
718                         <type-field name="directed?">
719                                 <type><named-type name="Boolean" /></type>
720                                 <description><p>Whether the edge is directed or undirected.</p></description>
721                         </type-field>
722                         <type-field name="source">
723                                 <type><parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type></type>
724                                 <description><p>The source of a directed edge, or one of the nodes incident to an undirected edge.  <field name="source" /> and <field name="target"/> are only identical for undirected edges in case of loops.</p></description>
725                         </type-field>
726                         <type-field name="target">
727                                 <type><parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type></type>
728                                 <description><p>The target of a directed edge, or one of the nodes incident to an undirected edge.  <field name="source" /> and <field name="target"/> are only identical for undirected edges in case of loops.</p></description>
729                         </type-field>
730                         <type-field name="value">
731                                 <type><parameter-type name="E" /></type>
732                                 <description><p>The value associated with the edge.</p></description>
733                         </type-field>
734                         <type-field name="label">
735                                 <type><named-type name="GraphKey" /></type>
736                                 <description><p>A label which may be used in combination with <field name="source" /> and <field name="target" /> to identify the edge.  Note that, in general, the label does not have to be unique, even for a given pair of <field name="source" /> and <field name="target" />.</p></description>
737                         </type-field>
738                         <type-field name="index">
739                                 <type><named-type name="Integer" /></type>
740                                 <description><p>Each edge in the graph has a unique value in a range starting from zero.</p></description>
741                         </type-field>
742                         <type-method name="get_graph">
743                                 <function>
744                                         <case>
745                                                 <arguments>
746                                                 </arguments>
747                                                 <result>
748                                                         <type>
749                                                                 <parameterized-type name="Graph">
750                                                                         <parameter-type name="N"/><parameter-type name="E"/>
751                                                                 </parameterized-type>
752                                                         </type>
753                                                 </result>
754                                                 <description>
755                                                         <p>Get the graph to which the edge belongs.</p>
756                                                 </description>
757                                         </case>
758                                 </function>
759                         </type-method>
760                 </fields>
761   </coretype>
763   <coretype name="UHierarchicalEdge">
764                 <type-parameters>
765                         <parameter name="N">
766                                 <description>
767                                         <p>Type of node values.</p>
768                                 </description>
769                         </parameter>
770                         <parameter name="E">
771                                 <description>
772                                         <p>Type of edge values.</p>
773                                 </description>
774                         </parameter>
775                 </type-parameters>
776                 <abstraction>
777                         <p>An undirected edge.</p>
778                 </abstraction>
779                 <definition>
780                         <intersection-type>
781                                 <parameterized-type name="HierarchicalEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
782                                 <structure-type>
783                                         <field name="directed?">
784                                                 <type><singleton-type><value-the-false /></singleton-type></type>
785                                         </field>
786                                 </structure-type>
787                         </intersection-type>
788                 </definition>
789   </coretype>
791   <coretype name="DHierarchicalEdge">
792                 <type-parameters>
793                         <parameter name="N">
794                                 <description>
795                                         <p>Type of node values.</p>
796                                 </description>
797                         </parameter>
798                         <parameter name="E">
799                                 <description>
800                                         <p>Type of edge values.</p>
801                                 </description>
802                         </parameter>
803                 </type-parameters>
804                 <abstraction>
805                         <p>A directed edge.</p>
806                 </abstraction>
807                 <definition>
808                         <intersection-type>
809                                 <parameterized-type name="HierarchicalEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
810                                 <structure-type>
811                                         <field name="directed?">
812                                                 <type><singleton-type><value-the-true /></singleton-type></type>
813                                         </field>
814                                 </structure-type>
815                         </intersection-type>
816                 </definition>
817   </coretype>
819   <coretype name="MetaEdge">
820                 <type-parameters>
821                         <parameter name="N">
822                                 <description>
823                                         <p>Type of node values.</p>
824                                 </description>
825                         </parameter>
826                         <parameter name="E">
827                                 <description>
828                                         <p>Type of edge values.</p>
829                                 </description>
830                         </parameter>
831                 </type-parameters>
832     <abstraction>
833       <p>The <self /> type is set of parallel edges.  It provides a simplified way of working with multigraphs when one is not interested in the multiplicity of parallel edges.  Two edges (compare <named-type name="Edge" />) are parallel if and only if they are both directed or both undirected, and have the same source and target nodes.</p>
834     </abstraction>
835                 <see-also>
836                         <named-type name="MultiEdge" /> <named-type name="HierarchicalGraph" />
837                 </see-also>
838     <construction>
839     </construction>
840                 <fields>
841                         <type-field name="directed?">
842                                 <type><named-type name="Boolean" /></type>
843                                 <description><p>Whether the parallel edges are directed or undirected.</p></description>
844                         </type-field>
845                         <type-field name="source">
846                                 <type><parameterized-type name="MetaNode"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type></type>
847                                 <description><p>The common source node of the parallel edges.</p></description>
848                         </type-field>
849                         <type-field name="target">
850                                 <type><parameterized-type name="MetaNode"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type></type>
851                                 <description><p>The common target node of the parallel edges.</p></description>
852                         </type-field>
853                         <type-field name="count">
854                                 <type><named-type name="Integer" /></type>
855                                 <description><p>The number of contained hierarchical edges.  That is, the length of <field name="edges" />, which is always positive.</p></description>
856                         </type-field>
857                         <type-field name="edges">
858                                 <type>
859                                         <parameterized-type name="Seq">
860                                                 <parameterized-type name="HierarchicalEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
861                                         </parameterized-type>
862                                 </type>
863                                 <description>
864                                         <p>The individual edges, ordered by their <field name="index"/>.</p>
865                                         <p>There is always at least one edge in the sequence.</p>
866                                 </description>
867                         </type-field>
868                         <type-field name="u_edges">
869                                 <type>
870                                         <parameterized-type name="Seq">
871                                                 <parameterized-type name="UHierarchicalEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
872                                         </parameterized-type>
873                                 </type>
874                                 <description><p>Identical to <field name="edges" />, except that it is only allowed when the contained edges are undirected.</p></description>
875                         </type-field>
876                         <type-field name="d_edges">
877                                 <type>
878                                         <parameterized-type name="Seq">
879                                                 <parameterized-type name="DHierarchicalEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
880                                         </parameterized-type>
881                                 </type>
882                                 <description><p>Identical to <field name="edges" />, except that it is only allowed when the contained edges are directed.</p></description>
883                         </type-field>
884                         <type-method name="get_graph">
885                                 <function>
886                                         <case>
887                                                 <arguments>
888                                                 </arguments>
889                                                 <result>
890                                                         <type>
891                                                                 <parameterized-type name="HierarchicalGraph">
892                                                                         <parameter-type name="N"/><parameter-type name="E"/>
893                                                                 </parameterized-type>
894                                                         </type>
895                                                 </result>
896                                                 <description>
897                                                         <p>Get the hierarchical graph to which the metaedge belongs.</p>
898                                                 </description>
899                                         </case>
900                                 </function>
901                         </type-method>
902                 </fields>
903   </coretype>
905   <coretype name="UMetaEdge">
906                 <type-parameters>
907                         <parameter name="N">
908                                 <description>
909                                         <p>Type of node values.</p>
910                                 </description>
911                         </parameter>
912                         <parameter name="E">
913                                 <description>
914                                         <p>Type of edge values.</p>
915                                 </description>
916                         </parameter>
917                 </type-parameters>
918                 <abstraction>
919                         <p>An undirected metaedge.</p>
920                 </abstraction>
921                 <definition>
922                         <intersection-type>
923                                 <parameterized-type name="MetaEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
924                                 <structure-type>
925                                         <field name="directed?">
926                                                 <type><singleton-type><value-the-false /></singleton-type></type>
927                                         </field>
928                                 </structure-type>
929                         </intersection-type>
930                 </definition>
931   </coretype>
933   <coretype name="DMetaEdge">
934                 <type-parameters>
935                         <parameter name="N">
936                                 <description>
937                                         <p>Type of node values.</p>
938                                 </description>
939                         </parameter>
940                         <parameter name="E">
941                                 <description>
942                                         <p>Type of edge values.</p>
943                                 </description>
944                         </parameter>
945                 </type-parameters>
946                 <abstraction>
947                         <p>A directed metaedge.</p>
948                 </abstraction>
949                 <definition>
950                         <intersection-type>
951                                 <parameterized-type name="MetaEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
952                                 <structure-type>
953                                         <field name="directed?">
954                                                 <type><singleton-type><value-the-true /></singleton-type></type>
955                                         </field>
956                                 </structure-type>
957                         </intersection-type>
958                 </definition>
959   </coretype>
961   <coretype name="Graph">
962                 <type-parameters>
963                         <parameter name="N">
964                                 <description>
965                                         <p>Type of node values.</p>
966                                 </description>
967                         </parameter>
968                         <parameter name="E">
969                                 <description>
970                                         <p>Type of edge values.</p>
971                                 </description>
972                         </parameter>
973                 </type-parameters>
974     <abstraction>
975       <p>Graph of nodes and edges.</p>
976     </abstraction>
977                 <see-also>
978                         <named-type name="Walk" />
979                 </see-also>
980     <construction>
981     </construction>
982                 <fields>
983                         <type-field name="undirected?">
984                                 <type><named-type name="Boolean"/></type>
985                                 <description><p>Whether <em>directed</em> edges are <em>not</em> allowed in the graph's domain.</p></description>
986                         </type-field>
987                         <type-field name="directed?">
988                                 <type><named-type name="Boolean"/></type>
989                                 <description><p>Whether <em>undirected</em> edges are <em>not</em> allowed in the graph's domain.</p></description>
990                         </type-field>
991                         <type-field name="mixed?">
992                                 <type><named-type name="Boolean"/></type>
993                                 <description><p>Whether both undirected and directed edges are allowed in the graph's domain.  That is, the graph's domain is neither directed nor undirected.</p></description>
994                         </type-field>
995                         <type-field name="loops?">
996                                 <type><named-type name="Boolean"/></type>
997                                 <description><p>Whether loop edges are allowed in the graph's domain.</p></description>
998                         </type-field>
999                         <type-field name="parallel?">
1000                                 <type><named-type name="Boolean"/></type>
1001                                 <description><p>Whether parallel edges are allowed in the graph's domain.</p></description>
1002                         </type-field>
1003                         <type-field name="partitioned?">
1004                                 <type><named-type name="Boolean"/></type>
1005                                 <description><p>Whether the graph's domain requires each node to belong to a partition.</p></description>
1006                         </type-field>
1008                         <type-field name="key_is_index?">
1009                                 <type><named-type name="Boolean"/></type>
1010                                 <description><p>Whether node keys coincide with node indices.</p></description>
1011                         </type-field>
1012                         <type-field name="key_is_range?">
1013                                 <type><named-type name="Boolean"/></type>
1014                                 <description><p>Whether node keys coincide with node indices plus <field name="key_offset" />.</p></description>
1015                         </type-field>
1016                         <type-field name="key_offset">
1017                                 <type><named-type name="Integer"/></type>
1018                                 <description><p>Node key of node with index zero.  It is an error to access this field unless <field name="key_is_range?" />.</p></description>
1019                         </type-field>
1020                         <type-field name="partition_count">
1021                                 <type><named-type name="Integer"/></type>
1022                                 <description><p>Number of partitions, that is, the length of <field name="partitions" />.  Note that a graph without any partitions may still contain nodes as long as it is not <field name="partitioned?"/>.</p></description>
1023                         </type-field>
1024                         <type-field name="partitions">
1025                                 <type>
1026                                         <parameterized-type name="Seq">
1027                                                 <named-type name="GraphKey" />
1028                                         </parameterized-type>
1029                                 </type>
1030                                 <description><p>The keys identifying the partitions of the graph, or empty if the graph is not <field name="partitioned?" />.</p></description>
1031                         </type-field>
1033                         <type-field name="node_count">
1034                                 <type><named-type name="Integer"/></type>
1035                                 <description><p>Number of nodes.</p></description>
1036                         </type-field>
1037                         <type-field name="u_edge_count">
1038                                 <type><named-type name="Integer"/></type>
1039                                 <description><p>Number of undirected edges, including loop edges.</p></description>
1040                         </type-field>
1041                         <type-field name="d_edge_count">
1042                                 <type><named-type name="Integer"/></type>
1043                                 <description><p>Number of directed edges, including loop edges.</p></description>
1044                         </type-field>
1045                         <type-field name="edge_count">
1046                                 <type><named-type name="Integer"/></type>
1047                                 <description><p>The sum of <field name="u_edge_count"/> and <field name="d_edge_count"/>.</p></description>
1048                         </type-field>
1049                         <type-field name="u_loop_count">
1050                                 <type><named-type name="Integer"/></type>
1051                                 <description><p>Number of undirected loop edges.</p></description>
1052                         </type-field>
1053                         <type-field name="d_loop_count">
1054                                 <type><named-type name="Integer"/></type>
1055                                 <description><p>Number of directed loop edges.</p></description>
1056                         </type-field>
1057                         <type-field name="loop_count">
1058                                 <type><named-type name="Integer"/></type>
1059                                 <description><p>The sum of <field name="u_loop_count"/> and <field name="d_loop_count"/>.</p></description>
1060                         </type-field>
1061                         <type-field name="nodes">
1062                                 <type>
1063                                         <parameterized-type name="Seq">
1064                                                 <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1065                                         </parameterized-type>
1066                                 </type>
1067                                 <description><p>All nodes in the graph, with each node appearing at the position given by its <field name="index"/>.</p></description>
1068                         </type-field>
1069                         <type-field name="u_edges">
1070                                 <type>
1071                                         <parameterized-type name="Seq">
1072                                                 <parameterized-type name="UEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1073                                         </parameterized-type>
1074                                 </type>
1075                                 <description><p>All undirected edges in the graph.  If the graph is undirected, each edge will appear at the position given by its <field name="index"/>.</p></description>
1076                         </type-field>
1077                         <type-field name="d_edges">
1078                                 <type>
1079                                         <parameterized-type name="Seq">
1080                                                 <parameterized-type name="DEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1081                                         </parameterized-type>
1082                                 </type>
1083                                 <description><p>All directed edges in the graph.  If the graph is directed, each edge will appear at the position given by its <field name="index"/>.</p></description>
1084                         </type-field>
1085                         <type-field name="edges">
1086                                 <type>
1087                                         <parameterized-type name="Seq">
1088                                                 <parameterized-type name="Edge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1089                                         </parameterized-type>
1090                                 </type>
1091                                 <description><p>All edges in the graph, with each edge appearing at the position given by its <field name="index"/>.</p></description>
1092                         </type-field>
1093                         <type-field name="u_multiedges">
1094                                 <type>
1095                                         <parameterized-type name="Seq">
1096                                                 <parameterized-type name="UMultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1097                                         </parameterized-type>
1098                                 </type>
1099                                 <description><p>All undirected multiedges in the graph.</p></description>
1100                         </type-field>
1101                         <type-field name="d_multiedges">
1102                                 <type>
1103                                         <parameterized-type name="Seq">
1104                                                 <parameterized-type name="DMultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1105                                         </parameterized-type>
1106                                 </type>
1107                                 <description><p>All directed multiedges in the graph.</p></description>
1108                         </type-field>
1109                         <type-field name="multiedges">
1110                                 <type>
1111                                         <parameterized-type name="Seq">
1112                                                 <parameterized-type name="MultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1113                                         </parameterized-type>
1114                                 </type>
1115                                 <description><p>All multiedges in the graph.</p></description>
1116                         </type-field>
1117                         <type-method name="partition">
1118                                 <function>
1119                                         <case>
1120                                                 <arguments>
1121                                                         <arg identifier="key">
1122                                                                 <type>
1123                                                                         <named-type name="GraphKey" />
1124                                                                 </type>
1125                                                         </arg>
1126                                                 </arguments>
1127                                                 <result>
1128                                                         <type>
1129                                                                 <parameterized-type name="Seq">
1130                                                                         <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1131                                                                 </parameterized-type>
1132                                                         </type>
1133                                                 </result>
1134                                                 <description>
1135                                                         <p>All nodes in the given partition.</p>
1136                                                 </description>
1137                                         </case>
1138                                 </function>
1139                         </type-method>
1140                         <type-method name="partition_node_count">
1141                                 <function>
1142                                         <case>
1143                                                 <arguments>
1144                                                         <arg identifier="key">
1145                                                                 <type>
1146                                                                         <named-type name="GraphKey" />
1147                                                                 </type>
1148                                                         </arg>
1149                                                 </arguments>
1150                                                 <result>
1151                                                         <type><named-type name="Integer"/></type>
1152                                                 </result>
1153                                                 <description>
1154                                                         <p>The number of nodes in the given partition.</p>
1155                                                 </description>
1156                                         </case>
1157                                 </function>
1158                         </type-method>
1160                         <type-method name="item?">
1161                                 <function>
1162                                         <case>
1163                                                 <arguments>
1164                                                         <arg identifier="item">
1165                                                                 <type>
1166                                                                         <union-type>
1167                                                                                 <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1168                                                                                 <parameterized-type name="Edge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1169                                                                                 <parameterized-type name="MultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1170                                                                         </union-type>
1171                                                                 </type>
1172                                                         </arg>
1173                                                 </arguments>
1174                                                 <result>
1175                                                         <type>
1176                                                                 <named-type name="Boolean"/>
1177                                                         </type>
1178                                                 </result>
1179                                                 <description>
1180                                                         <p>Test if an item such as a node, an edge, or a multiedge belongs to the graph.</p>
1181                                                 </description>
1182                                         </case>
1183                                 </function>
1184                         </type-method>
1185                         <type-method name="key?">
1186                                 <function>
1187                                         <case>
1188                                                 <arguments>
1189                                                         <arg identifier="key">
1190                                                                 <type><named-type name="GraphKey" /></type>
1191                                                         </arg>
1192                                                 </arguments>
1193                                                 <result>
1194                                                         <type>
1195                                                                 <named-type name="Boolean"/>
1196                                                         </type>
1197                                                 </result>
1198                                                 <description>
1199                                                         <p>Test if a node key is present in the graph.</p>
1200                                                 </description>
1201                                         </case>
1202                                 </function>
1203                         </type-method>
1205                         <type-method name="index_node">
1206                                 <function>
1207                                         <case>
1208                                                 <arguments>
1209                                                         <arg identifier="index">
1210                                                                 <type><named-type name="Integer" /></type>
1211                                                         </arg>
1212                                                 </arguments>
1213                                                 <result>
1214                                                         <type>
1215                                                                 <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1216                                                         </type>
1217                                                 </result>
1218                                                 <description>
1219                                                         <p>Retrieves a node in the graph identified by its index.</p>
1220                                                 </description>
1221                                         </case>
1222                                 </function>
1223                         </type-method>
1224                         <type-method name="index_edge">
1225                                 <function>
1226                                         <case>
1227                                                 <arguments>
1228                                                         <arg identifier="index">
1229                                                                 <type><named-type name="Integer" /></type>
1230                                                         </arg>
1231                                                 </arguments>
1232                                                 <result>
1233                                                         <type>
1234                                                                 <parameterized-type name="Edge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1235                                                         </type>
1236                                                 </result>
1237                                                 <description>
1238                                                         <p>Retrieves an edge in the graph identified by its index.</p>
1239                                                 </description>
1240                                         </case>
1241                                 </function>
1242                         </type-method>
1244                         <type-method name="find_node">
1245                                 <function>
1246                                         <case>
1247                                                 <arguments>
1248                                                         <arg identifier="key">
1249                                                                 <type><named-type name="GraphKey" /></type>
1250                                                         </arg>
1251                                                 </arguments>
1252                                                 <result>
1253                                                         <type>
1254                                                                 <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1255                                                         </type>
1256                                                 </result>
1257                                                 <description>
1258                                                         <p>Finds a node in the graph identified by its key.</p>
1259                                                 </description>
1260                                         </case>
1261                                 </function>
1262                         </type-method>
1263                         <type-method name="find_u_edges">
1264                                 <function>
1265                                         <case>
1266                                                 <arguments>
1267                                                         <arg identifier="source">
1268                                                                 <type>
1269                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /><named-type name="Void" /></union-type>
1270                                                                 </type>
1271                                                                 <default><value-the-void /></default>
1272                                                         </arg>
1273                                                         <arg identifier="target">
1274                                                                 <type>
1275                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /><named-type name="Void" /></union-type>
1276                                                                 </type>
1277                                                                 <default><value-the-void /></default>
1278                                                         </arg>
1279                                                         <arg identifier="label">
1280                                                                 <type>
1281                                                                         <union-type><named-type name="GraphKey" /><named-type name="Void" /></union-type>
1282                                                                 </type>
1283                                                                 <default><value-the-void /></default>
1284                                                         </arg>
1285                                                         <arg identifier="loops">
1286                                                                 <type><named-type name="Boolean"/></type>
1287                                                                 <default><value-the-true /></default>
1288                                                         </arg>
1289                                                 </arguments>
1290                                                 <result>
1291                                                         <type>
1292                                                                 <parameterized-type name="Seq">
1293                                                                         <parameterized-type name="UEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1294                                                                 </parameterized-type>
1295                                                         </type>
1296                                                 </result>
1297                                                 <description>
1298                                                         <p>Finds all undirected edges that are incident to both <arg name="source" /> and <arg name="target"/>.  The default value means any node.</p>
1299                                                         <p>If <arg name="label" /> is a <named-type name="GraphKey" />, only edges with that label are returned.  If <arg name="label" /> is <value-the-void />, any edge label will match; there is no way to only return edges that do not have a label (that is, the label being <value-the-void />).</p>
1300                                                         <p>Loops can be excluded by setting <arg name="loops" /> to <value-the-false />.  Loop edges are only included once.</p>
1301                                                 </description>
1302                                         </case>
1303                                 </function>
1304                         </type-method>
1305                         <type-method name="find_d_edges">
1306                                 <function>
1307                                         <case>
1308                                                 <arguments>
1309                                                         <arg identifier="source">
1310                                                                 <type>
1311                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /><named-type name="Void" /></union-type>
1312                                                                 </type>
1313                                                                 <default><value-the-void /></default>
1314                                                         </arg>
1315                                                         <arg identifier="target">
1316                                                                 <type>
1317                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /><named-type name="Void" /></union-type>
1318                                                                 </type>
1319                                                                 <default><value-the-void /></default>
1320                                                         </arg>
1321                                                         <arg identifier="label">
1322                                                                 <type>
1323                                                                         <union-type><named-type name="GraphKey" /><named-type name="Void" /></union-type>
1324                                                                 </type>
1325                                                                 <default><value-the-void /></default>
1326                                                         </arg>
1327                                                         <arg identifier="loops">
1328                                                                 <type><named-type name="Boolean"/></type>
1329                                                                 <default><value-the-true /></default>
1330                                                         </arg>
1331                                                 </arguments>
1332                                                 <result>
1333                                                         <type>
1334                                                                 <parameterized-type name="Seq">
1335                                                                         <parameterized-type name="DEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1336                                                                 </parameterized-type>
1337                                                         </type>
1338                                                 </result>
1339                                                 <description>
1340                                                         <p>Finds all directed edges from <arg name="source" /> to <arg name="target"/>.  Analogous to <field name="find_u_edges"/>.</p>
1341                                                 </description>
1342                                         </case>
1343                                 </function>
1344                         </type-method>
1345                         <type-method name="find_u_multiedges">
1346                                 <function>
1347                                         <case>
1348                                                 <arguments>
1349                                                         <arg identifier="source">
1350                                                                 <type>
1351                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /><named-type name="Void" /></union-type>
1352                                                                 </type>
1353                                                                 <default><value-the-void /></default>
1354                                                         </arg>
1355                                                         <arg identifier="target">
1356                                                                 <type>
1357                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /><named-type name="Void" /></union-type>
1358                                                                 </type>
1359                                                                 <default><value-the-void /></default>
1360                                                         </arg>
1361                                                         <arg identifier="loops">
1362                                                                 <type><named-type name="Boolean"/></type>
1363                                                                 <default><value-the-true /></default>
1364                                                         </arg>
1365                                                 </arguments>
1366                                                 <result>
1367                                                         <type>
1368                                                                 <parameterized-type name="Seq">
1369                                                                         <parameterized-type name="UMultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1370                                                                 </parameterized-type>
1371                                                         </type>
1372                                                 </result>
1373                                                 <description>
1374                                                         <p>Finds all undirected multiedges that are incident to both <arg name="source" /> and <arg name="target"/>.  The default value means any node.</p>
1375                                                         <p>Unlike <field name="find_u_edges" />, it is not possible to specify an edge label; a <named-type name="MultiEdge" /> will always contain all parallel edges.</p>
1376                                                         <p>Loops can be excluded by setting <arg name="loops" /> to <value-the-false />.  Loop edges are only included once.</p>
1377                                                 </description>
1378                                         </case>
1379                                 </function>
1380                         </type-method>
1381                         <type-method name="find_d_multiedges">
1382                                 <function>
1383                                         <case>
1384                                                 <arguments>
1385                                                         <arg identifier="source">
1386                                                                 <type>
1387                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /><named-type name="Void" /></union-type>
1388                                                                 </type>
1389                                                                 <default><value-the-void /></default>
1390                                                         </arg>
1391                                                         <arg identifier="target">
1392                                                                 <type>
1393                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /><named-type name="Void" /></union-type>
1394                                                                 </type>
1395                                                                 <default><value-the-void /></default>
1396                                                         </arg>
1397                                                         <arg identifier="loops">
1398                                                                 <type><named-type name="Boolean"/></type>
1399                                                                 <default><value-the-true /></default>
1400                                                         </arg>
1401                                                 </arguments>
1402                                                 <result>
1403                                                         <type>
1404                                                                 <parameterized-type name="Seq">
1405                                                                         <parameterized-type name="DMultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1406                                                                 </parameterized-type>
1407                                                         </type>
1408                                                 </result>
1409                                                 <description>
1410                                                         <p>Finds all directed multiedges from <arg name="source" /> to <arg name="target"/>.  Analogous to <field name="find_u_multiedges"/>.</p>
1411                                                 </description>
1412                                         </case>
1413                                 </function>
1414                         </type-method>
1415                         <type-method name="the_u_edge">
1416                                 <function>
1417                                         <case>
1418                                                 <arguments>
1419                                                         <arg identifier="source">
1420                                                                 <type>
1421                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /></union-type>
1422                                                                 </type>
1423                                                         </arg>
1424                                                         <arg identifier="target">
1425                                                                 <type>
1426                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /></union-type>
1427                                                                 </type>
1428                                                         </arg>
1429                                                         <arg identifier="label">
1430                                                                 <type>
1431                                                                         <union-type><named-type name="GraphKey" /><named-type name="Void" /></union-type>
1432                                                                 </type>
1433                                                                 <default><value-the-void /></default>
1434                                                         </arg>
1435                                                 </arguments>
1436                                                 <result>
1437                                                         <type>
1438                                                                 <parameterized-type name="UEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1439                                                         </type>
1440                                                 </result>
1441                                                 <description>
1442                                                         <p>Returns the only undirected edge incident to both <arg name="source" /> and <arg name="target"/>.</p>
1443                                                         <p>If <arg name="label" /> is a <named-type name="GraphKey" />, only edges with that label are considered.  If <arg name="label" /> is <value-the-void />, any edge label will match.</p>
1444                                                         <p>It is an error if there is not exactly one matching edge.</p>
1445                                                 </description>
1446                                         </case>
1447                                 </function>
1448                         </type-method>
1449                         <type-method name="the_d_edge">
1450                                 <function>
1451                                         <case>
1452                                                 <arguments>
1453                                                         <arg identifier="source">
1454                                                                 <type>
1455                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /></union-type>
1456                                                                 </type>
1457                                                         </arg>
1458                                                         <arg identifier="target">
1459                                                                 <type>
1460                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /></union-type>
1461                                                                 </type>
1462                                                         </arg>
1463                                                         <arg identifier="label">
1464                                                                 <type>
1465                                                                         <union-type><named-type name="GraphKey" /><named-type name="Void" /></union-type>
1466                                                                 </type>
1467                                                                 <default><value-the-void /></default>
1468                                                         </arg>
1469                                                 </arguments>
1470                                                 <result>
1471                                                         <type>
1472                                                                 <parameterized-type name="DEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1473                                                         </type>
1474                                                 </result>
1475                                                 <description>
1476                                                         <p>Returns the only directed edge from <arg name="source" /> to <arg name="target"/>.  Analogous to <field name="the_u_edge" />.</p>
1477                                                 </description>
1478                                         </case>
1479                                 </function>
1480                         </type-method>
1481                         <type-method name="the_u_multiedge">
1482                                 <function>
1483                                         <case>
1484                                                 <arguments>
1485                                                         <arg identifier="source">
1486                                                                 <type>
1487                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /></union-type>
1488                                                                 </type>
1489                                                         </arg>
1490                                                         <arg identifier="target">
1491                                                                 <type>
1492                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /></union-type>
1493                                                                 </type>
1494                                                         </arg>
1495                                                 </arguments>
1496                                                 <result>
1497                                                         <type>
1498                                                                 <parameterized-type name="UMultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1499                                                         </type>
1500                                                 </result>
1501                                                 <description>
1502                                                         <p>Returns the undirected multiedge incident to both <arg name="source" /> and <arg name="target"/>.</p>
1503                                                         <p>It is an error if there is no matching edge.</p>
1504                                                 </description>
1505                                         </case>
1506                                 </function>
1507                         </type-method>
1508                         <type-method name="the_d_multiedge">
1509                                 <function>
1510                                         <case>
1511                                                 <arguments>
1512                                                         <arg identifier="source">
1513                                                                 <type>
1514                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /></union-type>
1515                                                                 </type>
1516                                                         </arg>
1517                                                         <arg identifier="target">
1518                                                                 <type>
1519                                                                         <union-type><named-type name="Node" /><named-type name="GraphKey" /></union-type>
1520                                                                 </type>
1521                                                         </arg>
1522                                                 </arguments>
1523                                                 <result>
1524                                                         <type>
1525                                                                 <parameterized-type name="DMultiEdge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1526                                                         </type>
1527                                                 </result>
1528                                                 <description>
1529                                                         <p>Returns the directed multiedge from <arg name="source" /> to <arg name="target"/>.  Analogous to <field name="the_u_multiedge" />.</p>
1530                                                 </description>
1531                                         </case>
1532                                 </function>
1533                         </type-method>
1534                         <type-method name="rekey_with_index">
1535                                 <function>
1536                                         <case>
1537                                                 <arguments>
1538                                                         <arg identifier="offset">
1539                                                                 <type>
1540                                                                         <named-type name="Integer"/>
1541                                                                 </type>
1542                                                                 <default><inline>'0</inline></default>
1543                                                         </arg>
1544                                                 </arguments>
1545                                                 <result>
1546                                                         <type>
1547                                                                 <parameterized-type name="Graph">
1548                                                                         <parameter-type name="N"/><parameter-type name="E"/>
1549                                                                 </parameterized-type>
1550                                                         </type>
1551                                                 </result>
1552                                                 <description>
1553                                                         <p>Constructs a graph where each new node key is obtained by adding <arg name="offset"/> to the current node's <field name="index"/>.  If <arg name="index" /> is left at its default, this will generate a graph where the node keys coincide with the node indices.</p>
1554                                                 </description>
1555                                         </case>
1556                                 </function>
1557                         </type-method>
1558                         <type-method name="with_node_values">
1559                                 <function>
1560                                         <case>
1561                                                 <arguments>
1562                                                         <arg identifier="values">
1563                                                                 <type>
1564                                                                         <parameterized-type name="Seq">
1565                                                                                 <named-type name="Value"/>
1566                                                                         </parameterized-type>
1567                                                                 </type>
1568                                                         </arg>
1569                                                 </arguments>
1570                                                 <result>
1571                                                         <type>
1572                                                                 <parameterized-type name="Graph">
1573                                                                         <parameter-type name="N"/><parameter-type name="E"/>
1574                                                                 </parameterized-type>
1575                                                         </type>
1576                                                 </result>
1577                                                 <description>
1578                                                         <p>Constructs a graph with node values given by <arg name="values"/>.  The order in <arg name="value" /> corresponds to node indices.</p>
1579                                                         <p>The resulting graph will share most of its data except the node values with the original graph..</p>
1580                                                 </description>
1581                                         </case>
1582                                 </function>
1583                         </type-method>
1584                         <type-method name="with_edge_values">
1585                                 <function>
1586                                         <case>
1587                                                 <arguments>
1588                                                         <arg identifier="values">
1589                                                                 <type>
1590                                                                         <parameterized-type name="Seq">
1591                                                                                 <named-type name="Value"/>
1592                                                                         </parameterized-type>
1593                                                                 </type>
1594                                                         </arg>
1595                                                 </arguments>
1596                                                 <result>
1597                                                         <type>
1598                                                                 <parameterized-type name="Graph">
1599                                                                         <parameter-type name="N"/><parameter-type name="E"/>
1600                                                                 </parameterized-type>
1601                                                         </type>
1602                                                 </result>
1603                                                 <description>
1604                                                         <p>Constructs a graph with edge values given by <arg name="values"/>.  The order in <arg name="value" /> corresponds to edge indices.</p>
1605                                                         <p>The resulting graph will share most of its data except the edge values with the original graph..</p>
1606                                                 </description>
1607                                         </case>
1608                                 </function>
1609                         </type-method>
1610                         <type-method name="induced_subgraph">
1611                                 <function>
1612                                         <case>
1613                                                 <arguments>
1614                                                         <arg identifier="nodes">
1615                                                                 <type>
1616                                                                         <parameterized-type name="Seq">
1617                                                                                 <parameterized-type name="Node"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1618                                                                         </parameterized-type>
1619                                                                 </type>
1620                                                         </arg>
1621                                                 </arguments>
1622                                                 <result>
1623                                                         <type>
1624                                                                 <parameterized-type name="Graph">
1625                                                                         <parameter-type name="N"/><parameter-type name="E"/>
1626                                                                 </parameterized-type>
1627                                                         </type>
1628                                                 </result>
1629                                                 <description>
1630                                                         <p>Constructs the subgraph indiced by the specified nodes.</p>
1631                                                         <p>The node indices in the resulting graph will correspond to the positions in <arg name="nodes" />.  To just reorder the nodes of a graph, use this method with all nodes in <arg name="nodes"/>.</p>
1632                                                 </description>
1633                                         </case>
1634                                 </function>
1635                         </type-method>
1636                         <type-method name="spanning_subgraph">
1637                                 <function>
1638                                         <case>
1639                                                 <arguments>
1640                                                         <arg identifier="edges">
1641                                                                 <type>
1642                                                                         <parameterized-type name="Seq">
1643                                                                                 <parameterized-type name="Edge"><parameter-type name="N"/><parameter-type name="E"/></parameterized-type>
1644                                                                         </parameterized-type>
1645                                                                 </type>
1646                                                         </arg>
1647                                                 </arguments>
1648                                                 <result>
1649                                                         <type>
1650                                                                 <parameterized-type name="Graph">
1651                                                                         <parameter-type name="N"/><parameter-type name="E"/>
1652                                                                 </parameterized-type>
1653                                                         </type>
1654                                                 </result>
1655                                                 <description>
1656                                                         <p>Constructs the spanning subgraph with the specified edges.</p>
1657                                                         <p>The nodes of the resulting graph are identical to those of the original graph (including their indices).</p>
1658                                                 </description>
1659                                         </case>
1660                                 </function>
1661                         </type-method>
1662                 </fields>
1663                 <description>
1664                         <p>The <self /> data structure is designed to fill the gap created by the functional language's restriction to non-recursive data structures.  A recursive data structure is when a value either directly or indirectly contains a reference to itself, like a node with a reference to its neighbor, which in turn has a reference back to the first node.  In an imperative language, it is possible to have nodes containing references to their adjacent nodes, and this is often the most natural and efficient way of modeling a graph.</p>
1665                         <p>Since <str-Shapes /> is functional, however, there cannot be recursive data structures, and so one has to model graphs in a non-recursive manner.  Of course, there are many such representations, one of the most common being some kind of adjacency matrix, where each non-zero entry in the matrix represents an edge in the graph, with the row in the matrix corresponding to the source node, and the column in the matrix corresponding to the target node.  While such a matrix representation may be good for representing the graph structure alone, it is rather inconvenient when one wants values associated with the nodes and edges, and it may also be inefficient for certain operations depending on the details of the matrix representation.</p>
1666                         <p><str-Shapes /> uses function calls to break the cycles that would otherwise result in recursive data structures.  This sometimes turns out as member functions that are often called with no arguments, but that could still not be plain non-function fields.</p>
1667                 </description>
1668         </coretype>
1670   <coretype name="GraphComplexData">
1671                 <type-parameters>
1672                         <parameter name="N">
1673                                 <description>
1674                                         <p>Type of node values.</p>
1675                                 </description>
1676                         </parameter>
1677                 </type-parameters>
1678     <abstraction>
1679       <p>The <self /> type is a structure holding data used to define a node during graph construction.</p>
1680                         <p>Strictly speaking, the type only consists of the field <field name="key" />, since the other field may be omitted where <self /> is used to construct graphs. </p>
1681     </abstraction>
1682                 <see-also>
1683                         <named-type name="Node" /> <value name="graph" /> <named-type name="EdgeData" />
1684                 </see-also>
1685     <construction>
1686     </construction>
1687                 <fields>
1688                         <type-field name="key">
1689                                 <type><named-type name="GraphKey" /></type>
1690                                 <description><p>Node key.</p></description>
1691                         </type-field>
1692                         <type-field name="value">
1693                                 <type><parameter-type name="N" /></type>
1694                                 <description><p>The value associated with the node.</p></description>
1695                         </type-field>
1696                         <type-field name="partition">
1697                                 <type><union-type><named-type name="GraphKey" /><named-type name="Void" /></union-type></type>
1698                                 <description><p>Graph partition.  Unless <value-the-void />, the node may not be connected to other nodes in the same partition.</p></description>
1699                         </type-field>
1700                 </fields>
1701   </coretype>
1703   <coretype name="HierarchicalEdgeData">
1704                 <type-parameters>
1705                         <parameter name="E">
1706                                 <description>
1707                                         <p>Type of edge values.</p>
1708                                 </description>
1709                         </parameter>
1710                 </type-parameters>
1711     <abstraction>
1712       <p>The <self /> type is a structure holding data used to define an edge during graph construction.</p>
1713                         <p>Strictly speaking, the type only consists of the fields <field name="source" /> and <field name="target" />, since the other fields have default values where <self /> is used to construct graphs. </p>
1714     </abstraction>
1715                 <see-also>
1716                         <named-type name="Edge" /> <value name="graph" /> <named-type name="NodeData" />
1717                 </see-also>
1718     <construction>
1719     </construction>
1720                 <fields>
1721                         <type-field name="source">
1722                                 <type><named-type name="GraphKey" /></type>
1723                                 <description><p>The source of a directed edge, or one of the nodes incident to an undirected edge.</p></description>
1724                         </type-field>
1725                         <type-field name="target">
1726                                 <type><named-type name="GraphKey" /></type>
1727                                 <description><p>The target of a directed edge, or one of the nodes incident to an undirected edge.</p></description>
1728                         </type-field>
1729                         <type-field name="value">
1730                                 <type><parameter-type name="E" /></type>
1731                                 <description><p>The value associated with the edge.</p></description>
1732                         </type-field>
1733                         <type-field name="label">
1734                                 <type><named-type name="GraphKey" /></type>
1735                                 <description><p>A label which may be used in combination with <field name="source" /> and <field name="target" /> to identify the edge.  Note that, in general, the label does not have to be unique, even for a given pair of <field name="source" /> and <field name="target" />.</p></description>
1736                         </type-field>
1737                         <type-field name="directed">
1738                                 <type><named-type name="Boolean" /></type>
1739                                 <description><p>Whether the edge is directed or undirected.</p></description>
1740                         </type-field>
1741                 </fields>
1742   </coretype>
1744 </section>