summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentOrder.lua
blob: 78537b614cd2ce895b2fc13c4981c9ad762f053f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
-- Copyright 2012 by Till Tantau
--
-- This file may be distributed an/or modified
--
-- 1. under the LaTeX Project Public License and/or
-- 2. under the GNU Public License
--
-- See the file doc/generic/pgf/licenses/LICENSE for more information

-- @release $Header$


local declare       = require "pgf.gd.interface.InterfaceToAlgorithms".declare




---
-- @section subsubsection {Ordering the Components}
--
-- The different connected components of the graph are collected in a
-- list. The ordering of the nodes in this list can be configured using
-- the following key.
--
-- @end


---

declare {
  key = "component order",
  type = "string",
  initial = "by first specified node",

  summary = [["
    Selects a ``strategy'' for ordering the components. By default,
    they are ordered in the way they appear in the input.
  "]],
  documentation = [["
    The following values are permissible for \meta{strategy}
    %
    \begin{itemize}
      \item \declare{|by first specified node|}

        The components are ordered ``in the way they appear in the input
        specification of the graph''. More precisely, for each component
        consider the node that is first encountered in the description
        of the graph. Order the components in the same way as these nodes
        appear in the graph description.
      \item \declare{|increasing node number|}

        The components are ordered by increasing number of nodes. For
        components with the same number of nodes, the first node in each
        component is considered and they are ordered according to the
        sequence in which these nodes appear in the input.

      \item \declare{|decreasing node number|}
        As above, but in decreasing order.
    \end{itemize}
  "]],
  examples = {[["
    \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
                  component order=by first specified node]
      { a, b, c, f -- g, c -- d -- e };
  "]],[["
    \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
                  component order=increasing node number]
      { a, b, c -- d -- e, f -- g };
  "]]
  }
}


---

declare {
  key = "small components first",
  use = {
    { key = "component order", value = "increasing node number" }
  },

  summary = [["
    A shorthand for |component order=increasing node number|.
  "]]
 }

---

declare {
  key = "large components first",
  use = {
    { key = "component order", value = "decreasing node number" },
  },
  summary = [["
    A shorthand for |component order=decreasing node number|.
  "]],
  examples = [["
    \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle},
                  large components first]
      { a, b, c -- d -- e, f -- g };
  "]]
}


return Components