Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanrossi committed Mar 1, 2013
0 parents commit bb661ce
Show file tree
Hide file tree
Showing 25 changed files with 4,010 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .gitignore
@@ -0,0 +1,87 @@
ompiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.sql
*.sqlite
*.mat
*.edges
*.smat
*.labels
*.graphml
*.gephi
*.png
*.eps
*.jpg

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
.settings/
.cproject
.project
.pydevproject
data/
exp/


#Latex #
##############
*.acn
*.acr
*.alg
*.aux
*.bbl
*.blg
*.dvi
*.fdb_latexmk
*.glg
*.glo
*.gls
*.idx
*.ilg
*.ind
*.ist
*.lof
*.log
*.lot
*.maf
*.mtc
*.mtc0
*.nav
*.nlo
*.out
*.pdfsync
*.ps
*.snm
*.synctex.gz
*.toc
*.vrb
*.xdy
23 changes: 23 additions & 0 deletions LICENSE.md
@@ -0,0 +1,23 @@
License
-------
**Parallel Maximum Clique (PMC) Library**,
Copyright (C) 2012-2013: Ryan A. Rossi, All rights reserved.

>This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

>This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

>You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
If used, please cite the following manuscript:

Ryan A. Rossi, David F. Gleich, Assefaw H. Gebremedhin, Md. Mostofa
Patwary, A Fast Parallel Maximum Clique Algorithm for Large Sparse Graphs
and Temporal Strong Components, arXiv 2013
39 changes: 39 additions & 0 deletions Makefile
@@ -0,0 +1,39 @@
#
# Makefile for PMC
#
# Ryan A. Rossi
# Copyright, 2012-2013
#

.KEEP_STATE:

all: pmc

OPTFLAGS = -O3
CFLAGS = $(OPTFLAGS)
CXX = g++
H_FILES = pmc.h

.cpp.o:
$(CXX) $(CFLAGS) -c $<

IO_SRC = pmc_utils.cpp \
pmc_graph.cpp \
pmc_clique_utils.cpp

PMC_SRC = pmc_heu.cpp \
pmc_maxclique.cpp \
pmcx_maxclique.cpp \
pmcx_maxclique_basic.cpp

BOUND_LIB_SRC = pmc_cores.cpp

PMC_MAIN = pmc_driver.cpp

OBJ_PMC = $(PMC_MAIN:%.cpp=%.o) $(IO_SRC) $(PMC_SRC) $(BOUND_LIB_SRC)
$(OBJ_PMC): $(H_FILES) Makefile
pmc: $(OBJ_PMC) $(H_FILES)
$(CXX) $(CFLAGS) -o pmc $(OBJ_PMC) -fopenmp

clean:
rm -rf *.o pmc
189 changes: 189 additions & 0 deletions README.md
@@ -0,0 +1,189 @@
Parallel Maximum Clique (PMC) Library
=====================================

In short, a parameterized high performance library for computing maximum cliques in large sparse graphs.

Finding maximum cliques, k-cliques, and temporal strong components are in general NP-hard.
Yet, these can be computed fast in most social and information networks.
The PMC library is designed to be fast for solving these problems.
Algorithms in the PMC library are easily adaptable for use with a variety of orderings, heuristic strategies, and bounds.

* **Maximum clique:** Given a simple undirected graph G and a number k, output the clique of largest size.
* **K-clique:** In k-clique, the problem is to find a clique of size k if one exists.
* **Largest temporal-scc:** Given a temporal graph G, a temporal strong component is a set of vertices where all temporal paths exist between the vertices in that set. The Largest TSCC problem is to find the largest among all the temporal strong components.



Features
--------
0. General framework for parallel maximum clique algorithms
1. Optimized to be fast for large sparse graphs
+ Algorithms tested on networks of 1.8 billion edges
2. Set of fast heuristics shown to give accurate approximations
3. Algorithms for computing Temporal Strongly Connected Components (TSCC) of large dynamic networks
4. Parameterized for computing k-cliques as fast as possible
5. Includes a variety of tight linear time bounds for the maximum clique problem
6. Ordering of vertices for each algorithm can be selected at runtime
7. Dynamically reduces the graph representation periodically as vertices are pruned or searched
+ Lowers memory-requirements for massive graphs, increases speed, and has caching benefits


Synopsis
---------

### Setup
First, you'll need to compile the parallel maximum clique library.

$ cd path/to/pmc/
$ make

Afterwards, the following should work:

# compute maximum clique using the full algorithm `-a 0`
./pmc -f data/socfb-Texas84.mtx -a 0


*PMC* has been tested on Ubuntu linux (10.10 tested) and Mac OSX (Lion tested) with gcc-mp-4.7 and gcc-mp-4.5.4

Please let me know if you run into any issues.



### Input file format
+ Matrix Market Coordinate Format (symmetric)
For details see: <http://math.nist.gov/MatrixMarket/formats.html#MMformat>

