API reference
Public
ColPack.ColPack
— ModuleColPack.ColPackColoring
— TypeColPackColoring
Struct holding the parameters of a coloring as well as its results (which can be queried with get_colors
).
Constructors
ColPackColoring(
filename::AbstractString,
method::String,
order::String;
verbose::Bool=false
)
ColPackColoring(
M::SparseMatrixCSC,
method::String,
order::String;
verbose::Bool=false
)
Perform the coloring of a matrix that is either given directly or read from a .mtx
file.
The users needs to specify
- a coloring
method
among["DISTANCE_ONE", "ACYCLIC", "ACYCLIC_FOR_INDIRECT_RECOVERY", "STAR", "RESTRICTED_STAR", "DISTANCE_TWO"]
- an
order
on the vertices among["NATURAL", "RANDOM", "LARGEST_FIRST", "SMALLEST_LAST", "DYNAMIC_LARGEST_FIRST", "INCIDENCE_DEGREE"]
Example
julia> using ColPack, SparseArrays
julia> H = sparse([1 1 1; 1 1 0; 1 0 1])
3×3 SparseMatrixCSC{Int64, Int64} with 7 stored entries:
1 1 1
1 1 ⋅
1 ⋅ 1
julia> get_colors(ColPackColoring(H, "STAR", "NATURAL"))
3-element Vector{Int32}:
1
2
2
Fields
The fields of this struct are not part of the public API, they are only useful to interface with the C++ library ColPack.
ColPack.ColPackPartialColoring
— TypeColPackPartialColoring
Struct holding the parameters of a partial coloring as well as its results (which can be queried with get_colors
).
Constructors
ColPackPartialColoring(
filename::AbstractString,
method::String,
order::String;
verbose::Bool=false
)
ColPackPartialColoring(
M::SparseMatrixCSC,
method::String,
order::String;
verbose::Bool=false
)
Perform the partial coloring of a matrix that is either given directly or read from a .mtx
file.
The users needs to specify:
- a partial coloring
method
among["COLUMN_PARTIAL_DISTANCE_TWO", "ROW_PARTIAL_DISTANCE_TWO"]
- an
order
on the vertices among["NATURAL", "RANDOM", "LARGEST_FIRST", "SMALLEST_LAST", "INCIDENCE_DEGREE"]
To perform a partial column coloring of a CSC matrix, we actually perform a partial row coloring of its transpose (which is a CSR matrix). Thus, the coloring results will in general differ between the file API and the matrix API.
Example
julia> using ColPack, SparseArrays
julia> J = sparse([1 0 1; 1 1 0])
2×3 SparseMatrixCSC{Int64, Int64} with 4 stored entries:
1 ⋅ 1
1 1 ⋅
julia> get_colors(ColPackPartialColoring(J, "COLUMN_PARTIAL_DISTANCE_TWO", "NATURAL"))
3-element Vector{Int32}:
1
2
2
Fields
The fields of this struct are not part of the public API, they are only useful to interface with the C++ library ColPack.
ColPack.get_colors
— Methodget_colors(coloring::ColPackBiColoring)
Retrieve the colors from a ColPackBiColoring
as two vectors of integers, one for the rows and one for the columns respectively.
ColPack.get_colors
— Methodget_colors(coloring::ColPackColoring)
Retrieve the colors from a ColPackColoring
as a vector of integers.
ColPack.get_colors
— Methodget_colors(coloring::ColPackPartialColoring)
Retrieve the colors from a ColPackPartialColoring
as a vector of integers.
Internals
ColPack.ColPackBiColoring
— TypeColPackBiColoring
Struct holding the parameters of a bicoloring as well as its results (which can be queried with get_colors
).
This is still experimental and not protected by semantic versioning, use at your own risk.
Constructors
ColPackBiColoring(
filename::AbstractString,
method::String,
order::String;
verbose::Bool=false
)
ColPackBiColoring(
M::SparseMatrixCSC,
method::String,
order::String;
verbose::Bool=false
)
Perform the coloring of a matrix that is either given directly or read from a .mtx
file.
The users needs to specify
- a bicoloring
method
among["IMPLICIT_COVERING__STAR_BICOLORING", "EXPLICIT_COVERING__STAR_BICOLORING", "EXPLICIT_COVERING__MODIFIED_STAR_BICOLORING", "IMPLICIT_COVERING__GREEDY_STAR_BICOLORING"]
- an
order
on the vertices among["NATURAL", "RANDOM", "LARGEST_FIRST", "DYNAMIC_LARGEST_FIRST", "SMALLEST_LAST", "INCIDENCE_DEGREE"]
Fields
The fields of this struct are not part of the public API, they are only useful to interface with the C++ library ColPack.