16
16
"""
17
17
_rows_by_cols(rows_index,cols_index)
18
18
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.
21
20
"""
22
21
function _rows_by_cols (rows_index, cols_index)
23
22
return _cols_by_rows (cols_index, rows_index)
26
25
"""
27
26
matrix2graph(sparse_matrix, [partition_by_rows::Bool=true])
28
27
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.
33
31
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.
36
34
"""
37
- function matrix2graph (sparse_matrix:: SparseMatrixCSC {<:Number, Int } ,
35
+ function matrix2graph (sparse_matrix:: AbstractSparseMatrix {<:Number} ,
38
36
partition_by_rows:: Bool = true )
39
37
(rows_index, cols_index, _) = findnz (sparse_matrix)
40
38
@@ -43,7 +41,7 @@ function matrix2graph(sparse_matrix::SparseMatrixCSC{<:Number, Int},
43
41
44
42
num_vtx = partition_by_rows ? nrows : ncols
45
43
46
- inner = SimpleGraph (num_vtx)
44
+ inner = SimpleGraph {promote_type(eltype(rows_index), eltype(cols_index))} (num_vtx)
47
45
48
46
if partition_by_rows
49
47
rows_by_cols = _rows_by_cols (rows_index, cols_index)
0 commit comments