%%MatrixMarket matrix coordinate pattern symmetric
4 4 6
2 1
3 1
3 2
4 1
4 2
4 3


+ Edge list (symmetric and unweighted):
Codes for transforming the graph into the correct format are provided in the experiments directory.


Overview
---------

The parallel maximum clique algorithms use tight bounds that are fast to compute.
A few of those are listed below.

* K-cores
* Degree
* Neighborhood cores
* Greedy coloring

All bounds are dynamically updated.

Examples of the three main maximum clique algorithms are given below.
Each essentially builds on the other.

# uses the four basic k-core pruning steps
./pmc -f ../pmc/data/output/socfb-Stanford3.mtx -a 2

# k-core pruning and greedy coloring
./pmc -f ../pmc/data/output/socfb-Stanford3.mtx -a 1

# neighborhood core pruning (and ordering for greedy coloring)
./pmc -f ../pmc/data/output/socfb-Stanford3.mtx -a 0





### Dynamic graph reduction

The reduction wait parameter `-r` below is set to be 1 second (default = 4 seconds).

./pmc -f data/sanr200-0-9.mtx -a 0 -t 2 -r 1

In some cases, it may make sense to turn off the explicit graph reduction.
This is done by setting the reduction wait time '-r' to be very large.

# Set the reduction wait parameter
./pmc -f data/socfb-Stanford3.mtx -a 0 -t 2 -r 999






### Orderings

The PMC algorithms are easily adapted to use various ordering strategies.
To prescribe a vertex ordering, use the -o option with one of the following:
+ `deg`
+ `kcore`
+ `dual_deg`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;orders vertices by the sum of degrees from neighbors
+ `dual_kcore`&nbsp;&nbsp;orders vertices by the sum of core numbers from neighbors
+ `kcore_deg`&nbsp;&nbsp;&nbsp; vertices are ordered by the weight k(v)d(v)
+ `rand`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; randomized ordering of vertices



##### Direction of ordering

Vertices are searched by default in increasing order, to search vertices in decreasing order, use the `d` option:

./pmc -f data/p-hat700-2.mtx -a 0 -d




### Heuristic
The fast heuristic may also be customized to use various greedy selection strategies.
This is done by using `-h` with one of the following:

+ `deg`
+ `kcore`
+ `kcore_deg`&nbsp;&nbsp;&nbsp; select vertex that maximizes k(v)d(v)
+ `rand`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; randomly select vertices


#### Terminate after applying the heuristic
Approximate the maximum clique using _ONLY_ the heuristic by not setting the exact algorithm via the `-a [num]` option.
For example:

./pmc -f data/sanr200-0-9.mtx -h deg

#### Turning the heuristic off

# heuristic is turned off by setting `-h 0`.
./pmc -f data/tscc_enron-only.mtx -h 0 -a 0



### K-clique

The parallel maximum clique algorithms have also been parameterized to find cliques of size k.
This routine is useful for many tasks in network analysis such as mining graphs and community detection.

# Computes a clique of size 50 from the Stanford facebook network
./pmc -f data/socfb-Stanford3.mtx -a 0 -k 50


using `-o rand` to find potentially different cliques of a certain size

# Computes a clique of size 36 from sanr200-0-9
./pmc -f data/sanr200-0-9.mtx -a 0 -k 36 -o rand



Terms and conditions
--------------------
Please feel free to use these codes. We only ask that you cite:

Ryan A. Rossi, David F. Gleich, Assefaw H. Gebremedhin, Md. Mostofa Patwary,
A Fast Parallel Maximum Clique Algorithm for Large Sparse Graphs and Temporal
Strong Components, arXiv preprint 1302.6256, 2013.

_These codes are research prototypes and may not work for you. No promises. But do email if you run into problems._


Copyright 2011-2013, Ryan A. Rossi. All rights reserved.

32 changes: 32 additions & 0 deletions pmc.h
@@ -0,0 +1,32 @@
/**
============================================================================
Name : Parallel Maximum Clique (PMC) Library
Author : Ryan A. Rossi (rrossi@purdue.edu)
Description : A general high-performance parallel framework for computing
maximum cliques. The library is designed to be fast for large
sparse graphs.
Copyright (C) 2012-2013, Ryan A. Rossi, All rights reserved.
Please cite the following paper if used:
Ryan A. Rossi, David F. Gleich, Assefaw H. Gebremedhin, Md. Mostofa
Patwary, A Fast Parallel Maximum Clique Algorithm for Large Sparse Graphs
and Temporal Strong Components, arXiv preprint 1302.6256, 2013.
See http://ryanrossi.com/pmc for more information.
============================================================================
*/

#ifndef __PMC_H__
#define __PMC_H__

#include "pmc_headers.h"
#include "pmc_input.h"
#include "pmc_utils.h"

#include "pmc_heu.h"
#include "pmc_maxclique.h"
#include "pmcx_maxclique.h"
#include "pmcx_maxclique_basic.h"

#endif

0 comments on commit bb661ce

Please sign in to comment.