Yes, they are isomorphic. You can control the ordering in the output
by specifying the "nodelist" parameter like this:
In [1]: import networkx as nx
In [2]: G=nx.grid_graph(dim=[2,2])
In [3]: nx.adj_matrix(G)
Out[3]:
matrix([[ 0., 0., 1., 1.],
[ 0., 0., 1., 1.],
[ 1., 1., 0., 0.],
[ 1., 1., 0., 0.]])
In [4]: nx.adj_matrix(G,nodelist=sorted(G.nodes()))
Out[4]:
matrix([[ 0., 1., 1., 0.],
[ 1., 0., 0., 1.],
[ 1., 0., 0., 1.],
[ 0., 1., 1., 0.]])
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.
Essentially, rewiring starting from a lattice lets you choose
(by choosing p) where your network will be between a lattice
and gnp random graph. If you start with a different network your
choice of p will put you somewhere between a gnp random network
and what you started with. Watts and Strogatz's article shows
that somewhere along that range of p-values, the networks have
the small world property. I suspect it would be true if you
started with a grid graph that for some values of p you would also
have that property, but I don't have a guarantee.
Even the Watts Strogatz algorithm won't give a small world graph
unless you choose p to be in the right range.
I would suggest that you try creating a function using the last
lines of the watts_strogatz_graph code if you are interested in
tweaking their model to start with other graphs. If that is useful
to others, we could include it in networkx somewhere....
Dan