ColPack


ColPack is a software package consisting of implementations of fast and effective algorithms for a variety of graph coloring, vertex ordering, and related problems. Many of the coloring problems model partitioning needs arising in compression-based computation of Jacobian and Hessian matrices using Automatic Differentiation. Several of the coloring problems also find important applications in various areas outside derivative computation. ColPack is implemented in C++ in an object-oriented fashion heavily using STL. Here is the source code, which is being distributed under the GNU Lesser General Public License.

Download

And here is a short document describing the major interface functions.

Short documentation.


The remainder of this page contains a discsussion, in some detail, of the background for, the functionalities available in, and the organization of ColPack. For more information and for papers on the algorithms on which the package relies, consult the coloring-and-derivatives page.

Sparse derivative computation and coloring

Four-step procedure

The computation of an m-by-n sparse derivative matrix A using automatic differentiation (AD) can be made efficient by using the following four-step procedure.

  1. Determine the sparsity structure of A.
  2. Using a specialized vertex coloring on an appropriate graph representation of the matrix A, obtain an n-by-p seed matrix S that defines a partitioning of the columns of A into p groups with p as small as possible.
  3. Compute the compressed matrix B = AS using AD.
  4. Recover the numerical values of the entries of A from B.

The set of criteria used to define the seed matrix S in the second step, the partitioning problem on the matrix A, depends on three mutually orthogonal factors:

Coloring models

Table 1 below provides a summary of the most accurate coloring models for the various computational scenarios. In each case, the structure of a Jacobian matrix A is represented by the bipartite graph Gb(A) = (V1, V2, E), where the vertex sets V1 and V2 represent the rows and columns of A, respectively, and each nonzero matrix entry Aij is represented by the edge (ri , cj) in E. Analogously, the structure of a Hessian matrix A is represented by the adjacency graph G(A) = (V, E), where the vertex set V represents the columns (or, by symmetry, the rows) of A and each off-diagonal nonzero matrix entry Aij (and its symmetric counterpart Aji) is represented by the single edge (ci, cj) in E.

 

1d partition

2d partition

 

Jacobian

Partial distance-2 coloring

Star bicoloring

Direct

Hessian

Star coloring

NA

Direct

Jacobian

NA

Acyclic bicoloring

Substitution

Hessian

Acyclic coloring

NA

Substitution

Table 1: Overview of coloring models in derivative computation. NA stands for not applicable.

In a graph G = (V, E), two distinct vertices are distance-k neighbors if a shortest path connecting them consists of at most k edges. A distance-k coloring of the graph is an assignment of positive integers (called colors) to the vertices such that every two distance-k neighboring vertices get different colors. A star coloring is a distance-1 coloring where, in addition, every path on four vertices uses at least three colors. An acyclic coloring is a distance-1 coloring in which every cycle uses at least three colors. The names star and acyclic coloring are due to the structures of two-colored induced subgraphs: a collection of stars in the case of star coloring and a collection of trees in the case of acyclic coloring.

In a bipartite graph Gb = (V1, V2, E), a partial distance-2 coloring on the vertex set Vi, i = 1,2, is an assignment of colors to the vertices in Vi such that any two vertices connected by a path of length exactly two edges receive different colors. Star and acyclic bicoloring in a bipartite graph are defined in a manner analogous to star and acyclic coloring in a general graph, but with the additional stipulation that the set of colors assigned to row vertices (V1) is disjoint from the set of colors used for column vertices (V2).

ColPack : functionalities

ColPack is a package comprising of implementations of algorithms for the specialized vertex coloring problems discussed in the previous section as well as algorithms for a variety of related supporting tasks in derivative computation.

Coloring capabilities

Table 2 below gives a quick summary of all the coloring problems (on general and bipartite graphs) supported by ColPack.

General Graph G = (V, E)

Bipartite Graph Gb = (V1, V2, E):

One-sided Coloring

Bipartite Graph Gb = (V1, V2, E):

Bicoloring

        Distance-1 coloring

          Partial distance-2 coloring on V2 (or V1)

        Star bicoloring

        Distance-2 coloring

        Star coloring

 

 

        Acyclic coloring

 

 

        Restricted star coloring

        Triangular coloring

 

 

Table 2: List of coloring problems for which implementations of algorithms are available in ColPack. The star coloring and star bicoloring problems have more than one algorithm implemented in ColPack.

Ordering techniques

The order in which vertices are processed in a greedy coloring algorithm determines the number of colors used by the algorithm. ColPack has implementations of various effective ordering techniques for each of the supported coloring problems. These are summarized in Table 3 below.

General Graph

Bipartite Graph: One-sided Coloring

Bipartite Graph: Bicoloring

        Natural

        Column Natural

        Natural

        Largest First

        Column Largest First

        Largest First

        Smallest Last

        Column Smallest Last

        Smallest Last

        Incidence Degree

        Column Incidence Degree

        Incidence Degree

        Dynamic Largest First

        Row Natural

        Dynamic Largest First

        Distance-2 Largest First

        Row Largest First

        Selective Largest First

        Distance-2 Smallest Last

        Row Smallest Last

        Selective Smallest Last

        Distance-2 Incidence Degree

        Row Incidence Degree

        Selective Incidence Degree

        Distance-2 Dynamic Largest First

 

 

Recovery routines

Besides coloring and ordering capabilities, ColPack also has routines for recovering the numerical values of the entries of a derivative matrix from a compressed representation. In particular the following reconstruction routines are currently available:

Graph construction routines

Finally, as a supporting functionality, ColPack has routines for constructing bipartite graphs (for Jacobians) and adjacency graphs (for Hessians) from files specifying matrix sparsity structures in various formats, including Matrix Market, Harwell-Boeing and MeTis.

ColPack : organization

ColPack is written in an object-oriented fashion in C++ heavily using the Standard Template Library (STL). It is designed to be simple, modular, extensible and efficient.

Figure 1: Overview of the structure of the major classes in ColPack. A solid arrow indicates an inheritance-relationship, and a broken arrow indicates a uses-relationship.

ColPack functions that a user needs to call directly are made available via the appropriate Interface classes.

Complete Doxygen documentation of ColPack