GraphCalc

GraphCalc: A Python Package for Computing Graph Invariants in Automated Conjecturing Systems - Published in JOSS (2025)

https://github.com/randyrdavila/graphcalc

Science Score: 93.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 6 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

graphs-theory optimization

Scientific Fields

Sociology Social Sciences - 64% confidence
Last synced: 4 months ago · JSON representation

Repository

A repository for computation of graph invariants

Basic Info
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • Open Issues: 5
  • Releases: 4
Topics
graphs-theory optimization
Created about 1 year ago · Last pushed 4 months ago
Metadata Files
Readme Contributing License

README.md

GraphCalc

Documentation Status PyPI version License: MIT DOI DOI

Overview

GraphCalc is a Python library for computing a broad range of graph-theoretic invariants, purpose-built to support research in combinatorics, network science, and automated reasoning. It offers exact implementations of over 100 functions, spanning classical invariants (e.g., independence number, chromatic number, spectral radius) and a wide array of lesser-known parameters central to contemporary graph theory.

Originally developed as the invariant engine for the automated conjecturing system TxGraffiti, GraphCalc has since matured into a general-purpose research tool that facilitates the large-scale construction of structured, high-resolution invariant datasets. These datasets, often organized into tabular “knowledge tables,” form the basis for symbolic pattern mining, hypothesis generation, and downstream machine reasoning. For example,

```python

import graphcalc as gc from graphcalc.polytopes.generators import cubegraph, octahedrongraph graphs = [cubegraph(), octahedrongraph()] functions = ["order", "size", "spectralradius", "independencenumber"] gc.computeknowledgetable(functions, graphs) order size spectralradius independencenumber 0 8 12 3.0 4 1 6 12 4.0 2 ```

Features

  • Maximum Clique: Finds the maximum clique in a given graph.
  • Chromatic Number: Computes the minimum number of colors required for graph coloring.
  • Vertex and Edge Cover: Determines vertex and edge covers.
  • Matching and Independence: Calculates maximum matching and independent sets.
  • Domination Number and its Variants: Calculates the domination number, total domination number, and many other domination variants.
  • Degree Sequence Invariants: Calculates the residue, annihilaiton number, the slater number and more!
  • Zero Forcing: Calculates the zero forcing number, the total zero forcing number, the positive semidefinite zero forcing number, and the power domination number.

Installation

To install graphcalc, make sure you have Python 3.7 or higher, then install it:

bash pip install graphcalc

Linear and Integer Programming Solvers

Many of the NP-hard graph invariant computations of GraphCalc depend on third-party solvers.At least one of the following is required if you intend to use solver-based functions (e.g., gc.maximum_independent_set(G)):

  • CBC (recommended):

bash brew install cbc # macOS sudo apt install coinor-cbc # Debian/Ubuntu

GraphCalc will attempt to automatically detect the solver if it is installed. You can also manually specify the solver in API calls.

Example Graph Usage

```python from graphcalc import ( independencenumber, dominationnumber, zeroforcingnumber, ) from graphcalc.generators import petersen_graph

Calculate and print the independence number of the Petersen graph.

G = petersengraph() print(f"Petersen graph independence number = {independencenumber(G)}")

Calculate and print the domination number of the Petersen graph.

print(f"Petersen graph domination number = {domination_number(G)}")

Calculate and print the zero forcing number of the Petersen graph.

print(f"Petersen graph zero forcing number = {zeroforcingnumber(G)}") ```

Example Polytope Usage

```python import graphcalc as gc from graphcalc.polytopes.generators import ( cubegraph, octahedrongraph, dodecahedrongraph, tetrahedrongraph, icosahedrongraph, convexpolytopestextexample, )

Generate polytope graphs (cubes, octahedra, etc.)

G1 = cubegraph() G2 = octahedrongraph() G3 = dodecahedrongraph() G4 = tetrahedrongraph() G5 = icosahedrongraph() G6 = convexpolytopestextexample(1) G7 = convexpolytopestext_example(2)

Function names to compute

functionnames = [ "order", # number of vertices "size", # number of edges "pvector", "independencenumber", "vertexcovernumber", "maximumdegree", "averagedegree", "minimumdegree", "spectralradius", "diameter", "radius", "girth", "algebraicconnectivity", "largestlaplacianeigenvalue", "secondlargestadjacencyeigenvalue", "smallestadjacency_eigenvalue", "fullerene", ]

Compute properties for multiple polytopes

graphs = [G1, G2, G3, G4, G5, G6, G7] df = gc.computeknowledgetable(function_names, graphs) ```

