GithubHelp home page GithubHelp logo

opensim-org / colpack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chrisdembia/colpack

0.0 2.0 0.0 1.58 MB

A Graph Coloring Algorithm Package

License: GNU Lesser General Public License v3.0

C++ 92.99% C 4.51% Makefile 0.73% Shell 0.08% M4 0.88% CMake 0.81%

colpack's Introduction

Build Status

ColPack's Doxygen documentation is available here: http://cscapes.cs.purdue.edu/coloringpage/software.htm

ColPack's project home page: http://cscapes.cs.purdue.edu/coloringpage/

ColPack

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

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

General Graph Coloring Bipartite Graph one-sided coloring Bipartite Graph Bicoloring
Distance 1 coloring Partial distance-2 coloring Star bicoloring
Distance 2 coloring Partial distance-2 coloring
Star coloring
Acyclic coloring
Restricted star coloring
Triangular coloring

All of the coloring problems listed in the above table are NP-hard. Their corresponding algorithms in ColPack are greedy heuristics in the sense that the algorithms progressively extend a partial coloring by processing one vertex at a time, in some order, in each step assigning a vertex the smallest allowable color. Listed beneath each coloring problem in the table is the complexity of the corresponding algorithm in ColPack. In the cases where ColPack has multiple algorithms for a problem (these are designated by the superscript โ€ ), the complexity expression corresponds to that of the fastest algorithm. In the complexity expressions,

the complexity of the corresponding algorithm can be found here ColPack's project

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 the table below.

General Graph Coloring 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:

  • Recovery routines for direct (via star coloring ) and substitution-based (via acyclic coloring) Hessian computation
  • Recovery routines for unidirectional, direct Jacobian computation (via column-wise or row-wise distance-2 coloring)
  • Recovery routines for bidirectional, direct Jacobian computation via star bicoloring

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 below gives an overview of the structure of the major classes of ColPack.

ColPack Organization

Ubuntu Build Instructions

To build ColPack using autotools, run the following in the ColPack:

autoreconf -vif
./configure --prefix=/path/to/install/
make -j 4   #Where "4" is the number of cores on your machine
make install

ColPack also has experimental support for building with CMake, which you can do via the following:

mkdir build
cd build
cmake ..
make -j 4   #Where "4" is the number of cores on your machine
ctest       #Run the examples in SampleDrivers/Basic folder
make install

Use cmake -LH . or ccmake . in the build directory to see a list of options, such as ENABLE_EXAMPLES and ENABLE_OPENMP, which you can set by running the following from the build directory:

cmake .. -DENABLE_OPENMP=ON

USAGE

After building, you can run the following commands (from this directory if using autotools, or from the build directory if using CMake):

$./ColPack <GraphName> [order_option] [coloring_option]
$./ColPack --graph <GraphName> [--order <order_option>] [--color <coloring_option>]
$./ColPack -g <GraphName> [-o <order_option>] [-c <coloring_option>]

-g or --graph can be changed to -f --file in case needed.

HELP

$./ColPack -h
$./ColPack --help

OPTIONs

  • order: NATURAL, LARGEST_FIRST, DYNAMIC_LARGEST_FIRST, SMALLEST_LAST, INCIDENCE_DEGREE, RANDOM
  • color: DISTANCE_ONE, ACYCLIC, ACYCLIC_FOR_INDIRECT_RECOVERY, STAR, RESTRICTED_STAR, DISTANCE_TWO

EXAMPLE

$./ColPack Graphs/bcsstk01.mtx
$./ColPack Graphs/bcsstk01.mtx LARGEST_FIRST DISTANCE_ONE
$./ColPack --graph Graphs/bcsstk01.mtx --order SMALLEST_LAST -d DISTANCE_TWO
$./ColPack -f Graphs/bcsstk01.mtx -o RANDOM -distance DISTANCE_ONE

EXAMPLE OUTPUT

ReadMatrixMarketAdjacencyGraph
Found file Graphs/bcsstk01.mtx
Graph of Market Market type: [matrix coordinate real symmetric]
		Graph structure and VALUES will be read

#DISTANCE_ONE Result: 
6  : (NATURAL)
6  : (LARGEST_FIRST)
6  : (DYNAMIC_LARGEST_FIRST)
6  : (SMALLEST_LAST)
6  : (INCIDENCE_DEGREE)
6  : (RANDOM)

#ACYCLIC Result: 
8  : (NATURAL)
8  : (LARGEST_FIRST)
8  : (DYNAMIC_LARGEST_FIRST)
8  : (SMALLEST_LAST)
8  : (INCIDENCE_DEGREE)
8  : (RANDOM)

#ACYCLIC_FOR_INDIRECT_RECOVERY Result: 
8  : (NATURAL)
8  : (LARGEST_FIRST)
8  : (DYNAMIC_LARGEST_FIRST)
8  : (SMALLEST_LAST)
8  : (INCIDENCE_DEGREE)
8  : (RANDOM)

#STAR Result: 
12  : (NATURAL)
12  : (LARGEST_FIRST)
12  : (DYNAMIC_LARGEST_FIRST)
12  : (SMALLEST_LAST)
12  : (INCIDENCE_DEGREE)
12  : (RANDOM)

#RESTRICTED_STAR Result: 
15  : (NATURAL)
15  : (LARGEST_FIRST)
15  : (DYNAMIC_LARGEST_FIRST)
15  : (SMALLEST_LAST)
15  : (INCIDENCE_DEGREE)
15  : (RANDOM)

#DISTANCE_TWO Result: 
15  : (NATURAL)
15  : (LARGEST_FIRST)
15  : (DYNAMIC_LARGEST_FIRST)
15  : (SMALLEST_LAST)
15  : (INCIDENCE_DEGREE)
15  : (RANDOM)

Windows Build Instructions

You can build ColPack's static library on Windows using Visual Studio (tested with Visual Studio 2015) and CMake. Note, however, that you are not able to use OpenMP (Visual Studio supports only OpenMP 2.0), and cannot compile the ColPack executable (it depends on the POSIX getopt.h).

If you are using CMake 3.4 or greater, you can build and use ColPack's shared library. If you have an older CMake, we still build the shared library, but you will not be able to use it because none of the symbols will be exported (Visual Studio will not generate a .lib file).

On Windows, the examples link to the static library instead of the shared library.

Unlike on UNIX, the static library is named ColPack_static (ColPack_static.lib) to avoid a name conflict with the shared library's ColPack.lib.

Finally, some of the examples do not compile, seemingly because their filenames are too long.

colpack's People

Contributors

barak avatar besser82 avatar chrisdembia avatar cscsw avatar kkulshre avatar probshin avatar r-barnes avatar wangmu0701 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.