# Enumerating the Directed Graphs

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

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.

[more]
Contributed by: Seth J. Chandler (March 2011)

Additional contributions by: Matthew Szudzik and Jesse Nochella

Open content licensed under CC BY-NC-SA

## Snapshots

## Details

The pairing function used for two integers and is .

The corresponding unpairing function of an integer is .

## Permanent Citation