Move design idea example for hierarchical graphs out of features directory
[shapes.git] / examples / problems / hierarchical-graphs.shape
blobf8b2bc525df93bbe22011b37b3585693ddd82c74
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 2014 Henrik Tidefelt
17  **/
19 /** This example is placed in the <problems> directory since it just contains
20  ** design ideas.
21  **/
23 ##needs ..Shapes..Data / seq-support
25 ##lookin ..Shapes
26 ##lookin ..Shapes..Data
27 ##lookin ..Shapes..Geometry
28 ##lookin ..Shapes..Layout
30 g0: [hierarchical_graph undirected:true
31       complexes: [list
32                   (> 'A g11 <) (> 'B g12 <) (> 'C g13 <) /** Subgraphs that already exist. **/
33                 ]
34       leafs: [list /** The argument is named "leafs" rather than "nodes", since the nodes given here are not all nodes. **/
35               (> key:'a <) (> 'b <) 'c /** Just like the nodes in a flat graph. **/
36             ]
37       edges: [list
38               (> (> complex:'A entry:'x <) (> complex:'B entry:'y <) <) /** Nodes refered to using entry in the interface of a complex. **/
39               (> (> 'A 'x <) (> 'A 'y <) <)
40               (> 'a (> 'B 'y <) <) /** A single key, 'a, refers to a leaf. **/
41               (> 'a 'b <)
42             ]
43       interface: [list
44                   /** The nodes exposed in the interface must not be adjacent. **/
45                   (> public_entry:'a leaf:'a <) /** The clumsy way of exposing a leaf node. **/
46                   'b /** The easy way to expose a leaf node using its own key. **/
47                   (> public_entry:'Ax complex:'A entry:'x <) /** Expose the entry 'x in the complex 'A under the entry 'Ax in the interface. **/
48                   (> 'Bx 'B 'x <) (> 'Cy 'c 'y <)
49                 ]
50     ]