10217

# Enumerating the Directed Graphs

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.

### DETAILS

The pairing function used for two integers and is .
The corresponding unpairing function of an integer is .

### PERMANENT CITATION

Contributed by: Seth J. Chandler
Additional contributions by: Matthew Szudzik and Jesse Nochella
 Share: Embed Interactive Demonstration New! Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details » Download Demonstration as CDF » Download Author Code »(preview ») Files require Wolfram CDF Player or Mathematica.

#### Related Topics

 RELATED RESOURCES
 The #1 tool for creating Demonstrations and anything technical. Explore anything with the first computational knowledge engine. The web's most extensive mathematics resource. An app for every course—right in the palm of your hand. Read our views on math,science, and technology. The format that makes Demonstrations (and any information) easy to share and interact with. Programs & resources for educators, schools & students. Join the initiative for modernizing math education. Walk through homework problems one step at a time, with hints to help along the way. Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet. Knowledge-based programming for everyone.