| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A lightweight DAG (Directed Acyclic Graph) execution framework for Go, ported from C++ CGraph-lite library.
package main
import "fmt"
// Define your custom node
type MyNode struct {
BaseGElement
}
func (n *MyNode) Run() *CStatus {
fmt.Printf("%s: Hello World!\n", n.GetName())
return NewCStatus()
}
func main() {
// Create pipeline
pipeline := Factory.Create()
// Register nodes
node := &MyNode{}
pipeline.RegisterGElement(node, []GElement{}, "MyNode")
// Execute
pipeline.Process(1)
// Cleanup
Factory.Remove(pipeline)
}See T02_Param.go for a complete example of sharing parameters between nodes.
go get github.com/AsunaU2/GoCGraphgo build .# Run simple example
go run T01_Simple.go go_cgraph_lite.go
# Run parameter example
go run T02_Param.go go_cgraph_lite.goBasic execution unit in the DAG. Implement the Run() method to define your logic.
Manages the entire DAG execution flow, handles dependencies and concurrent execution.
Thread-safe parameter sharing mechanism between nodes.
This project is inspired by and ported from the excellent CGraph-lite C++ library by ChunelFeng. We extend our heartfelt gratitude to the original author for creating such an elegant and efficient DAG execution framework.
MIT License
Pull requests are welcome! For major changes, please open an issue first.
| Back | FazBrowse Home | New Git URL |