[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#684212: unblock: python-networkx/1.7~rc1-3



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package python-networkx

It includes an upstream patch to fix a FTBFS bug in nypype .

unblock python-networkx/1.7~rc1-3

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.4-trunk-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Index: debian/patches/changeset_9ebe087b8bbcdeee3051e07cacd05fa07436c16e.diff
===================================================================
--- debian/patches/changeset_9ebe087b8bbcdeee3051e07cacd05fa07436c16e.diff	(revision 0)
+++ debian/patches/changeset_9ebe087b8bbcdeee3051e07cacd05fa07436c16e.diff	(revision 0)
@@ -0,0 +1,59 @@
+From 9ebe087b8bbcdeee3051e07cacd05fa07436c16e Mon Sep 17 00:00:00 2001
+From: Aric Hagberg <aric.hagberg@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
+
Index: debian/patches/series
===================================================================
--- debian/patches/series	(revision 22488)
+++ debian/patches/series	(working copy)
@@ -4,3 +4,4 @@
 40_no_setuptools_in_requires.txt
 changeset_fed4cb6e78dc7047c06522b0418ef5b0d8197290.diff
 changeset_8960521b5ae4897bdbac4ff49525d8b37bff88d2.diff
+changeset_9ebe087b8bbcdeee3051e07cacd05fa07436c16e.diff
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 22488)
+++ debian/changelog	(working copy)
@@ -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@debian.org>  Tue, 07 Aug 2012 22:07:59 +0200
+
 python-networkx (1.7~rc1-2) unstable; urgency=low
 
   * debian/patches/changeset_8960521b5ae4897bdbac4ff49525d8b37bff88d2.diff

Reply to: