I have a simple problem which needs solving. I have some code which sorts out tasks dependant on other tasks. For examaple tasks A, B, C, and D. However These need sorting in order of dependancies. Example, task B can only be completed after task D is done. Therefore the order of tasks would be :
- A
- D
- B
- C
I have some code in Python, is there a way to make this code work in Rails (as in correct the syntax/method)
class Node:
def __init__(self, name):
self.name = name
self.edges = []
def addEdge(self, node):
self.edges.append(node)