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]

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.

[less]

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 .



Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.
Send