Chinese | English Readme

CGraph is a cross-platform D irected A cyclic G raph framework based on pure C++ without any 3rd-party dependencies.
You, with it, can build your own operators simply, and describe any running schedules as you need, such as dependence, parallelling, aggregation and so on. Some useful tools and plugins are also provided to improve your project.
Tutorials and contact information are show as follows. Please get in touch with us for free if you need more about this repository.
CGraph is called [Color, Picture] in Chinese, and is a cross-platform graph process execution framework without any third-party dependencies. Through GPipeline (pipeline) underlying scheduling, it provides the function of sequential execution of dependent elements and concurrent execution of non-dependent elements in eDAG scheduling.
Users only need to inherit GNode (node) class, implement the run() method of the subclass, and set dependencies as needed to realize graphical execution or pipeline execution of the task. It is also possible to set various GGroup (groups) containing multi-node information to control the conditional judgment, looping and concurrent execution logic of the graph.
The project provides a rich Param (parameter) type for data interoperability in different application scenarios. In addition, the above various element functions can be expanded horizontally by adding GAspect ; the functions of a single node can be enhanced by introducing GAdapter ; or by adding GEvent (signals), the execution logic can be enriched and optimized.

本工程使用纯C++11标准库编写,无任何第三方依赖。 Compatible with MacOS , Linux , Windows and Android systems, it supports local compilation and secondary development through CLion , VSCode , Xcode , Visual Studio , Code::Blocks , Qt Creator and other IDEs. For specific compilation methods, please refer to CGraph compilation instructions.
For detailed functional introduction and usage, please refer to the article content in Yimianzhiyuan.com. Related videos are being updated continuously on B.com. Welcome to watch and communicate:
# include " CGraph.h "
class MyNode1 : public CGraph ::GNode {
public:
CStatus run () override {
printf ( " [%s], sleep for 1 second ... n " , this -> getName (). c_str ());
CGRAPH_SLEEP_SECOND ( 1 )
return CStatus ();
}
};
class MyNode2 : public CGraph ::GNode {
public:
CStatus run () override {
printf ( " [%s], sleep for 2 second ... n " , this -> getName (). c_str ());
CGRAPH_SLEEP_SECOND ( 2 )
return CStatus ();
}
};# include " MyNode.h "
using namespace CGraph ;
int main () {
/* 创建一个流水线,用于设定和执行流图信息 */
GPipelinePtr pipeline = GPipelineFactory::create ();
GElementPtr a, b, c, d = nullptr ;
/* 注册节点之间的依赖关系 */
pipeline-> registerGElement <MyNode1>(&a, {}, " nodeA " );
pipeline-> registerGElement <MyNode2>(&b, {a}, " nodeB " );
pipeline-> registerGElement <MyNode1>(&c, {a}, " nodeC " );
pipeline-> registerGElement <MyNode2>(&d, {b, c}, " nodeD " );
/* 执行流图框架 */
pipeline-> process ();
/* 清空流水线中所有的资源 */
GPipelineFactory::remove (pipeline);
return 0 ;
}
As shown in the figure above, when the graph structure is executed, node a is first executed. After node a is executed, node b and c are executed in parallel. After all nodes b and c are executed, node d is executed.
[2021.05.04 - v1.0.0 - Chunel]
[2021.05.09 - v1.1.0 - Chunel]
[2021.05.18 - v1.1.1 - Chunel]
name and session information[2021.05.23 - v1.2.0 - Chunel]
[2021.05.29 - v1.3.0 - Chunel]
cluster (cluster) and region (region) division and loop execution functionstutorial content, including multiple usage examples[2021.06.14 - v1.4.0 - Chunel]
param (parameter) delivery mechanismgroup (group) function, multi-node modules are inherited from group modules uniformly[2021.06.20 - v1.4.1 - Chunel]
condition (condition) function[2021.06.24 - v1.5.0 - Chunel]
pipeline factory creation methodtutorial content[2021.07.07 - v1.5.1 - Chunel]
[2021.07.11 - v1.5.2 - Chunel]
[2021.07.31 - v1.5.3 - Chunel]
[2021.08.29 - v1.6.0 - Chunel]
pipeline functions to optimize underlying logictutorial content[2021.09.19 - v1.6.1 - Chunel]
Lru operator, Trie operator and template node functions to optimize the underlying logictutorial content[2021.09.29 - v1.7.0 - Chunel]
aspect function for extending outward node or group functiontutorial content[2021.10.07 - v1.7.1 - Chunel]
aspect (section) implementation logic, provide section parameter function, and batch add section functiontutorial content[2021.11.01 - v1.8.0 - Chunel]
adapter function and singleton adapter functionpipeline execution logictutorial content[2021.12.18 - v1.8.1 - Chunel]
CStatus information[2022.01.02 - v1.8.2 - Chunel]
task group function[2022.01.23 - v1.8.3 - Chunel]
function adapter to implement functional programming functionstutorial content[2022.01.31 - v1.8.4 - Chunel]
node (node) asynchronous execution[2022.02.03 - v1.8.5 - Chunel]
daemon (守护)功能,用于定时执行非流图中任务tutorial content[2022.04.03 - v1.8.6 - Chunel]
DistanceCalculator operator to implement calculations of any data type and any distance typetutorial content[2022.04.05 - v2.0.0 - Chunel]
domain (domain) function, provide Ann domain abstract model, and begin to support individual professional directionstutorial content[2022.05.01 - v2.0.1 - Chunel]
pipeline registration mechanism and support custom order execution of init methods[2022.05.29 - v2.1.0 - Chunel]
element parameter writing methodtutorial content[2022.10.03 - v2.1.1 - Chunel]
group execution logic[2022.11.03 - v2.2.0 - Chunel]
message (message) function, mainly used to complete data transmission between different pipelinetutorial content[2022.12.24 - v2.2.1 - Chunel]
TemplateNode function to optimize parameter transfer methodtutorial content[2022.12.25 - v2.2.2 - yeshenyong]
[2022.12.30 - v2.2.3 - Chunel]
message publishing and subscription function[2023.01.21 - v2.3.0 - Chunel]
event (event) functionCGraph Intro.xmind file, which introduces the overall logic of CGraph through the brain diagram.[2023.01.25 - v2.3.1 - Chunel]
[2023.02.10 - v2.3.2 - Chunel]
[2023.02.12 - v2.3.3 - yeshenyong, Chunel]
[2023.02.22 - v2.3.4 - Chunel]
param mechanism and event (event) mechanism[2023.03.25 - v2.4.0 - woodx, Chunel]
pipeline scheduling resource management mechanism[2023.05.05 - v2.4.1 - Chunel]
pipeline maximum concurrency acquisition method. Thanks to Hanano-Yuuki for providing relevant solutionspipeline asynchronous execution function and exit function during execution[2023.06.17 - v2.4.2 - Chunel]
MultiCondition (multi-condition) functionpipeline pause execution and resume execution functions[2023.07.12 - v2.4.3 - Chunel]
CStatus功能,添加了异常定位信息[2023.09.05 - v2.5.0 - Chunel]
pipeline performance analysiselementsome (partial) functions to optimize the asynchronous execution of pipeline[2023.09.15 - v2.5.1 - Chunel]
fence functioncoordinator (coordinator) function[2023.11.06 - v2.5.2 - Chunel]
message (message) function, which can set the processing method when writing blocking, and reduce the number of memory copy timesexample related content to provide some simple implementations for different industries[2023.11.15 - v2.5.3 - Chunel]
proto definition filemutable function to provide dependency registration syntax sugar[2024.01.05 - v2.5.4 - Chunel]
test content, including performance and functionality test casesevent (event) mechanism and support asynchronous waiting function[2024.07.18 - v2.6.0 - PaPaPig-Melody, Chunel]
pipeline topologyelement[2024.09.17 - v2.6.1 - Chunel]
pipeline and provides a micro-task mechanism based on static executionpipeline clipping function to remove duplicate dependencies between elementelementevent (event) mechanism, asynchronous events can wait for end[2024.11.16 - v2.6.2 - Chunel]
tutorial contentThank you Doocs for publishing relevant introduction documents on WeChat official account. Welcome to join the Doocs open source community
Thanks to the journal introduction and recommendation of HelloGithub: HelloGithub Issue 70


Taskflow Group : awesome-parallel-computing, and we always treat taskflow as a role modelCGraph project, and will not mention them one by one. Everyone is welcome to join and build together