Skip to content

relabel_nodes adds a graph attribute when copy=True #2134

@movermeyer

Description

@movermeyer

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions