Skip to content

Instantly share code, notes, and snippets.

@zaghaghi
Created November 26, 2019 20:50
Show Gist options
  • Save zaghaghi/65382da570f300b946b0c81bdacfd4d7 to your computer and use it in GitHub Desktop.
Save zaghaghi/65382da570f300b946b0c81bdacfd4d7 to your computer and use it in GitHub Desktop.
Node Class
class Node:
def __init__(self, input_nodes=[]):
# گره‌هایی که مقدار به این گره ارسال می‌کنند
self.input_nodes = input_nodes
# گره‌هایی که این نود به آن‌ها مقدار ارسال می‌کند
self.output_nodes = []
# این گره را به عنوان گره خروجی تمامی گره‌های ورودی اضافه می‌کنیم
for n in self.input_nodes:
n.output_nodes.append(self)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment