Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relabel_nodes adds a graph attribute when copy=True #2134

Closed
movermeyer opened this issue May 17, 2016 · 1 comment
Closed

relabel_nodes adds a graph attribute when copy=True #2134

movermeyer opened this issue May 17, 2016 · 1 comment

Comments

@movermeyer
Copy link

I would have expected the following to work:

import networkx as nx
graph_a = nx.DiGraph()
graph_b = nx.relabel_nodes(graph_a, {}, copy=True)
print "graph_a.graph", graph_a.graph
print "graph_b.graph", graph_b.graph
assert graph_a.graph == graph_b.graph

However, it does not since _relabel_copy attempts to copy a non-existent graph attribute, 'name'.

I would have expected relabel_nodes to only change the node labels, while maintaining all graph/node/edge attributes.

@dschult
Copy link
Member

dschult commented May 19, 2016

I agree that this handles the 'name' attribute incorrectly. Fix is on the way.

dschult added a commit to dschult/networkx that referenced this issue May 19, 2016
Fixes networkx#2134
simplifies read_gml handling of "name" as well.
@dschult dschult added this to the networkx-2.0 milestone May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants