watts-strogatz graph family - a bug in connecting neighbors?

19 views
Skip to first unread message

Alexander Gogolev

unread,
Feb 5, 2012, 10:42:22 AM2/5/12
to networkx...@googlegroups.com
Good day everybody!

Why do watts_strogatz graph generators (Connected, Newman and simple) assign NOT the closest neighbors to each node, with rewiring probability =0, starting with number of nodes = 33?
I mean, when I generate graph with up to 32 nodes with 6 neighbors, and zero rewiring probability, I always get  three closest left neighbors and 3 closest right neighbors.
If number of nodes is higher, then 32 (still with zero rewiring probability), then sometimes G.neighbors_iter(i) returns more distant nodes, than actually neighboring i-node. 

It happens not only on the boundaries, the same noticed with nodes in the middle

Is this a feature, or a bug?


--
Respectfully yours,
Alexander E. Gogolev

Aric Hagberg

unread,
Feb 5, 2012, 3:52:33 PM2/5/12
to networkx...@googlegroups.com

It could be a bug. Can you post a small code example that shows the problem?
Aric

Alexander Gogolev

unread,
Feb 6, 2012, 6:28:50 AM2/6/12
to networkx...@googlegroups.com
Thanks for a fast reply, Aric,

but It looks like it was a false alarm and I already sorted it out.
It's not a bug of neighbors connection.
It's just G.neighbors_iter() returns unsorted list of neighbors, starting with 33 nodes in the graph, and up to 32 nodes it returns a kind of a "sorted list".

I needed to sort neighbors in two lists, to perform a GKL rule:
[ left neighbors with reversed order ]
[ right neighbors with regular order ]

I tested procedure with small numbers, so with bigger ones it didn't work as I thought it should.
So, I inserted a middle sorted list, and now everything works fine even with bigger numbers)

Aric

--
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.

Reply all
Reply to author
Forward
0 new messages