[Scipy-tickets] [SciPy] #1681: csgraph.laplacian gives incorrect results

SciPy Trac scipy-tickets@scipy....
Fri Jun 22 16:54:21 CDT 2012


#1681: csgraph.laplacian gives incorrect results
--------------------------+-------------------------------------------------
 Reporter:  pv            |       Owner:  somebody
     Type:  defect        |      Status:  new     
 Priority:  highest       |   Milestone:  0.11.0  
Component:  scipy.sparse  |     Version:  0.10.0  
 Keywords:                |  
--------------------------+-------------------------------------------------
 Release blocker:
 {{{
 from scipy import sparse
 from scipy.sparse import csgraph

 g = sparse.diags([1, 1], [-1, 1], shape=(4, 4))
 print csgraph.laplacian(g).todense()
 # [[-3.  1.  1.  1.]
 #  [ 1. -3.  1.  1.]
 #  [ 1.  1. -3.  1.]
 #  [ 1.  1.  1. -3.]]
 # Wrong!

 # This works:
 print csgraph.laplacian(g.todense())
 # [[ 1. -1. -0. -0.]
 #  [-1.  2. -1. -0.]
 #  [-0. -1.  2. -1.]
 #  [-0. -0. -1.  1.]]
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1681>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list