Consider the following Plain TeX manuscript featuring a TikZ graph.

\input tikz
\tikz \graph { {a,b,c} -> {d,e->f} };%

This manuscript renders the following graph.

TikZ graph

Given that TikZ has decided to connect the node group {a, b, c} to the node group {d, e}, based on what did it decide which pairs of nodes from these two groups will be connected by an edge?

  • first group to first, second group to second If I remember correctly – percusse Sep 6 '17 at 11:07
  • @percusse: Why is c connected to e? – Evan Aad Sep 6 '17 at 12:14
  • Perhaps the PGF Manual Section 19.7 "Graph Operators, Color Classes, and Graph Expressions", specifically Section 19.7.3: "Graph Operators for Joining Groups" may shed some light on things – Mark Wibrow Sep 6 '17 at 12:19
  • @MarkWibrow: You mean the part that says (p. 285) that in the absence of an explicit operator (as in the example above), the operator is the value of the key default edge operator, which has no default? – Evan Aad Sep 6 '17 at 12:27
  • 1
    @EvanAad: I do indeed mean that part, as the operator is the value of the default edge operator which has no default when it is used (it has to have a value). It is initially set to matching and star. I also mean the part which says (p. 286) "A list of predefined joining operators can be found in the reference Section 19.10" – Mark Wibrow Sep 6 '17 at 13:15

Section 19.7 ("Graph Operators, Color Classes, and Graph Expressions"), specifically Section 19.7.3: ("Graph Operators for Joining Groups") in the PGF Manual for Version 3.0.1a describes the approach taken by TikZ for joining groups using different "edge operators" which can be specified using the default edge operator key.

If no edge operator is explicitly provided in the graph, the initial value matching and star is used, which is described in Section 19.10 ("Reference: Predefined Elements"), specifically in Section 19.10.3 ("Joining Operators").

This operator joins nodes in target and source groups sequentially and any remaining nodes in one group are joined to the last node in the other.

Considering the example:

\graph { {a,b,c} -> {d,e->f} };

Node a is joined to node d, then node b is joined to node e. The remaining node c in the first group is joined to last node the second group e.

The following example provides further illustration:

\input tikz
\tikzgraphsset{math nodes}
\tikz\graph{ {a_1, b_1, c_1} -> {d_1, e_1, f_1} }; 
\tikz\graph{ {a_2, b_2, c_2} -> {d_2, e_2} };
\tikz\graph{ {a_3, b_3, c_3} -> {d_3} };

enter image description here

  • Would it be correct to say that even though the 'default edge operator' key has no default value, it has an initial value, namely 'matching and star'? – Evan Aad Sep 7 '17 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.