Creating Simple Graphs, Polytope Graphs, and Simple Polytope Graphs

```python import graphcalc as gc

Draw a simple graph

G = gc.SimpleGraph(name="Example Graph") G.addedgesfrom([(0, 1), (1, 2), (2, 3)]) G.draw() ```

Author

Randy Davila, PhD Email: rrd6@rice.edu

Owner

  • Name: Randy Davila
  • Login: RandyRDavila
  • Kind: user
  • Location: Houston
  • Company: @RelationalAI

I am a mathematician with interests in data science. My research areas include graph theory, discrete optimization, and AI.

JOSS Publication

GraphCalc: A Python Package for Computing Graph Invariants in Automated Conjecturing Systems
Published
August 23, 2025
Volume 10, Issue 112, Page 8383
Authors
Randy Davila ORCID
RelationalAI, United States, Department of Computational Applied Mathematics & Operations Research,Rice University, United States
Editor
Christoph Junghans ORCID
Tags
graph theory graph invariants optimization

GitHub Events

Total
  • Create event: 16
  • Release event: 2
  • Issues event: 10
  • Delete event: 2
  • Issue comment event: 11
  • Push event: 109
  • Pull request review comment event: 1
  • Pull request review event: 3
  • Pull request event: 21
  • Fork event: 1
Last Year
  • Create event: 18
  • Release event: 2
  • Issues event: 10
  • Delete event: 2
  • Issue comment event: 11
  • Push event: 111
  • Pull request review comment event: 1
  • Pull request review event: 3
  • Pull request event: 23
  • Fork event: 1

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 7
  • Total pull requests: 9
  • Average time to close issues: 5 days
  • Average time to close pull requests: about 1 hour
  • Total issue authors: 4
  • Total pull request authors: 2
  • Average comments per issue: 0.86
  • Average comments per pull request: 0.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 7
  • Pull requests: 9
  • Average time to close issues: 5 days
  • Average time to close pull requests: about 1 hour
  • Issue authors: 4
  • Pull request authors: 2
  • Average comments per issue: 0.86
  • Average comments per pull request: 0.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • aadinoyiibrahim (3)
  • szhorvat (2)
  • aelliott50 (1)
  • bbrimkov (1)
Pull Request Authors
  • RandyRDavila (13)
  • danielskatz (1)
Top Labels
Issue Labels
enhancement (2)
Pull Request Labels
documentation (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 1,777 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 38
  • Total maintainers: 1
pypi.org: graphcalc

A Python package for graph computation functions

  • Versions: 38
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 1,777 Last month
Rankings
Dependent packages count: 10.0%
Average: 33.3%
Dependent repos count: 56.5%
Maintainers (1)
Last synced: 4 months ago

Dependencies

pyproject.toml pypi
requirements.txt pypi
  • PuLP ==2.9.0
  • contourpy ==1.3.0
  • cycler ==0.12.1
  • exceptiongroup ==1.2.2
  • fonttools ==4.54.1
  • importlib_resources ==6.4.5
  • iniconfig ==2.0.0
  • kiwisolver ==1.4.7
  • networkx ==3.2.1
  • numpy ==2.0.2
  • packaging ==24.2
  • pillow ==11.0.0
  • pluggy ==1.5.0
  • pyparsing ==3.2.0
  • pytest ==8.3.3
  • python-dateutil ==2.9.0.post0
  • six ==1.16.0
  • tomli ==2.1.0
  • zipp ==3.21.0
setup.py pypi
.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/draft-pdf.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • openjournals/openjournals-draft-action master composite
docs/requirements.txt pypi
  • sphinx *
  • sphinx-rtd-theme *