Algorithm for generating random scale-free graphs with a fixed degree distribution. (A) The algorithm takes the observed domain graph. The example shown here has incoming edges marked in blue and outgoing in yellow. (B) The in and out-degrees for each node are recorded while the connectivity is discarded. (C) The program randomly selects one node from each of the in- and out-degree lists. This pair of nodes is connected and removed from their respective lists. Through a series of iterations, the graph is assembled. If a selected pair of nodes is already present in the partially built graph, they are returned to the candidate lists and a second pair is randomly chosen. Towards the completion of the graph it is not uncommon for all possible new pairs to already be in the graph because the domain graph is scale-free with a small number of high-degree nodes. In this case, an edge is randomly selected from the partially built graph and the the inward links are exchanged. This procedure generates random graphs with identical degree distribution to the initial graph.