{"id":20956530,"url":"https://github.com/bluebrain/basalt","last_synced_at":"2025-05-14T05:31:57.511Z","repository":{"id":40409142,"uuid":"158816247","full_name":"BlueBrain/basalt","owner":"BlueBrain","description":"C++11 Graph Storage library","archived":false,"fork":false,"pushed_at":"2022-05-10T11:53:57.000Z","size":6918,"stargazers_count":4,"open_issues_count":18,"forks_count":3,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-17T04:53:53.342Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://bluebrain.github.io/basalt","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlueBrain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-23T10:18:28.000Z","updated_at":"2021-12-21T17:34:18.000Z","dependencies_parsed_at":"2022-08-09T19:31:23.660Z","dependency_job_id":null,"html_url":"https://github.com/BlueBrain/basalt","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueBrain%2Fbasalt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueBrain%2Fbasalt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueBrain%2Fbasalt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueBrain%2Fbasalt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlueBrain","download_url":"https://codeload.github.com/BlueBrain/basalt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076977,"owners_count":22010630,"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":[],"created_at":"2024-11-19T01:26:33.924Z","updated_at":"2025-05-14T05:31:56.672Z","avatar_url":"https://github.com/BlueBrain.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"![basalt logo](https://github.com/BlueBrain/basalt/raw/master/doc/source/_static/basalt-logo-400.png)\n\n# Basalt - Graph Storage API for C++ and Python\n\nBasalt is a graph storage API powered by RocksDB persistent\nkey-value store for fast storage like NVMe technologies.\n\n[![DOI](https://zenodo.org/badge/158816247.svg)](https://zenodo.org/badge/latestdoi/158816247)\n[![Build Status](https://api.travis-ci.com/BlueBrain/basalt.svg?token=p3ijqmiSc83uPHF74Ay8\u0026branch=master)](https://travis-ci.org/BlueBrain/basalt)\n\nDocumentation is currently hosted on GitHub: [https://bluebrain.github.io/basalt]\n\n# Development stage\n\nThe C++ and Python APIs of Basalt are stable already, but substantial additions might come in the future. Thus this library development status is still beta.\n\n# Usage\n\n## Python\n\n### Graph Topology API\n\n```python\nclass PLInfluences(basalt.GraphTopology):\n    \"\"\"A directed graph where vertices are programming languages.\n    \"\"\"\n    directed(True)\n\n    class Vertex(Enum):\n        LANGUAGE = 1\n\n    # Declare a vertex type\n    vertex(\"language\", Vertex.LANGUAGE)\n    # Declare a directed edge between 2 programming languages\n    # to represent how they relate.\n    edge(Vertex.LANGUAGE, Vertex.LANGUAGE, name=\"influenced\", plural=\"influenced\")\n\n    @classmethod\n    def load_from_dbpedia(cls):\n        # [...]\n\ng = PLInfluences.load_from_dbpedia(\"/path/on/disk\")\n# Iterate over all vertices of type \"languages\"\nfor language in g.languages:\n  print(language.id, language.data())\n  # Iterate over all vertices connected to vertex `language`\n  # through the `influenced` edge type.\n  for influenced in language.influenced:\n    print(\"  \", influenced.data())\n```\n\n### Low-level Python bindings\n\n```python\n# Load or initialize a graph on disk\ng = basalt.UndirectedGraph(\"/path/on/disk\")\n# Add one vertex of type 0 and identifier 1\ng.vertices.add((0, 1))\n# Insert 10 vertices at once\n# (10, 0), (10, 1), ... (10, 10)\ng.vertices.add(numpy.full((10,), 1, dtype=numpy.int32), # types\n               numpy.arange(10, dtype=numpy.int64)) # ids\n# Connect 2 vertices\ng.edges.add((0, 1), (1, 0))\n# Connect vertex (0, 1) to several vertices at once\n# (0,1)-\u003e(1,0), (0,1)-\u003e(1,1), ... (0,1)-\u003e(1,9)\ng.edges.add((0, 1),\n            numpy.full((9,), 1, dtype=numpy.int32),\n            numpy.arange(9, dtype=numpy.int64)\n# Commit changes on disk\ng.commit()\n```\n\n## C++ API\n\n```cpp\n// Load or initialize a graph on disk\nbasalt::UndirectedGraph g(\"/path/on/disk\");\n// Add one vertex of type 0 and identifier 1\ng.vertices().insert({0, 1});\n// Add one vertex of type 0 and identifier 2\ng.vertices().insert({0, 2});\n// Iterate over vertices\nfor (const auto\u0026 vertex: g.vertices()) {\n  std::clog \u003c\u003c vertex \u003c\u003c '\\n';\n}\n// Connect both vertices\ng.edges().insert({0, 1}, {0, 2}));\nfor (const auto\u0026 edge: g.edges()) {\n  std::clog \u003c\u003c edge.first \u003c\u003c \" -\u003e \" \u003c\u003c edge.second \u003c\u003c '\\n';\n}\n// Commit changes on disk\ng.commit();\n```\n\n# Installation\n\n## C++ API\n\n### Conan package\n\nThis repository provides a [Conan](https://conan.io/) package to ease integration into your existing projects.\n\n### CMake\n\nIt is also possible to build and install the library using CMake, see [build section](#manual-build-and-installation-instructions) below.\n\n## Python API\n\n### Pypi\n\nPython bindings of Basalt are available on [Pypi](https://pypi.org/simple/basalt).\n\n### Blue Brain 5 supercomputer\n\nBasalt is currently released as module on Blue Brain 5 supercomputer:\n\n```bash\n$ module purge\n$ . /gpfs/bbp.cscs.ch/apps/hpc/jenkins/config/modules.sh\n$ module load py-basalt\n$ python3\nPython 3.6.3 (default, Oct  3 2017, 07:47:49)\n[GCC 6.4.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\u003e\u003e\u003e import basalt\n\u003e\u003e\u003e basalt.__version__\n'0.2.2'\n\u003e\u003e\u003e basalt.__rocksdb_version__\n'5.17.2'\n```\n\n# Manual build and installation instructions\n\n## Requirements\n\n* [CMake](https://cmake.org) build system, version 3.5.1 or higher.\n* [RocksDB](https://rocksdb.org/), a persistent key-value store,\n  version 4.1.1 or higher.\n* [Python 3](https://python.org/), version 3.5 or higher.\n\n## Getting the code\n\nThis repository grabs a few third-party libraries as *git modules*.\nTo clone them when you clone basalt, use `git clone --recursive` option.\n\nIf you have already cloned basalt, you can get the git submodules with\nthe command:\n`git submodule update --recursive --init`\n\n## Building the library 101\n\n### C++ Library only\n\nTo build the basalt C++ shared library and run the tests:\n```sh\ncd /path/to/basalt\nmkdir build\npushd build\ncmake ..\nCTEST_OUTPUT_ON_FAILURE=1 make all test\n```\n\nTo install the library:\n```sh\npushd build\ncmake -DCMAKE_INSTALL_PREFIX=/usr/local .\nmake all install\n```\n\n### Python 3 bindings\n\nTo build and run the tests:\n\n```sh\ncd /path/to/basalt\npython3 setup.py test\n```\n\nTo install the package:\n* with _pip_: `pip3 install -U .`\n* with _distutils_: `python3 setup.py install`\n* to create binary tarballs:\n  * most simple: `python3 setup.py bdist`\n  * [wheel](https://www.python.org/dev/peps/pep-0427/): `pip3 install wheel; python3 setup.py bdist_wheel`\n  * relocatable archive: `python3 setup.py bdist_dumb --relative`\n\n## CMake variables and targets\n\nMain CMake variables:\n\n* `Basalt_FORMATTING:BOOL`: provide the build target `clang-format` to check C++ code formatting\n* `Basalt_STATIC_ANALYSIS:BOOL`: provide the build target `clang-tidy` to perform static analysis of the C++ code\n* `Basalt_ARCH`: value given to the `-m` compiler option. \"native\" for instance\n* `Basalt_PRECOMMIT:BOOL`: Enable automatic checks before git commits\n* `Basalt_CXX_OPTIMIZE:BOOL`: Compile C++ with optimization\n* `Basalt_CXX_SYMBOLS:BOOL`: Compile C++ with debug symbols\n* `Basalt_CXX_WARNINGS:BOOL=ON`: Compile C++ with warnings\n\nFor a more detailed list, please refer to file `CMakeCache.txt` in CMake build directory.\n\nCMake targets:\n\n* `basalt`: build the pure C++ library (without Python bindings)\n* `_basalt`: build the C++ library with Python bindings\n* `unit-tests`: build a C++ executable testing the C++ pure library\n* `all`: build the 3 targets above\n* `test`: execute the tests. It is recommended to execute the command `ctest --output-on-failure -VV` instead\n* `install`: install the pure C++ library and the CMake configuration required to easily use basalt\n  in another CMake project\n\n## Python setuptools commands\n\nHere are the main Python  setuptools commands available.\n\n* `build`: build native library\n* `test`: build and test the package. It also executes the C++ unit-tests as well as the code snippets in the Sphinx documentation.\n* `install`: install the Python package\n* `doctest`: execute the code snippets in the Sphinx documentation\n* `build_sphinx`: build the Sphinx documentation\n\nFor instance: `python3 setup.py build_sphinx`\n\n# Files Layout\n\n```\n├── basalt ................... python code of the package\n├── cmake\n│   └── hpc-coding-conventions git module for C++ code guidelines\n├── dev ...................... development related scripts\n├── doc ...................... sphinx documentation source code\n├── include\n│   └── basalt ............... public headers of the C++ library\n├── README.md ................ that's me!\n├── src\n│   ├── basalt ............... C++ library implementation\n│   └── third_party .......... C++ libraries (mostly as git modules)\n└── tests\n    ├── benchmarks ........... scripts to execute before creating a git tag\n    ├── py ................... python unit-tests\n    └── unit ................. C++ unit-tests using Catch2\n```\n\n# Embedded third-parties\n\nExternal libraries are including either by copy/paste or git submodules\nin `src/third_party` directory.\n\n* [Catch2](https://github.com/catchorg/Catch2):\n  modern, C++-native, header-only, test framework for unit-tests, TDD\n  and BDD unit-test library.\n* [fmt](https://github.com/fmtlib/fmt): A modern formatting library\n  **(not part of CMake build yet)**\n* [pybind11](https://pybind11.rtfd.io): Seamless operability between C++11 and Python\n* [SpdLog](https://github.com/gabime/spdlog): Fast C++ logging library.\n\n# Contributing\n\nIf you want to improve the project or you see any issue, every contribution is welcome.\nPlease check [contribution guidelines](CONTRIBUTING.md) for more information.\n\n# Funding \u0026 Acknowledgment\n\nThe development of this software was supported by funding to the Blue Brain Project, a research center of the École polytechnique fédérale de Lausanne (EPFL), from the Swiss government's ETH Board of the Swiss Federal Institutes of Technology.\n\nCopyright © 2018-2022 Blue Brain Project/EPFL\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluebrain%2Fbasalt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluebrain%2Fbasalt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluebrain%2Fbasalt/lists"}