In graph theory, a complete graph is one in which there is an edge between each pair of distinct nodes.

USING: kernel math.combinatorics math.parser sequences
graphviz graphviz.notation graphviz.render ;
: K_n ( n -- )
<graph>
[node "point" =shape ];
[graph "t" =labelloc "circo" =layout ];
over number>string "K " prepend =label
swap <iota> 2 [ first2 add-edge ] each-combination
preview ;

5 K_n

6 K_n

7 K_n

This documentation was generated offline from a
`load-all`

image. If you want, you can also
browse the documentation from within the UI developer tools. See
the Factor website
for more information.

Factor 0.99 x86.64 (2173, heads/master-f3ee5c5979, Sep 18 2022 13:17:51)