why degree_seq.double_edge_swap(G) gives error?

139 views
Skip to first unread message

Fariba

unread,
Mar 26, 2012, 5:41:18 AM3/26/12
to networkx-discuss
Hi!

For swapping edges between vertices in a network, so far I use
nx.generators.degree_seq.double_edge_swap(G,nswap=edges_size) and it
worked.

However recently it keeps giving me unexpected error :
networkx.exception.NetworkXAlgorithmError: Maximum number of swap
attempts (1001) exceeded before desired swaps achieved (122369).

Since My code was working before, I suspect that something has changed
either in libraries or on my work station.

Have you encountered this problem as well? And how I can fix it?

Dan Schult

unread,
Mar 27, 2012, 11:04:58 AM3/27/12
to networkx...@googlegroups.com
There are two arguments to the double_edge_swap function controlling the
number of swaps and the number of attempted swaps.
See the docstrings, or:
http://networkx.lanl.gov/reference/generated/networkx.algorithms.swap.double_edge_swap.html

Dan

> --
> You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
> To post to this group, send email to networkx...@googlegroups.com.
> To unsubscribe from this group, send email to networkx-discu...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/networkx-discuss?hl=en.
>

Federico Vaggi

unread,
Mar 28, 2012, 8:41:58 AM3/28/12
to networkx-discuss
Dan - I looked at the code for the double_edge_swap function.

Is it worth to make the function automatically raise an error if
nswaps < number of attempted swaps ?
On Mar 27, 5:04 pm, Dan Schult <dsch...@colgate.edu> wrote:
> There are two arguments to the double_edge_swap function controlling the
> number of swaps and the number of attempted swaps.
> See the docstrings, or:  http://networkx.lanl.gov/reference/generated/networkx.algorithms.swap...

Dan Schult

unread,
Mar 28, 2012, 11:03:38 AM3/28/12
to networkx...@googlegroups.com
On Mar 28, 2012, at 8:41 AM, Federico Vaggi wrote:
> Dan - I looked at the code for the double_edge_swap function.
>
> Is it worth to make the function automatically raise an error if
> nswaps < number of attempted swaps ?

I created a ticket for this enhancement:
https://networkx.lanl.gov/trac/ticket/709
Hopefully will fix it later today.

Reply all
Reply to author
Forward
0 new messages