Pure Python implementation of Pivoter clique counting algorithm.
Project description
pivoterpy
Pure Python implementation of Pivoter clique counting algorithm.
Based on The Power of Pivoting for Exact Clique Counting by S. Jain, C. Seshadhri.
quick start
# pip install pivoterpy
from pivoterpy import Pivoter
G = Pivoter.from_adj_matrix(array)
G.count()
G.clique_counts
timings
- Tested on complete graphs with $k$ nodes.
- CPU: AMD Ryzen 5 3600, RAM: 2x16GB DDR4-3200 CL16
Results
| $k$ | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 1000 |
|---|---|---|---|---|---|---|---|---|---|---|
| time | 0:00 | 0:02 | 0:15 | 1:01 | 0:29 | 1:02 | 1:53 | 2:06 | 3:17 | 4:51 |
| procs | 4 | 4 | 4 | 8 | 8 | 8 |
Documentation
usage
For edge lists, all entries must be $(u,v)$ with $u,v\in\mathbb{Z}$ and $0\le u < v < n$.
# (n x n) adjacency matrix. Entry > 0 indicates an edge.
G = Pivoter.from_adj_matrix(adj_matrix)
# (m x 2) edge list (and number of nodes)
G = Pivoter.from_edge_list(edge_list, n)
# available after construction
G.neighborhoods
G.degrees
G.by_degrees
G.degeneracy
G.node_by_degen_order
G.degen_order_by_node
G.degen_order_nbhds
counting
- Non multi-proc (default) is generally better for small dense graphs.
- Multi-proc is better for large graphs.
G.count(procs=4) # default is procs=0
G.count(get_curv=True) # vertex clique counts
# available results
G.ec
G.clique_counts
# with get_curv=True
G.vertex_clique_counts
G.curvatures
Extras
the academic 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
-
Pivoter - Julia implementation by charunupara. (code)
-
PyPivoter - Cython implementation by rckormos. (code)
-
pivoterpy - pure Python implementation with parallelization!
todo
features
- make docs
- per edge clique counts
- get on PyPI
- max-clique size parameter
settings
- calculate ec, save clique counts?
- calculate curvs, save vertex clique counts?
- save edge clique counts?
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-0.1.3.tar.gz.
File metadata
- Download URL: pivoterpy-0.1.3.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bceeda7485baf99db48233b4fe522757cbb7705a8af56a4a94316736e23b22d2
|
|
| MD5 |
5dc8f16bfaccb64b2db899a4b887c23d
|
|
| BLAKE2b-256 |
6f35391edd583d423978bfb5f05f65999f20862b66c4f38830c3ad8e1f0986e8
|
Provenance
The following attestation bundles were made for pivoterpy-0.1.3.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-0.1.3.tar.gz -
Subject digest:
bceeda7485baf99db48233b4fe522757cbb7705a8af56a4a94316736e23b22d2 - Sigstore transparency entry: 1208764913
- Sigstore integration time:
-
Permalink:
7e6i/pivoterpy@e8e8721cc7f47cb698323265b2177d865eb8d726 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/7e6i
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e8e8721cc7f47cb698323265b2177d865eb8d726 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pivoterpy-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pivoterpy-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.7 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 |
fc037d7034e02738316e932058a6ec1964d7ef7edd1ed1fa94d84093aeb6fadc
|
|
| MD5 |
7f8c91be0f568e11d31d896f35f9345c
|
|
| BLAKE2b-256 |
94eb6c3081ae8074d1001f7ab580ac8dfc8f3e953cdb05b48d6dc31bd4e5ec91
|
Provenance
The following attestation bundles were made for pivoterpy-0.1.3-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-0.1.3-py3-none-any.whl -
Subject digest:
fc037d7034e02738316e932058a6ec1964d7ef7edd1ed1fa94d84093aeb6fadc - Sigstore transparency entry: 1208764930
- Sigstore integration time:
-
Permalink:
7e6i/pivoterpy@e8e8721cc7f47cb698323265b2177d865eb8d726 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/7e6i
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e8e8721cc7f47cb698323265b2177d865eb8d726 -
Trigger Event:
release
-
Statement type: