Skip to content

Mik1810/nxpp

Repository files navigation

nxpp

Compatibility CI Boost C++20

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.

Quick Start

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_start

Installation / Consumption

nxpp is header-only and requires:

  • C++20 compiler
  • Boost headers

Supported consumption paths:

  1. Repository-local examples
    • #include "include/nxpp.hpp"
  2. External modular headers
    • #include <nxpp.hpp> or semantic headers such as #include <nxpp/graph.hpp>
  3. Vendored CMake
    • add_subdirectory(nxpp) and target_link_libraries(... PRIVATE nxpp::nxpp)
  4. Installed CMake package
    • find_package(nxpp CONFIG REQUIRED) and target_link_libraries(... PRIVATE nxpp::nxpp)
  5. 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.

Feature Overview

  • 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_id APIs
  • Graphviz DOT export via nxpp::viz::to_dot / write_dot (see docs/API_REFERENCE.md)

Support and API stability

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.

Documentation Map

WASM (Concise Status)

The experimental npm package lives under wasm/ and currently targets Node.js. For coverage, runtime boundaries, release checklist, and usage:

License

MIT License. See LICENSE.

About

nxpp is a modular C++20 graph library built on top of Boost Graph Library, offering a practical NetworkX-inspired API for graph construction, traversal, shortest paths, components, flows, and generators, with a generated single-header release asset also available.

Topics

Resources

License

Contributing

Stars

4 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors