[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [igraph] question about "degree.sequence.game()"

**From**: |
Tamás Nepusz |

**Subject**: |
Re: [igraph] question about "degree.sequence.game()" |

**Date**: |
Mon, 9 Sep 2013 15:45:22 +0200 |

>* Would you please briefly describe the basic ideas of the method and how did *
>* you do to avoid the multiple and loop edges?*
See the documentation:
http://igraph.sourceforge.net/doc/html/ch09s02.html#igraph_degree_sequence_game
Basically, it generates a long list containing each vertex ID exactly as many
times as the number of desired edges, then shuffles the list and starts taking
pairs from the front -- these will be the endpoints of the generated edges. If
it gets stuck, it skips the pair and moves on to the next one. When the list is
exhausted and there are any skipped pairs, the skipped pairs are re-shuffled
and the process starts again. If all the pairs in the list are skipped, it
means that the algorithm got stuck, so it simply restarts the entire graph
generation from a new list.
Source code is here for the undirected case:
https://github.com/igraph/igraph/blob/master/src/games.c#L861
and this is the directed case:
https://github.com/igraph/igraph/blob/master/src/games.c#L1001
--
T.