diff --git a/networkx/readwrite/gml.py b/networkx/readwrite/gml.py
index b6ab5e9eb..af8db1d00 100644
--- a/networkx/readwrite/gml.py
+++ b/networkx/readwrite/gml.py
@@ -435,10 +435,6 @@ def parse_gml_lines(lines, label, destringizer):
 
     if label != 'id':
         G = nx.relabel_nodes(G, mapping)
-        if 'name' in graph:
-            G.graph['name'] = graph['name']
-        else:
-            del G.graph['name']
     return G
 
 
diff --git a/networkx/relabel.py b/networkx/relabel.py
index ca069c950..8f885432c 100644
--- a/networkx/relabel.py
+++ b/networkx/relabel.py
@@ -147,7 +147,8 @@ def _relabel_inplace(G, mapping):
 
 def _relabel_copy(G, mapping):
     H = G.__class__()
-    H.name = "(%s)" % G.name
+    if G.name:
+        H.name = "(%s)" % G.name
     if G.is_multigraph():
         H.add_edges_from( (mapping.get(n1, n1),mapping.get(n2, n2),k,d.copy())
                           for (n1,n2,k,d) in G.edges(keys=True, data=True))

relabel_nodes adds a graph attribute when copy=True
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'](https://github.com/networkx/networkx/blob/1675a824d6cdb17c3144ef46ff52a0c2b53a11d1/networkx/relabel.py#L150).

I would have expected relabel_nodes to only change the node labels, while maintaining all graph/node/edge attributes.
diff --git a/networkx/tests/test_relabel.py b/networkx/tests/test_relabel.py
index 682de98a0..65c29eeab 100644
--- a/networkx/tests/test_relabel.py
+++ b/networkx/tests/test_relabel.py
@@ -150,6 +150,17 @@ class TestRelabel():
         mapping={0:'aardvark'}
         G=relabel_nodes(G,mapping,copy=False)
 
+    def test_relabel_copy_name(self):
+        G=Graph()
+        H = relabel_nodes(G, {}, copy=True)
+        assert_equal(H.graph, G.graph)
+        H = relabel_nodes(G, {}, copy=False)
+        assert_equal(H.graph, G.graph)
+        G.name = "first"
+        H = relabel_nodes(G, {}, copy=True)
+        assert_equal(H.graph, G.graph)
+        H = relabel_nodes(G, {}, copy=False)
+        assert_equal(H.graph, G.graph)
 
     def test_relabel_toposort(self):
         K5=nx.complete_graph(4)

pip install -e .
parse_log_pytest
requirements.txt
nose pytest
apt-get update apt-get install -y libgdal-dev graphviz
3.6
requirements/default.txt requirements/test.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
decorator==5.1.1
importlib-metadata==4.8.3
iniconfig==1.1.1
-e git+https://github.com/networkx/networkx.git@5aefafab2f05b97b150c6bf681c21ba6465c8d10#egg=networkx
nose==1.3.7
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0

name: networkx
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - decorator==5.1.1
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - nose==1.3.7
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/networkx

networkx/tests/test_relabel.py::TestRelabel::test_relabel_copy_name
networkx/tests/test_relabel.py::test
networkx/tests/test_relabel.py::TestRelabel::test_convert_node_labels_to_integers networkx/tests/test_relabel.py::TestRelabel::test_convert_to_integers2 networkx/tests/test_relabel.py::TestRelabel::test_convert_to_integers_raise networkx/tests/test_relabel.py::TestRelabel::test_relabel_nodes_copy networkx/tests/test_relabel.py::TestRelabel::test_relabel_nodes_function networkx/tests/test_relabel.py::TestRelabel::test_relabel_nodes_graph networkx/tests/test_relabel.py::TestRelabel::test_relabel_nodes_digraph networkx/tests/test_relabel.py::TestRelabel::test_relabel_nodes_multigraph networkx/tests/test_relabel.py::TestRelabel::test_relabel_nodes_multidigraph networkx/tests/test_relabel.py::TestRelabel::test_relabel_isolated_nodes_to_same networkx/tests/test_relabel.py::TestRelabel::test_relabel_nodes_missing networkx/tests/test_relabel.py::TestRelabel::test_relabel_toposort networkx/tests/test_relabel.py::TestRelabel::test_relabel_selfloop
networkx/readwrite/gml.py networkx/relabel.py
networkx/readwrite/gml.py networkx/relabel.py