forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathT03-Region.py
More file actions
33 lines (24 loc) · 719 Bytes
/
T03-Region.py
File metadata and controls
33 lines (24 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
@Author: Chunel
@Contact: chunel@foxmail.com
@File: T03-Region
@Time: 2025/2/24 22:52
@Desc:
"""
from PyCGraph import GPipeline, GRegion
from MyGNode.MyNode1 import MyNode1
from MyGNode.MyNode2 import MyNode2
def tutorial_region():
b1 = MyNode1("nodeB1")
b2 = MyNode2({b1}, "nodeB2", 2)
b3 = MyNode1({b1}, "nodeB3", 1)
b4 = MyNode1({b2, b3}, "nodeB4", 1)
b_region = GRegion([b1, b2, b3, b4])
pipeline = GPipeline()
a, c = MyNode1(), MyNode2()
pipeline.registerGElement(a, set(), "nodeA")
pipeline.registerGElement(b_region, {a}, "regionB", 2)
pipeline.registerGElement(c, {b_region}, "nodeC")
pipeline.process()
if __name__ == '__main__':
tutorial_region()