ChunelFeng/CGraph

【A common used C++ & Python DAG framework】 一个通用的、无三方依赖的、跨平台的、收录于awesome-cpp的、基于流图的并行计算框架。欢迎star & fork & 交流

What it solves

CGraph provides a way to organize and execute complex task sequences as a Directed Acyclic Graph (DAG). It solves the problem of managing task dependencies, enabling automatic parallel execution of independent tasks while ensuring that dependent tasks only run after their prerequisites are complete.

How it works

Users create a pipeline and define tasks by inheriting from the GNode class and implementing a run() method. These nodes are then registered into a GPipeline with specified dependencies. The framework's underlying scheduler handles the execution flow, supporting advanced logic such as:

  • Concurrency: Non-dependent nodes run in parallel.
  • Grouping: GGroup allows for conditional logic, loops, and aggregated execution.
  • Scheduling: Supports pausing, resuming, and timeout settings for tasks.
  • Cross-Language: While written in pure C++11, it provides Python APIs (pycgraph) and has native implementations for C#, Java, and Go.

Who it’s for

It is designed for developers who need a cross-platform, dependency-free framework to build execution pipelines, workflow engines, or any system requiring structured task scheduling and parallel processing.

Highlights

  • Zero Dependencies: Built with pure C++11 standard library.
  • Cross-Platform: Compatible with MacOS, Linux, Windows, and Android.
  • Advanced Flow Control: Supports loops, conditional branching, and asynchronous execution.
  • Extensibility: Includes features like aspect-oriented programming (aspect), function injection, and message-based communication between pipelines.
  • Performance Tools: Includes built-in performance analysis (perf) and Graphviz visualization for the execution graph.

Related

  • Project
  • Project
  • Project
  • Project
  • Project