Parallelized pure Python implementation of the Pivoter clique counting algorithm.
Project description
pivoterpy
Parallelized pure Python implementation of the Pivoter clique counting algorithm.
Based on The Power of Pivoting for Exact Clique Counting by S. Jain, C. Seshadhri.
The greatest victory is that which requires no battle - Sun Tzu, The Art of War
quick start
# pip install pivoterpy
from pivoterpy import Pivoter
G = Pivoter.from_adj_matrix(array)
G.count()
G.clique_counts
benchmarks
- CPU: AMD Ryzen 5 3600, RAM: 32GB DDR4-3200MHz CL16
- Tested on complete graphs with n nodes.
- All times shown are the average of 10 runs (in seconds).
- Setup refers to initialization time (nbhds, degen. ordering, etc)
| n | setup | no mp | 4 procs | 8 procs |
|---|---|---|---|---|
| 300 | 0.02 | |||
| 600 | 0.09 | 0:04 | ||
| 900 | 0.22 | 0:13 | 0:04 | |
| 1200 | 0.36 | 0:11 | 0:11 | |
| 1500 | 0.69 | 0:22 |
Documentation
usage
Requires a N x N adjacency matrix. Only upper triangle is used.
Edges are created for entries > 0 (or True).
G = Pivoter.from_adj_matrix(array)
Requires a M x 2 edge matrix and the positive integer number of nodes $n$.
Note: all elements must be $(u,v)$ with $u,v\in\mathbb{Z}$ and $0\le u < v < n$.
G = Pivoter.from_edge_list(array, n)
Values available after construction.
G.neighborhoods # list of sets
G.degrees # list of ints
G.by_degrees # list of sets
G.degeneracy # int
G.node_by_degen_order # list of ints
G.degen_order_by_node # list of ints
G.degen_order_nbhds # list of sets
counting
Multiprocessing is generally only beneficial for especially large or dense graphs.
G.count(procs=4) # default is 0 (avoids mp.Pool)
G.count(vertex=True) # default is False, finds vertex counts
Results available after completion:
G.max_k # max clique size
G.global_ec # G.ec (euler characteristic)
G.global_counts # G.clique_counts
if vertex is True:
G.vertex_ec # G.curvatures
G.vertex_counts # G.vertex_clique_counts
Extras
the lore...
April 1971
- Bron-Kerbosch algorithm created by... C. Bron and J. Kerbosch.
- Algorithm 457, Finding All Cliques of an Undirected Graph [H]
October 2006
- E. Tomitaa, A. Tanaka, H. Takahashia say this is a difficult problem.
- The worst-case time complexity for generating all maximal cliques and computational experiments
Jun 2010, March 2011
- Double header by D. Eppstein, M. Loffler, D. Strash. (code)
- Listing All Maximal Cliques in Sparse Graphs in Near-optimal Time
- Listing All Maximal Cliques in Large Sparse Real-World Graph
- D. Strash creates
quick-clicksfor maximal cliques. (code)
January 2020
- S. Jain, C. Seshadhri drop an absolute banger:
Pivoter. - The Power of Pivoting for Exact Clique Counting
- Code available on GitHub and BitBucket
implementations
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pivoterpy-1.0.0.tar.gz.
File metadata
- Download URL: pivoterpy-1.0.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ce8b31b32b7dee6766241c28a5be23b01b80d1e905842e5dec2459240c74b4b
|
|
| MD5 |
3651bef4343743db0a716d89a8d008d7
|
|
| BLAKE2b-256 |
5bc8a92e12b0a241fe589f42ed4ecbd1c1030fd5386fe991f3bda2d7e468bb7d
|
Provenance
The following attestation bundles were made for pivoterpy-1.0.0.tar.gz:
Publisher:
publish.yml on 7e6i/pivoterpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pivoterpy-1.0.0.tar.gz -
Subject digest:
3ce8b31b32b7dee6766241c28a5be23b01b80d1e905842e5dec2459240c74b4b - Sigstore transparency entry: 1239742885
- Sigstore integration time:
-
Permalink:
7e6i/pivoterpy@af8385de73fd87e574ba98fb1be1c5689bf08832 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/7e6i
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@af8385de73fd87e574ba98fb1be1c5689bf08832 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pivoterpy-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pivoterpy-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b7bcf5a19d0f3958d1962a0f707100e24d16900e36461222424ce90947480ff
|
|
| MD5 |
9079512d420cafc274bf1bc6ad246e63
|
|
| BLAKE2b-256 |
5d498d290a9a9bb5598b5429b7c3f498692c178e182f1b96fb290aa2534a613a
|
Provenance
The following attestation bundles were made for pivoterpy-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on 7e6i/pivoterpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pivoterpy-1.0.0-py3-none-any.whl -
Subject digest:
5b7bcf5a19d0f3958d1962a0f707100e24d16900e36461222424ce90947480ff - Sigstore transparency entry: 1239742957
- Sigstore integration time:
-
Permalink:
7e6i/pivoterpy@af8385de73fd87e574ba98fb1be1c5689bf08832 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/7e6i
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@af8385de73fd87e574ba98fb1be1c5689bf08832 -
Trigger Event:
release
-
Statement type: