Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

CXXGraph

> 编程语言
Open source

Header-Only C++ Library for Graph Representation and Algorithms

716 stars0 likes0 views
WebsiteGitHub

About

Header-Only C++ Library for Graph Representation and Algorithms

CXXGraph

Introduction

CXXGraph is a comprehensive C++ library that manages graph algorithms. This header-only library serves as an alternative to the Boost Graph Library (BGL).

CXXGraph Website

Roadmap

Completed Description Date of Completition
:heavy_check_mark: Release 0.4.0 Oct 7, 2022
:heavy_check_mark: Release 0.5.0 Mar 23, 2023
:heavy_check_mark: First Stable Release 1.0.0 Mar 28, 2023
:heavy_check_mark: Release 1.0.1 May 7, 2023
:heavy_check_mark: Release 1.1.0 May 8, 2023
:heavy_check_mark: Stable Release 2.0.0 Jun 1, 2023
:heavy_check_mark: Stable Release 3.0.0 Nov 3, 2023
:heavy_check_mark: Release 3.1.0 Jan 9, 2023
:heavy_check_mark: Release 4.0.0 Jun 20, 2024
:heavy_check_mark: Release 4.1.0 Jun 21, 2024
:heavy_check_mark: Introduce Hypergraph #122 Mar 16, 2026
:memo: Stable Release 5.0.0 TBD

Compared to Boost Graph Library

CXXGraph ✅ Boost Graph ❌
Setup time Seconds Minutes–Hours
API readability High Low
Boilerplate Minimal Heavy
Modern C++ style Yes Mixed/Legacy
Learning curve Low High

CXXGraph focuses on developer experience first.

Table of Contents

  • CXXGraph
    • Introduction
    • Roadmap
    • Compared to Boost Graph Library
    • Table of Contents
    • Install and Uninstall
      • Install Linux Tarballs
      • Install RPM
      • Install DEB
      • Install From Source
    • Prerequisites
    • How to use
    • Examples
    • Unit-Test Execution
      • Install GoogleTest
      • How to Compile GoogleTest
      • How to Run GoogleTest
    • Benchmark Execution
      • Install Google Benchmark
      • How to Compile Google Benchmark
      • How to Run Google Benchmark
      • Benchmark Results
    • Packaging
      • Tarballs
      • RPM
        • (Fedora/CentOS/RedHat)
      • DEB
        • (Debian/Ubuntu)
    • Algorithms, Classes and Network Dynamics
    • How to contribute
    • Discussion
    • Share it
    • Contact
    • Support
    • References
    • Credits
    • Contributors
    • Cite Us
    • Other Details
    • Author

Install and Uninstall

Install Linux Tarballs

To install on Unix/Linux systems, execute the following from the command line:

$ sudo tar xjf CXXGraph-{version}.tar.bz2

To uninstall:

$ sudo rm -f /usr/include/Graph.hpp /usr/include/CXXGraph*

Install RPM

To install on Fedora/CentOS/RedHat systems, execute the following from the command line:

$ sudo rpm -ivh CXXGraph-{version}.noarch.rpm

To uninstall:

$ sudo rpm -e CXXGraph-{version}

Install DEB

To install on Debian/Ubuntu systems, execute the following from the command line:

$ sudo dpkg -i CXXGraph_{version}.deb

To uninstall:

$ sudo apt-get remove CXXGraph

Install From Source

For self-compiled installations using CMake, execute the following from the command line once compilation is complete:

$ sudo make install

Prerequisites

  • The minimum C++ standard required is C++17
  • A GCC compiler version 7.3.0 and later OR a MSVC compiler that supports C++17

How to use

To use the library, simply include the CXXGraph/CXXGraph.hpp file at the top of your file.

While compiling the file, include the two include paths mentioned in the To compile and run the program section in the command.

CXXGraph revolves around the graph object which contains nodes and edges. This object can then be manipulated with a wide variety of algorithms. Please see the examples section, examples folder and website for more information

Examples

In this example file example.cpp, the shortest path between nodeA and nodeC is obtained using Dijkstra's algorithm.

bash
$ mkdir folder
$ cd folder
$ touch example.cpp    

Paste the below code into example.cpp

cpp
#include 
#include "CXXGraph/CXXGraph.hpp"

int main(){
  CXXGraph::Node nodeA("A", 1);
  CXXGraph::Node nodeB("B", 2);
  CXXGraph::Node nodeC("C", 3);

  CXXGraph::DirectedWeightedEdge edge1("1", nodeA, nodeB, 1);
  CXXGraph::DirectedWeightedEdge edge2("2", nodeB, nodeC, 1);
  CXXGraph::UndirectedWeightedEdge edge3("3", nodeA, nodeC, 6);

  CXXGraph::T_EdgeSet edgeSet;
  edgeSet.insert(std::make_shared(edge1));
  edgeSet.insert(std::make_shared(edge2));
  edgeSet.insert(std::make_shared(edge3));

  CXXGraph::Graph graph(edgeSet);
  CXXGraph::DijkstraResult res = graph.dijkstra(nodeA, nodeC);

  for(auto node_user_id : res.path){
    std::cout 
[GitHub Profile](https://github.com/ZigRazor) 

## Support

To support me, add a ***Star*** to the project  [](https://GitHub.com/ZigRazor/CXXGraph/stargazers/) or ***follow me***  [](https://github.com/ZigRazor?tab=followers)

To stay updated, ***watch*** the project  [](https://GitHub.com/ZigRazor/CXXGraph/watchers/)

## References

We are referenced by:

- [awesome-hpp](https://github.com/p-ranav/awesome-hpp)
- [cppreference.com](https://en.cppreference.com/w/cpp/links/libs)
- [awesome-cpp](https://github.com/fffaraz/awesome-cpp)

## Credits

Thanks to the community of [TheAlgorithms](https://github.com/TheAlgorithms) for some algorithm inspiration.

Thanks to [GeeksForGeeks](https://www.geeksforgeeks.org/) for some algorithm inspiration.

## Contributors

Thank you to all the people who have already contributed to CXXGraph!
## Cited By

- Ruizhe Wang, Meng Xu, and N. Asokan. 2024. SeMalloc: Semantics-Informed Memory Allocator. In Proceedings of the 2024 on ACM SIGSAC Conference on Computer and Communications Security (CCS '24). Association for Computing Machinery, New York, NY, USA, 1375–1389. 

## Cite Us

If you use this software please follow the [CITATION](https://github.com/ZigRazor/CXXGraph/blob/master/CITATION) instructions.
Thank you!

## Other Details

We participated in Hacktoberfest 2021, 2022 and 2023. Thank you to all the contributors!

View the [Estimated Value of the Project](https://www.openhub.net/p/CXXGraph/estimated_cost)

## Author

| [
@ZigRazor](https://github.com/ZigRazor) |
|:----:|

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++algorithmalgorithmsbfs-algorithmcpp

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言