def test_nodelist(self):
        P4 = path_graph(4)
        P3 = path_graph(3)
        nodelist = P3.nodes()
        A = nx.to_scipy_sparse_matrix(P4, nodelist=nodelist)
        GA = nx.Graph(A)
        self.assert_equal(GA, P3)

        # Make nodelist ambiguous by containing duplicates.
        nodelist += [nodelist[0]]
        assert_raises(nx.NetworkXError, nx.to_numpy_matrix, P3, 
                      nodelist=nodelist)
Conversion from graph to sparse matrix to graph with nodelist.
dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/tests/test_convert_scipy.py/TestConvertNumpy.test_nodelist