API reference

Public

ColPack.ColPackBiColoringType
ColPackBiColoring

Struct holding the parameters of a bicoloring as well as its results (which can be queried with get_colors).

Danger

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.

source
ColPack.ColPackColoringType
ColPackColoring

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.

source
ColPack.ColPackPartialColoringType
ColPackPartialColoring

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"]
Warning

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.

source
ColPack.colpackMethod
colpack(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)
source

Internals