Skip to content
  • Tiago Peixoto's avatar
    Several improvements to random_rewire() / random_graph() · 8240714e
    Tiago Peixoto authored
    This introduces several simplifications and corrections to the graph
    rewire algorithm, to guarantee unbiased sampling.
    Now a move is outright rejected if it produces a
    self-loop/parallel-edge, instead of retried. This also adds a
    "non-sweep" mode, where edges are rewired randomly, possibly with
    The edge moves are now simplified to the target of the edges only,
    since swaping sources is redundant.
    The number of iterations can now be explicitly modified, so it is not
    necessary to call the function more than once, and it is emphasized in
    the documentation that only after sufficiently many iterations can the
    graph be guaranteed to be fully mixed.