• Tiago Peixoto's avatar
    Rewiring: bugfix, improvements and restructuring resulting in cleaner and faster code · b1e1bc5e
    Tiago Peixoto authored
    Restructure the rewiring code, introducing further abstraction through
    class inheritance.
    Both uncorrelated and correlated cases draw edges directly.
    This has actually proven faster than drawing vertices for the correlated
    case, since realizing that indexes could be stored instead of edges.
    Doing so avoids changes in the pool of candidate edges, which in turn
    removes the need to rebuild it for each edge to rewire.
    Consequently, it also makes the uncorrelated case a lot quicker.
    In the uncorrelated undirected case, the new code also fixes a serious
    bug: when building the edge pool, only one end of each edge was looked
    at, because the "edges" vector is not equivalent to drawing all
    out_edges from all vertices, as is done now.