1616"""
1717 _rows_by_cols(rows_index,cols_index)
1818
19- Returns a vector of columns where each column contains
20- a vector of its row indices.
19+ Returns a vector of columns where each column contains a vector of its row indices.
2120"""
2221function _rows_by_cols (rows_index, cols_index)
2322 return _cols_by_rows (cols_index, rows_index)
2625"""
2726 matrix2graph(sparse_matrix, [partition_by_rows::Bool=true])
2827
29- A utility function to generate a graph from input
30- sparse matrix, columns are represented with vertices
31- and 2 vertices are connected with an edge only if
32- the two columns are mutually orthogonal.
28+ A utility function to generate a graph from input sparse matrix, columns are represented
29+ with vertices and 2 vertices are connected with an edge only if the two columns are mutually
30+ orthogonal.
3331
34- Note that the sparsity pattern is defined by structural nonzeroes, ie includes
35- explicitly stored zeros.
32+ Note that the sparsity pattern is defined by structural nonzeroes, ie includes explicitly
33+ stored zeros.
3634"""
37- function matrix2graph (sparse_matrix:: SparseMatrixCSC {<:Number, Int } ,
35+ function matrix2graph (sparse_matrix:: AbstractSparseMatrix {<:Number} ,
3836 partition_by_rows:: Bool = true )
3937 (rows_index, cols_index, _) = findnz (sparse_matrix)
4038
@@ -43,7 +41,7 @@ function matrix2graph(sparse_matrix::SparseMatrixCSC{<:Number, Int},
4341
4442 num_vtx = partition_by_rows ? nrows : ncols
4543
46- inner = SimpleGraph (num_vtx)
44+ inner = SimpleGraph {promote_type(eltype(rows_index), eltype(cols_index))} (num_vtx)
4745
4846 if partition_by_rows
4947 rows_by_cols = _rows_by_cols (rows_index, cols_index)
0 commit comments