forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathT27-Trim.py
More file actions
33 lines (23 loc) · 695 Bytes
/
T27-Trim.py
File metadata and controls
33 lines (23 loc) · 695 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: T27-Trim
@Time: 2025/5/1 20:32
@Desc:
"""
from PyCGraph import GPipeline
from MyGNode.MyNode1 import MyNode1
from MyGNode.MyNode2 import MyNode2
def tutorial_trim():
pipeline = GPipeline()
a, b, c, d = MyNode1(), MyNode2(), MyNode1(), MyNode2()
pipeline.registerGElement(a, set(), "nodeA")
pipeline.registerGElement(b, {a}, "nodeB")
pipeline.registerGElement(c, {a}, "nodeC")
pipeline.registerGElement(d, {a, b, c}, "nodeD")
trim_size = pipeline.trim()
print('trim size is: {0}'.format(trim_size))
skeleton = pipeline.dump()
print(skeleton)
if __name__ == '__main__':
tutorial_trim()