Wheel graphs
Graphviz ยป Graphviz gallery

Prev:Cycle graphs
Next:Cluster example


In graph theory, a wheel graph on n nodes is composed of a single node connected to each node of a cycle of n-1 nodes.

USING: arrays kernel math math.parser sequences graphviz graphviz.notation graphviz.render ; : add-cycle ( graph n -- graph' ) [ <iota> add-path ] [ 1 - 0 add-edge ] bi ; : W_n ( n -- ) <graph> [graph "t" =labelloc "twopi" =layout ]; [node "point" =shape ]; over number>string "W " prepend =label over add-node over 1 - add-cycle swap [ ] [ 1 - <iota> >array ] bi add-edge preview ;


6 W_n


7 W_n


8 W_n