[Python-modules-commits] r22489 - in packages/python-networkx/trunk/debian (3 files)

morph at users.alioth.debian.org morph at users.alioth.debian.org
Tue Aug 7 20:10:07 UTC 2012


    Date: Tuesday, August 7, 2012 @ 20:10:05
  Author: morph
Revision: 22489

* debian/patches/changeset_9ebe087b8bbcdeee3051e07cacd05fa07436c16e.diff
  - Preserver order in G.nodes(), fixing a FTBFS in nipype; thanks to Yaroslav
    Halchenko for the report and analysis; Closes: #684107

Added:
  packages/python-networkx/trunk/debian/patches/changeset_9ebe087b8bbcdeee3051e07cacd05fa07436c16e.diff
Modified:
  packages/python-networkx/trunk/debian/changelog
  packages/python-networkx/trunk/debian/patches/series

Modified: packages/python-networkx/trunk/debian/changelog
===================================================================
--- packages/python-networkx/trunk/debian/changelog	2012-08-06 19:17:50 UTC (rev 22488)
+++ packages/python-networkx/trunk/debian/changelog	2012-08-07 20:10:05 UTC (rev 22489)
@@ -1,3 +1,11 @@
+python-networkx (1.7~rc1-3) UNRELEASED; urgency=low
+
+  * debian/patches/changeset_9ebe087b8bbcdeee3051e07cacd05fa07436c16e.diff
+    - Preserver order in G.nodes(), fixing a FTBFS in nipype; thanks to Yaroslav
+      Halchenko for the report and analysis; Closes: #684107
+
+ -- Sandro Tosi <morph at debian.org>  Tue, 07 Aug 2012 22:07:59 +0200
+
 python-networkx (1.7~rc1-2) unstable; urgency=low
 
   * debian/patches/changeset_8960521b5ae4897bdbac4ff49525d8b37bff88d2.diff

Added: packages/python-networkx/trunk/debian/patches/changeset_9ebe087b8bbcdeee3051e07cacd05fa07436c16e.diff
===================================================================
--- packages/python-networkx/trunk/debian/patches/changeset_9ebe087b8bbcdeee3051e07cacd05fa07436c16e.diff	                        (rev 0)
+++ packages/python-networkx/trunk/debian/patches/changeset_9ebe087b8bbcdeee3051e07cacd05fa07436c16e.diff	2012-08-07 20:10:05 UTC (rev 22489)
@@ -0,0 +1,59 @@
+From 9ebe087b8bbcdeee3051e07cacd05fa07436c16e Mon Sep 17 00:00:00 2001
+From: Aric Hagberg <aric.hagberg at gmail.com>
+Date: Fri, 29 Jun 2012 21:30:38 -0600
+Subject: [PATCH] Preserver order in G.nodes() or given in nodelist when
+ converting to scipy sparse matrix.  Update docs to reflect
+ use of COO matrix. Addresses #737
+
+---
+ networkx/convert.py                  |    8 +++++---
+ networkx/tests/test_convert_scipy.py |    8 ++++++++
+ 2 files changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/networkx/convert.py b/networkx/convert.py
+index 833c754..6333b9f 100644
+--- a/networkx/convert.py
++++ b/networkx/convert.py
+@@ -745,7 +745,7 @@ def to_scipy_sparse_matrix(G, nodelist=None, dtype=None,
+     When `nodelist` does not contain every node in `G`, the matrix is built
+     from the subgraph of `G` that is induced by the nodes in `nodelist`.
+ 
+-    Uses lil_matrix format. To convert to other formats specify the
++    Uses coo_matrix format. To convert to other formats specify the
+     format= keyword.
+ 
+     Examples
+@@ -777,10 +777,12 @@ def to_scipy_sparse_matrix(G, nodelist=None, dtype=None,
+     nlen = len(nodelist)
+     if nlen == 0:
+         raise nx.NetworkXError("Graph has no nodes or edges")
+-    index = dict(zip(set(nodelist),range(nlen)))
+-    if len(nodelist) != len(index):
++
++    if len(nodelist) != len(set(nodelist)):
+         msg = "Ambiguous ordering: `nodelist` contained duplicates."
+         raise nx.NetworkXError(msg)
++
++    index = dict(zip(nodelist,range(nlen)))
+     if G.number_of_edges() == 0:
+         row,col,data=[],[],[]
+     else:
+diff --git a/networkx/tests/test_convert_scipy.py b/networkx/tests/test_convert_scipy.py
+index 27ab786..f90dee7 100644
+--- a/networkx/tests/test_convert_scipy.py
++++ b/networkx/tests/test_convert_scipy.py
+@@ -169,3 +169,11 @@ class TestConvertNumpy(object):
+         G.add_node(1)
+         M = nx.to_scipy_sparse_matrix(G)
+         np_assert_equal(M.todense(), np.matrix([[0]]))
++
++    def test_ordering(self):
++        G = nx.DiGraph()
++        G.add_edge(1,2)
++        G.add_edge(2,3)
++        G.add_edge(3,1)
++        M = nx.to_scipy_sparse_matrix(G,nodelist=[3,2,1])
++        np_assert_equal(M.todense(), np.matrix([[0,0,1],[1,0,0],[0,1,0]]))
+-- 
+1.7.10.4
+

Modified: packages/python-networkx/trunk/debian/patches/series
===================================================================
--- packages/python-networkx/trunk/debian/patches/series	2012-08-06 19:17:50 UTC (rev 22488)
+++ packages/python-networkx/trunk/debian/patches/series	2012-08-07 20:10:05 UTC (rev 22489)
@@ -4,3 +4,4 @@
 40_no_setuptools_in_requires.txt
 changeset_fed4cb6e78dc7047c06522b0418ef5b0d8197290.diff
 changeset_8960521b5ae4897bdbac4ff49525d8b37bff88d2.diff
+changeset_9ebe087b8bbcdeee3051e07cacd05fa07436c16e.diff




More information about the Python-modules-commits mailing list