Ticket #13699: trac_13699-edge_iterators.patch

File trac_13699-edge_iterators.patch, 2.8 KB (added by ncohen, 8 years ago)
  • sage/graphs/generic_graph.py

    # HG changeset patch
    # User dcoudert <david.coudert@inria.fr>
    # Date 1334662567 -7200
    # Node ID 7698b70c0b75017f39a8120028c5b297a1ae6ab5
    # Parent  768831677eeec19e2a87ddf41c51716d12073f78
    Use of edge iterator in graph products
    
    diff --git a/sage/graphs/generic_graph.py b/sage/graphs/generic_graph.py
    a b  
    1359113591        else:
    1359213592            raise TypeError('the graphs should be both directed or both undirected')
    1359313593        G.add_vertices( [(u,v) for u in self for v in other] )
    13594         for u,w in self.edges(labels=None):
    13595             for v,x in other.edges(labels=None):
     13594        for u,w in self.edge_iterator(labels=None):
     13595            for v,x in other.edge_iterator(labels=None):
    1359613596                G.add_edge((u,v), (w,x))
    1359713597                if not G._directed:
    1359813598                    G.add_edge((u,x), (w,v))
     
    1365813658        else:
    1365913659            raise TypeError('the graphs should be both directed or both undirected')
    1366013660        G.add_vertices( [(u,v) for u in self for v in other] )
    13661         for u,w in self.edges(labels=None):
     13661        for u,w in self.edge_iterator(labels=None):
    1366213662            for v in other:
    1366313663                for x in other:
    1366413664                    G.add_edge((u,v), (w,x))
    1366513665        for u in self:
    13666             for v,x in other.edges(labels=None):
     13666            for v,x in other.edge_iterator(labels=None):
    1366713667                G.add_edge((u,v), (u,x))
    1366813668        return G
    1366913669
     
    1374413744            raise TypeError('the graphs should be both directed or both undirected')
    1374513745
    1374613746        G.add_vertices( [(u,v) for u in self for v in other] )
    13747         for u,w in self.edges(labels=None):
     13747        for u,w in self.edge_iterator(labels=None):
    1374813748            for v in other:
    1374913749                G.add_edge((u,v), (w,v))
    13750             for v,x in other.edges(labels=None):
     13750            for v,x in other.edge_iterator(labels=None):
    1375113751                G.add_edge((u,v), (w,x))
    1375213752                if not self._directed:
    1375313753                    G.add_edge((w,v), (u,x))
    13754         for v,x in other.edges(labels=None):
     13754        for v,x in other.edge_iterator(labels=None):
    1375513755            for u in self:
    1375613756                G.add_edge((u,v), (u,x))
    1375713757        return G
     
    1381213812            raise TypeError('the graphs should be both directed or both undirected')
    1381313813
    1381413814        G.add_vertices( [(u,v) for u in self for v in other] )
    13815         for u,w in self.edges(labels=None):
     13815        for u,w in self.edge_iterator(labels=None):
    1381613816            for v in other:
    1381713817                for x in other:
    1381813818                    G.add_edge((u,v), (w,x))
    13819         for v,x in other.edges(labels=None):
     13819        for v,x in other.edge_iterator(labels=None):
    1382013820            for u in self:
    1382113821                for w in self:
    1382213822                    G.add_edge((u,v), (w,x))