Skip to main content

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

October 2006

Jun 2010, March 2011

January 2020

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

pivoterpy-0.1.3.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

pivoterpy-0.1.3-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

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

Hashes for pivoterpy-0.1.3.tar.gz
Algorithm Hash digest
SHA256 bceeda7485baf99db48233b4fe522757cbb7705a8af56a4a94316736e23b22d2
MD5 5dc8f16bfaccb64b2db899a4b887c23d
BLAKE2b-256 6f35391edd583d423978bfb5f05f65999f20862b66c4f38830c3ad8e1f0986e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pivoterpy-0.1.3.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-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

Hashes for pivoterpy-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fc037d7034e02738316e932058a6ec1964d7ef7edd1ed1fa94d84093aeb6fadc
MD5 7f8c91be0f568e11d31d896f35f9345c
BLAKE2b-256 94eb6c3081ae8074d1001f7ab580ac8dfc8f3e953cdb05b48d6dc31bd4e5ec91

See more details on using hashes here.

Provenance

The following attestation bundles were made for pivoterpy-0.1.3-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