API reference
Public
ColPack.ColPack
— ModuleColPack.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.
ColPack.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", "NAIVE_STAR", "RESTRICTED_STAR", "DISTANCE_TWO"]
- an
order
on the vertices among["NATURAL", "RANDOM", "LARGEST_FIRST", "SMALLEST_LAST", "DYNAMIC_LARGEST_FIRST", "INCIDENCE_DEGREE", "DISTANCE_TWO_SMALLEST_LAST", "DISTANCE_TWO_LARGEST_FIRST", "DISTANCE_TWO_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", "DYNAMIC_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.colpack
— Methodcolpack(file::String, method::String, order::String; verbose::Bool=false)
Perform graph coloring with the ColPack executable.
file
: Indicates the graph file path.method
: Indicates the method.order
: Indicates the ordering.verbose
: Indicates verbose flag will be turned on and there will display more rich information.
Examples
colpack("./bcsstk01.mtx", "DISTANCE_ONE", "RANDOM", verbose=true)
colpack("./bcsstk01.mtx", "ROW_PARTIAL_DISTANCE_TWO", "NATURAL", verbose=true)
colpack("./bcsstk01.mtx", "COLUMN_PARTIAL_DISTANCE_TWO", "NATURAL", verbose=true)
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.
ColPack.get_ordering
— Methodget_ordering(coloring::ColPackBiColoring)
Retrieve the ordering from a ColPackBiColoring
as a vector of integers.
ColPack.get_ordering
— Methodget_ordering(coloring::ColPackColoring)
Retrieve the ordering from a ColPackColoring
as a vector of integers.
ColPack.get_ordering
— Methodget_ordering(coloring::ColPackPartialColoring)
Retrieve the ordering from a ColPackPartialColoring
as a vector of integers.
ColPack.ncolors
— Methodncolors(coloring::ColPackBiColoring)
Retrieve the number of colors from a ColPackBiColoring
.
ColPack.ncolors
— Methodncolors(coloring::ColPackColoring)
Retrieve the number of colors from a ColPackColoring
.
ColPack.ncolors
— Methodncolors(coloring::ColPackPartialColoring)
Retrieve the number of colors from a ColPackPartialColoring
.
ColPack.timer_coloring
— Methodtimer_coloring(coloring::ColPackBiColoring)
Retrieve the timer for coloring from a ColPackBiColoring
.
ColPack.timer_coloring
— Methodtimer_coloring(coloring::ColPackColoring)
Retrieve the timer for coloring from a ColPackColoring
.
ColPack.timer_coloring
— Methodtimer_coloring(coloring::ColPackPartialColoring)
Retrieve the timer for coloring from a ColPackPartialColoring
.
ColPack.timer_ordering
— Methodtimer_ordering(coloring::ColPackBiColoring)
Retrieve the timer for ordering from a ColPackBiColoring
.
ColPack.timer_ordering
— Methodtimer_ordering(coloring::ColPackColoring)
Retrieve the timer for ordering from a ColPackColoring
.
ColPack.timer_ordering
— Methodtimer_ordering(coloring::ColPackPartialColoring)
Retrieve the timer for ordering from a ColPackPartialColoring
.