Skip to main content

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

October 2006

Jun 2010, March 2011

January 2020

implementations

  • Pivoter - Julia implementation by charunupara. (code)

  • PyPivoter - Cython implementation by rckormos. (code)

  • pivoterpy - parallelized pure Python implementation!

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

pivoterpy-1.0.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pivoterpy-1.0.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

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

Hashes for pivoterpy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3ce8b31b32b7dee6766241c28a5be23b01b80d1e905842e5dec2459240c74b4b
MD5 3651bef4343743db0a716d89a8d008d7
BLAKE2b-256 5bc8a92e12b0a241fe589f42ed4ecbd1c1030fd5386fe991f3bda2d7e468bb7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pivoterpy-1.0.0.tar.gz:

Publisher: publish.yml on 7e6i/pivoterpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pivoterpy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b7bcf5a19d0f3958d1962a0f707100e24d16900e36461222424ce90947480ff
MD5 9079512d420cafc274bf1bc6ad246e63
BLAKE2b-256 5d498d290a9a9bb5598b5429b7c3f498692c178e182f1b96fb290aa2534a613a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pivoterpy-1.0.0-py3-none-any.whl:

Publisher: publish.yml on 7e6i/pivoterpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page