{"id":19813003,"url":"https://github.com/dpys/nxbench","last_synced_at":"2025-06-14T15:32:41.821Z","repository":{"id":261485072,"uuid":"883300104","full_name":"dPys/nxbench","owner":"dPys","description":"A centralized benchmarking suite to facilitate comparative profiling of tools across graph analytic libraries and datasets","archived":false,"fork":false,"pushed_at":"2025-02-17T05:46:59.000Z","size":18564,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-11T22:15:00.363Z","etag":null,"topics":["benchmarking","cugraph","graph-algorithms","graph-tool","graphblas","igraph","networkx","nx-parallel"],"latest_commit_sha":null,"homepage":"https://dpys.github.io/nxbench/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dPys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-04T18:12:24.000Z","updated_at":"2025-04-05T15:38:31.000Z","dependencies_parsed_at":"2024-12-08T09:17:16.855Z","dependency_job_id":"27768683-f2c0-42a0-9335-85ce292b4cc5","html_url":"https://github.com/dPys/nxbench","commit_stats":null,"previous_names":["dpys/nxbench"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/dPys/nxbench","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dPys%2Fnxbench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dPys%2Fnxbench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dPys%2Fnxbench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dPys%2Fnxbench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dPys","download_url":"https://codeload.github.com/dPys/nxbench/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dPys%2Fnxbench/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259837900,"owners_count":22919494,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmarking","cugraph","graph-algorithms","graph-tool","graphblas","igraph","networkx","nx-parallel"],"created_at":"2024-11-12T09:33:32.415Z","updated_at":"2025-06-14T15:32:41.804Z","avatar_url":"https://github.com/dPys.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Python](https://img.shields.io/pypi/pyversions/nxbench.svg)](https://badge.fury.io/py/nxbench)\n[![PyPI](https://badge.fury.io/py/nxbench.svg)](https://badge.fury.io/py/nxbench)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://pre-commit.com/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![codecov](https://codecov.io/gh/dPys/nxbench/graph/badge.svg?token=1M8NM7MQLI)](https://codecov.io/gh/dPys/nxbench)\n\n# NxBench\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"doc/_static/assets/nxbench_logo.png\" alt=\"NxBench Logo\" width=\"125\"/\u003e\n\u003c/p\u003e\n\n**nxbench** is a comprehensive benchmarking suite designed to facilitate comparative profiling of graph analytic algorithms across NetworkX and compatible backends. Built using Prefect and Dask, nxbench places an emphasis on extensible and granular performance analysis, enabling developers and researchers to optimize their graph analysis workflows efficiently and reproducibly.\n\n## Key Features\n\n- **Cross-Backend Benchmarking**: Leverage NetworkX's backend system to profile algorithms across multiple implementations (NetworkX, nx-parallel, GraphBLAS, and CuGraph)\n- **Configurable Suite**: YAML-based configuration for algorithms, datasets, and benchmarking parameters\n- **Real-World Datasets**: Automated downloading and caching of networks and their metadata from NetworkRepository\n- **Synthetic Graph Generation**: Support for generating benchmark graphs using any of NetworkX's built-in generators\n- **Validation Framework**: Comprehensive result validation for correctness across implementations\n- **Performance Monitoring**: Track execution time and memory usage with detailed metrics\n- **Interactive Visualization**: Dynamic dashboard for exploring benchmark results using Plotly Dash\n- **Flexible Storage**: SQL result storage with pandas integration for dowstream analysis\n\n## Installation (Non-Docker Setup)\n\n### Prerequisites\n\n- **Python 3.10+**: Ensure you have a compatible Python environment.\n- **PostgreSQL**: To run Prefect Orion with a persistent database, we recommend PostgreSQL for better concurrency and stability than an ephemeral in-memory database.\n- **NetworkX Backend Installations**: To comparative benchmark graph algorithm performance across different [NetworkX backends](https://networkx.org/documentation/stable/reference/backends.html), you will need to install each backend.\n\n#### Setting up PostgreSQL\n\nIn a terminal window:\n\n1. **Install PostgreSQL**:\n\n   - On macOS (with Homebrew):\n\n     ```bash\n     brew install postgresql\n     brew services start postgresql\n     ```\n\n   - On Linux (Debian/Ubuntu):\n\n     ```bash\n     sudo apt-get update \u0026\u0026 sudo apt-get install -y postgresql postgresql-contrib\n     sudo service postgresql start\n     ```\n\n   - On Windows:\n     Download and run the [PostgreSQL installer](https://www.postgresql.org/download/windows/) and follow the prompts.\n\n2. **Create a PostgreSQL User and Database**:\n\n   ```bash\n   psql postgres\n   ```\n\n   In the `psql` prompt, run:\n\n   ```sql\n   CREATE USER prefect_user WITH PASSWORD 'pass';\n\n   CREATE DATABASE prefect_db OWNER prefect_user;\n   GRANT ALL PRIVILEGES ON DATABASE prefect_db TO prefect_user;\n   ```\n\n   Exit the prompt with \\q.\n\n   This sets up a prefect_user with password pass and a database named prefect_db.\n\n#### Supported Backends\n\n- NetworkX (default)\n- nx-CuGraph (requires separate CuGraph installation and supported GPU hardware)\n- GraphBLAS Algorithms (optional)\n- nx-parallel (optional)\n\n### Installing `nxbench`\n\nIn a new terminal window:\n\nPyPi:\n\n```bash\npip install nxbench\n```\n\nFrom source (local clone):\n\n```bash\ngit clone https://github.com/dpys/nxbench.git\ncd nxbench\nmake install\n```\n\nThis should install nxbench and all required dependencies (including prefect, asyncpg, and related packages).\n\n## Installation (Docker Setup)\n\nDocker:\n\n```bash\n# CPU-only\nmake build\n\n# With GPU\nmake build-gpu\n```\n\n## Quick Start\n\n1. Configure your benchmarks in a yaml file (see `configs/example.yaml`):\n\n```yaml\nalgorithms:\n  - name: \"pagerank\"\n    func: \"networkx.pagerank\"\n    params:\n      alpha: 0.85\n    groups: [\"centrality\"]\n\ndatasets:\n  - name: \"karate\"\n    source: \"networkrepository\"\n```\n\n2. Start an instance of an orion server in a separate terminal window:\n\n```bash\nexport PREFECT_API_URL=\"http://127.0.0.1:4200/api\"\nexport PREFECT_API_DATABASE_CONNECTION_URL=\"postgresql+asyncpg://prefect_user:pass@localhost:5432/prefect_db\"\nprefect server start\n```\n\n3. In the original terminal window, run benchmarks based on the configuration:\n\n```bash\nnxbench --config 'nxbench/configs/example.yaml' benchmark run\n```\n\n4. Export results:\n\n```bash\nnxbench --config 'nxbench/configs/example.yaml' benchmark export 'results/9e3e8baa4a3443c392dc8fee00373b11_20241220002902.json' --output-format csv --output-file 'results/results.csv'  # convert benchmarked results from a run with hash `9e3e8baa4a3443c392dc8fee00373b11_20241220002902` into csv format.\n```\n\n5. View results:\n\n```bash\nnxbench viz serve  # launch the interactive results visualization dashboard.\n```\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"doc/_static/assets/animation.gif\" alt=\"Parallel Categories Animation\" width=\"1000\"/\u003e\n\u003c/p\u003e\n\n## Advanced Command Line Interface\n\nThe CLI provides comprehensive management of benchmarks, datasets, and visualization:\n\n```bash\n# Data Management\nnxbench data download karate  # download specific dataset\nnxbench data list --category social  # list available datasets\n\n# Benchmarking\nnxbench --config 'nxbench/configs/example.yaml' -vvv benchmark run  # debug benchmark runs\nnxbench --config 'nxbench/configs/example.yaml' benchmark export 'results/9e3e8baa4a3443c392dc8fee00373b11_20241220002902.json' --output-format sql # export the results from a run with hash `9e3e8baa4a3443c392dc8fee00373b11_20241220002902` into postgres sql\n```\n\n## Configuration\n\nBenchmarks are configured through YAML files with the following structure:\n\n```yaml\nalgorithms:\n  - name: \"algorithm_name\"\n    func: \"fully.qualified.function.name\"\n    params: {}\n    requires_directed: false\n    groups: [\"category\"]\n    validate_result: \"validation.function\"\n\ndatasets:\n  - name: \"dataset_name\"\n    source: \"networkrepository\"\n    params: {}\n```\n\n## Reproducible benchmarking through docker\n\nInstead of invoking docker-compose directly, we provide a convenience script (`docker/nxbench-run.sh`) to run each of the nxbench\ncommands. This script automatically:\n\n- Resolves and mounts your configuration file.\n- Switches between CPU and GPU modes using the --gpu flag.\n- Detects the desired subcommand (benchmark run/export, viz, data download/list, etc.)\n- Mounts your host's results directory when needed.\n\n```bash\n# Download a Dataset (e.g. Karate):\ndocker/nxbench-run.sh --config 'nxbench/configs/example.yaml' data download karate\n\n# List Available Datasets by Category:\ndocker/nxbench-run.sh --config 'nxbench/configs/example.yaml' data list --category social\n\n# Run benchmarks\ndocker/nxbench-run.sh --config 'nxbench/configs/example.yaml' benchmark run\n\n# Run benchmarks (with GPU support)\ndocker/nxbench-run.sh --gpu --config 'nxbench/configs/example.yaml' benchmark run\n\n# Export Benchmark Results to CSV:\ndocker/nxbench-run.sh --config 'nxbench/configs/example.yaml' benchmark export 'nxbench_results/9e3e8baa4a3443c392dc8fee00373b11_20241220002902.json' --output-format csv --output-file 'nxbench_results/results.csv'\n\n# Launch the Visualization Dashboard:\ndocker/nxbench-run.sh --config 'nxbench/configs/example.yaml' viz serve\n# Note: The dashboard service requires that benchmark results have been generated and exported (i.e. a valid results/results.csv file\n# exists).\n```\n\n## Contributing\n\nContributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on:\n\n- Code style guidelines\n- Development setup\n- Testing requirements\n- Pull request process\n\n## License\n\nThis project is licensed under the MIT License - see [LICENSE](LICENSE) for details.\n\n## Acknowledgments\n\n- NetworkX community for the core graph library and dispatching support\n- NetworkRepository.com for harmonized dataset access\n\n## Contact\n\nFor questions or suggestions:\n\n- Open an issue on GitHub\n- Email: \u003cdpysalexander@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpys%2Fnxbench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdpys%2Fnxbench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpys%2Fnxbench/lists"}