WOLFRAM|DEMONSTRATIONS PROJECT

Enumerating the Directed Graphs

​
number of vertices
2
3
4
5
6
7
8
9
number of edges
5
6
7
8
9
10
11
12
13
14
15
16
edgesto paired integers
53
32
65
51
14
53
13
51
51
14
41
18
72
26
16
41
11
26
26
16
iterativepairingof paired integers
{41,1811,1775597,1576421182473,1242551872302373151891278,771967577681066517970815389319321789033121616818,2979669704953867343856831137575940215226313171767519005936290515233230432853,4439215775309933434580081708917128121184948303514698545054495868312707763613,9853318349880286704535858589949176233082767859047246131320960174521406906593,4854394125204378803907136931390678626898001747930438581940411357565334299338}
A directed graph can be described as a list of ordered pairs of positive integers denoting the edges; the integers denote the vertices. But a pair of integers can be collapsed into a unique single integer using a pairing function. Moreover, this transformation of a pair can be inverted. This means that a directed graph can be uniquely described by a single integer obtained by (a) converting the ordered pairs into a single number and then (b) iteratively pairing those paired integers using the pairing function. The process can be reversed and the edges recovered so long as one knows how many edges the directed graph had to begin with.
This Demonstration illustrates this concept. You constrain the number of vertices and edges for the directed graph. The Demonstration responds by generating a random graph that satisfies the constraint and showing the process generating the integer representation of this graph. The last number in the listing of the iterative pairing of paired integers is the unique integer identifier for the graph. Even for these relatively small graphs, this integer may contain tens of thousands of digits and is thus displayed in shortened form.