Something is strange there....
If the source code uses deepcopy and you use deepcopy they
should return the same thing. Can you give a short
example that shows the shallow copy? The docs
should probably use the word "deep" instead of
"complete", but if it is actually shallow, that
is a bug. Is it possible that you are running a
different version than the source code you are
looking at? The shallow/deep choice for copy()
has changed over the versions.
Dan
This code seems to work:
class node(dict):
def __hash__(self):
return len(self)
class edge(dict):
pass
>>> G=nx.Graph()
>>> n1=node(size=1)
>>> n2=node(size=2)
>>> G.add_edge(n1,n2,edge(weight=4))
>>> H=G.copy()
>>> H[n1][n2]['color']='red'
>>> for n in H: n[2]=3
...
>>> H.adj
{{2: 3, 'size': 2}: {{2: 3, 'size': 3}: {'color': 'red', 'weight': 4}},
{2: 3, 'size': 3}: {{2: 3, 'size': 2}: {'color': 'red', 'weight': 4}}}
>>> G.adj
{{'size': 2}: {{'size': 3}: {'weight': 4}},
{'size': 3}: {{'size': 2}: {'weight': 4}}}