All examples By author By category About

bryik

Generating Complete Graphs

Click the label to generate the next complete graph.

Complete graphs are a family of simple graph that have n vertices and an edge set containing all possible links (C(n, 2)). For n >= 1, the complete graph on n vertices is denoted Kn.

The code that generates the graphs could be improved. I was lazy and generated the edge set with the Cartesian product (resulting in a lot of useless parallel edges). If only JavaScript had something like Python's itertools...

The D3 code running this example is based on Mike Bostock's "Modifying a Force Layout II". I had no idea how to "update" a force graph, so this example was a lifesaver.