Date: Saturday, December 16, 2017 @ 10:11:49 Author: arojas Revision: 274557
Update networkx patch Modified: sagemath-doc/trunk/PKGBUILD sagemath-doc/trunk/sagemath-networkx2.patch --------------------------+ PKGBUILD | 2 sagemath-networkx2.patch | 174 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 173 insertions(+), 3 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2017-12-16 09:44:12 UTC (rev 274556) +++ PKGBUILD 2017-12-16 10:11:49 UTC (rev 274557) @@ -29,7 +29,7 @@ '28d7789b8d777922ab8871ca43b6afab751428cae875c0343d3962e6a2030b88' 'bfd2a20a33ab19a8a8b216a77d07f62e809fe1e1879c4f171ce5dca62fd482e9' '28d7789b8d777922ab8871ca43b6afab751428cae875c0343d3962e6a2030b88' - '37c5c1e694a2aca06c0f1c7d99622ff81fd2bc6a51e8745762294889fa4673f6' + '1024f3a6a9a1a6ae96d9962bb7d1f5842f4a4a5ff5098afad81a60188b7d5160' 'a52d03e04c9d64bb957a1f8dcdae3280ebb9450a7fd76aaf5ae5de5c6f74774f' '538f7b279d72f4b67edb445d386d267f3f7022c1079031ca7ea06f6ce392c906' 'b9ab2bb5f381ea425e8763b81b8b3a108a3951c594fb1f37f7df921e7c77e26d' Modified: sagemath-networkx2.patch =================================================================== --- sagemath-networkx2.patch 2017-12-16 09:44:12 UTC (rev 274556) +++ sagemath-networkx2.patch 2017-12-16 10:11:49 UTC (rev 274557) @@ -1,5 +1,62 @@ +diff --git a/src/sage/graphs/base/graph_backends.pyx b/src/sage/graphs/base/graph_backends.pyx +index ff1d02900a..bad4a18539 100644 +--- a/src/sage/graphs/base/graph_backends.pyx ++++ b/src/sage/graphs/base/graph_backends.pyx +@@ -800,9 +800,9 @@ class NetworkXGraphDeprecated(SageObject): + sage: X.multiedges = True + sage: G = X.mutate() + sage: G.edges() +- [(1, 2), (2, 3)] ++ MultiEdgeDataView([(1, 2), (2, 3)]) + sage: G.edges(data=True) +- [(1, 2, {'weight': 7}), (2, 3, {4: {}, 5: {}, 6: {}, 7: {}})] ++ MultiEdgeDataView([(1, 2, {'weight': 7}), (2, 3, {4: {}, 5: {}, 6: {}, 7: {}})]) + + """ + import networkx +@@ -868,11 +868,9 @@ class NetworkXDiGraphDeprecated(SageObject): + sage: X.multiedges = True + sage: G = X.mutate() + sage: G.edges() +- [(1, 2), (2, 1), (2, 3)] ++ OutMultiEdgeDataView([(1, 2), (2, 1), (2, 3)]) + sage: G.edges(data=True) +- [(1, 2, {'weight': 7}), +- (2, 1, {7: {}, 8: {}}), +- (2, 3, {4: {}, 5: {}, 6: {}, 7: {}})] ++ OutMultiEdgeDataView([(1, 2, {'weight': 7}), (2, 1, {8: {}, 7: {}}), (2, 3, {4: {}, 5: {}, 6: {}, 7: {}})]) + + """ + import networkx +@@ -1158,7 +1156,7 @@ class NetworkXGraphBackend(GenericGraphBackend): + import networkx + try: + if self._nxg.is_multigraph(): +- for k,d in self._nxg.edge[u][v].iteritems(): ++ for u0,v0,k,d in self._nxg.edges([u,v],True,keys=True): + if d.get('weight',None) == l: + self._nxg.remove_edge(u,v,k) + break +@@ -1227,7 +1225,7 @@ class NetworkXGraphBackend(GenericGraphBackend): + """ + cdef dict E + try: +- E = self._nxg.edge[u][v] ++ E = self._nxg.edges[u,v,0] + except KeyError: + from networkx import NetworkXError + raise NetworkXError("Edge (%s,%s) requested via get_edge_label does not exist."%(u,v)) +@@ -1416,7 +1414,7 @@ class NetworkXGraphBackend(GenericGraphBackend): + sage: G.iterator_nbrs(0) + <dictionary-keyiterator object at ...> + """ +- return self._nxg.neighbors_iter(v) ++ return self._nxg.neighbors(v) + + def iterator_in_nbrs(self, v): + """ diff --git a/src/sage/graphs/digraph.py b/src/sage/graphs/digraph.py -index 8c29602da6..e7a185d586 100644 +index 003a8d6bcb..986137a9b0 100644 --- a/src/sage/graphs/digraph.py +++ b/src/sage/graphs/digraph.py @@ -755,7 +755,7 @@ class DiGraph(GenericGraph): @@ -11,10 +68,96 @@ elif format == 'igraph': if not data.is_directed(): raise ValueError("A *directed* igraph graph was expected. To "+ +@@ -2844,7 +2844,7 @@ class DiGraph(GenericGraph): + Using the NetworkX implementation :: + + sage: D.topological_sort(implementation = "NetworkX") +- [4, 5, 6, 9, 0, 1, 2, 3, 7, 8, 10] ++ [4, 5, 6, 9, 0, 3, 2, 7, 1, 8, 10] + + Using the NetworkX recursive implementation :: + +@@ -2870,9 +2870,7 @@ class DiGraph(GenericGraph): + sage: D = DiGraph({ 0:[1,2,3], 4:[2,5], 1:[8], 2:[7], 3:[7], + ....: 5:[6,7], 7:[8], 6:[9], 8:[10], 9:[10] }) + sage: N = D.networkx_graph() +- sage: networkx.topological_sort(N) +- [4, 5, 6, 9, 0, 1, 2, 3, 7, 8, 10] +- sage: networkx.topological_sort_recursive(N) ++ sage: list(networkx.topological_sort(N)) + [4, 5, 6, 9, 0, 3, 2, 7, 1, 8, 10] + + TESTS: +@@ -2895,10 +2893,7 @@ class DiGraph(GenericGraph): + + elif implementation == "NetworkX" or implementation == "recursive": + import networkx +- if implementation == "NetworkX": +- S = networkx.topological_sort(self.networkx_graph(copy=False)) +- else: +- S = networkx.topological_sort_recursive(self.networkx_graph(copy=False)) ++ S = list(networkx.topological_sort(self.networkx_graph(copy=False))) + if S is None: + raise TypeError('Digraph is not acyclic; there is no topological sort.') + else: +diff --git a/src/sage/graphs/generators/basic.py b/src/sage/graphs/generators/basic.py +index 8777b95c4b..28ef7e48f2 100644 +--- a/src/sage/graphs/generators/basic.py ++++ b/src/sage/graphs/generators/basic.py +@@ -437,7 +437,7 @@ def CompleteBipartiteGraph(n1, n2): + + Compare the plotting:: + +- sage: n = networkx.complete_bipartite_graph(11,17) ++ sage: n = networkx.complete_bipartite_graph(11r,17r) + sage: spring_med = Graph(n) + sage: posdict_med = graphs.CompleteBipartiteGraph(11,17) + +@@ -469,7 +469,7 @@ def CompleteBipartiteGraph(n1, n2): + sage: g = [] + sage: j = [] + sage: for i in range(9): +- ....: spr = networkx.complete_bipartite_graph(i+1,4) ++ ....: spr = networkx.complete_bipartite_graph(int(i+1),4r) + ....: k = Graph(spr) + ....: g.append(k) + sage: for i in range(3): +diff --git a/src/sage/graphs/generators/families.py b/src/sage/graphs/generators/families.py +index 8f81333685..1540ec0dcc 100644 +--- a/src/sage/graphs/generators/families.py ++++ b/src/sage/graphs/generators/families.py +@@ -197,7 +197,7 @@ def BalancedTree(r, h): + gracefully:: + + sage: graphs.BalancedTree(1, 10) +- Balanced tree: Graph on 2 vertices ++ Balanced tree: Graph on 11 vertices + + sage: graphs.BalancedTree(-1, 10) + Balanced tree: Graph on 1 vertex +@@ -208,9 +208,6 @@ def BalancedTree(r, h): + sage: graphs.BalancedTree(3, 0) + Balanced tree: Graph on 1 vertex + +- sage: graphs.BalancedTree(5, -2) +- Balanced tree: Graph on 0 vertices +- + sage: graphs.BalancedTree(-2,-2) + Balanced tree: Graph on 0 vertices + """ diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py -index b63135d8e6..5775042976 100644 +index 3550f990ef..490813e619 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py +@@ -108,7 +108,7 @@ examples are covered here. + :: + + sage: import networkx +- sage: K = networkx.complete_bipartite_graph(12,7) ++ sage: K = networkx.complete_bipartite_graph(12r,7r) + sage: G = Graph(K) + sage: G.degree() + [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 12, 12, 12, 12, 12, 12, 12] @@ -1199,7 +1199,7 @@ class Graph(GenericGraph): self.allow_loops(loops, check=False) self.allow_multiple_edges(multiedges, check=False) @@ -24,3 +167,30 @@ elif format == 'igraph': if data.is_directed(): raise ValueError("An *undirected* igraph graph was expected. "+ +@@ -4600,7 +4600,7 @@ class Graph(GenericGraph): + + sage: g = Graph([(0,1,0), (1,2,999), (2,3,-5)]) + sage: g.matching(use_edge_labels=True) +- [(1, 2, 999)] ++ [(0, 1, 0), (2, 3, -5)] + sage: g.matching(algorithm="LP", use_edge_labels=True) + [(1, 2, 999)] + +@@ -6288,7 +6288,7 @@ class Graph(GenericGraph): + return networkx.number_of_cliques(self.networkx_graph(copy=False), vertices, cliques) + + @doc_index("Clique-related methods") +- def cliques_get_max_clique_graph(self, name=''): ++ def cliques_get_max_clique_graph(self): + """ + Returns a graph constructed with maximal cliques as vertices, and + edges between maximal cliques with common members in the original +@@ -6317,7 +6317,7 @@ class Graph(GenericGraph): + sage: (G.cliques_get_max_clique_graph()).show(figsize=[2,2]) + """ + import networkx +- return Graph(networkx.make_max_clique_graph(self.networkx_graph(copy=False), name=name, create_using=networkx.MultiGraph())) ++ return Graph(networkx.make_max_clique_graph(self.networkx_graph(copy=False), create_using=networkx.MultiGraph())) + + @doc_index("Clique-related methods") + def cliques_get_clique_bipartite(self, **kwds):