Current release: v1.4.7
nxpp is a modern C++20 graph library with a NetworkX-inspired API on top of
Boost Graph Library. The goal is to keep graph code concise and readable while
preserving Boost-level performance and ecosystem compatibility.
Create quick_start.cpp in the repository root:
#include <iomanip>
#include <iostream>
#include "include/nxpp.hpp"
int main() {
nxpp::DiGraph g;
g.add_edge("A", "B", 1.0);
g.add_edge("B", "C", 2.0);
g.add_edge("A", "C", 5.0);
const auto result = g.dijkstra_shortest_paths("A");
std::cout << std::fixed << std::setprecision(1)
<< "Distance A -> C: " << result.distance.at("C") << "\n";
}Compile and run:
g++ -std=c++20 -O2 -I. quick_start.cpp -o quick_start
./quick_startnxpp is header-only and requires:
- C++20 compiler
- Boost headers
Supported consumption paths:
- Repository-local examples
#include "include/nxpp.hpp"
- External modular headers
#include <nxpp.hpp>or semantic headers such as#include <nxpp/graph.hpp>
- Vendored CMake
add_subdirectory(nxpp)andtarget_link_libraries(... PRIVATE nxpp::nxpp)
- Installed CMake package
find_package(nxpp CONFIG REQUIRED)andtarget_link_libraries(... PRIVATE nxpp::nxpp)
- Single-header release asset
#include <nxpp.hpp>from the release artifact
For detailed install/packaging guidance (Conan, vcpkg overlay, AUR, channel policy), see docs/EXTERNAL_USAGE.md.
For contributor build, test, style, and PR guidance, see CONTRIBUTING.md.
- Header-only C++20 API over Boost Graph Library
- Directed/undirected/weighted/unweighted/multigraph variants
- Attribute APIs (proxy writes + checked typed reads)
- Traversal, shortest paths, components, flow/min-cut/min-cost, centrality
- Node-induced subgraph extraction via
G.subgraph(nodes) - Graph generators (
complete_graph,path_graph,erdos_renyi_graph) - Precise multigraph edge handling via
edge_idAPIs - Graphviz DOT export via
nxpp::viz::to_dot/write_dot(see docs/API_REFERENCE.md)
Not every install path and wrapper has the same upgrade contract as the C++ public headers. The full matrix of stable vs experimental surfaces (CMake, Conan, vcpkg overlay, AUR, wasm, browser scope) is maintained in docs/STABILITY.md. First-class C++ paths are still described in docs/EXTERNAL_USAGE.md.
Repository releases follow Semantic Versioning for the stable C++ public API and first-class consumption paths.
- Docs index: docs/README.md
- Public roadmap: ROADMAP.md
- Versioning policy: VERSIONING.md
- Public support and API stability: docs/STABILITY.md
- Curated API guide and caveats: docs/API_REFERENCE.md
- External usage and packaging policy: docs/EXTERNAL_USAGE.md
- Testing and CI map: docs/TEST.md
- Complexity model: docs/COMPLEXITY.md
- Generated reference site: https://mik1810.github.io/nxpp/
The experimental npm package lives under wasm/ and currently targets Node.js.
For coverage, runtime boundaries, release checklist, and usage:
MIT License. See LICENSE.