def subgraph(self, nbunch):
        bunch =self.nbunch_iter(nbunch)
        # create new graph and copy subgraph into it
        H = self.__class__()
        # copy node and attribute dictionaries
        for n in bunch:
            H.node[n]=self.node[n]
        # namespace shortcuts for speed
        H_adj=H.adj
        self_adj=self.adj
        # add nodes and edges (undirected method)
        for n in H.node:
            Hnbrs={}
            H_adj[n]=Hnbrs
            for nbr,d in self_adj[n].items():
                if nbr in H_adj:
                    # add both representations of edge: n-nbr and nbr-n
                    Hnbrs[nbr]=d
                    H_adj[nbr][n]=d
        H.graph=self.graph
        return H
Test wire.Discard protocol.
dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py/TimingGraph.subgraph--crossover with--dataset/ETHPy150Open twisted/twisted/twisted/test/test_protocols.py/WireTests.test_discard