

def edges_iter(self, nbunch=None, data=False):
    'Return an iterator over the edges.\n\n        Edges are returned as tuples with optional data\n        in the order (node, neighbor, data).\n\n        Parameters\n        ----------\n        nbunch : iterable container, optional (default= all nodes)\n            A container of nodes.  The container will be iterated\n            through once.\n        data : bool, optional (default=False)\n            If True, return edge attribute dict in 3-tuple (u,v,data).\n\n        Returns\n        -------\n        edge_iter : iterator\n            An iterator of (u,v) or (u,v,d) tuples of edges.\n\n        See Also\n        --------\n        edges : return a list of edges\n\n        Notes\n        -----\n        Nodes in nbunch that are not in the graph will be (quietly) ignored.\n        For directed graphs this returns the out-edges.\n\n        Examples\n        --------\n        >>> G = nx.Graph()   # or MultiGraph, etc\n        >>> G.add_path([0,1,2,3])\n        >>> [e for e in G.edges_iter()]\n        [(0, 1), (1, 2), (2, 3)]\n        >>> list(G.edges_iter(data=True)) # default data is {} (empty dict)\n        [(0, 1, {}), (1, 2, {}), (2, 3, {})]\n        >>> list(G.edges_iter([0,3]))\n        [(0, 1), (3, 2)]\n        >>> list(G.edges_iter(0))\n        [(0, 1)]\n\n        '
    seen = {
        
    }
    if (nbunch is None):
        nodes_nbrs = self.adj.items()
    else:
        nodes_nbrs = ((n, self.adj[n]) for n in self.nbunch_iter(nbunch))
    if data:
        for (n, nbrs) in nodes_nbrs:
            for (nbr, data) in nbrs.items():
                if (nbr not in seen):
                    (yield (n, nbr, data))
            seen[n] = 1
    else:
        for (n, nbrs) in nodes_nbrs:
            for nbr in nbrs:
                if (nbr not in seen):
                    (yield (n, nbr))
            seen[n] = 1
    del seen

dataset/ETHPy150Open networkx/networkx/networkx/classes/tests/timingclasses.py TimingGraph.edges_iter/original