def getEdgeReverse(self, label): edgeList = linkedLists.DSALinkedList() for i in range(self.edges.getLength()): if self.edges.getNthNode(i).origin == label: edgeList.insertLast( DSAGraph.DSAGraphEdge( self.edges.getNthNode(i).origin, self.edges.getNthNode(i).to, self.edges.getNthNode(i).symbol, self.edges.getNthNode(i).priceChange, self.edges.getNthNode(i).priceChangePercent, self.edges.getNthNode(i).weightedAvgPrice, self.edges.getNthNode(i).prevClosePrice, self.edges.getNthNode(i).lastPrice, self.edges.getNthNode(i).highPrice, self.edges.getNthNode(i).lowPrice)) return edgeList
def depthFirstSearch(self, startVertex): for i in range(self.vertices.getLength()): self.vertices.getNthNode(i).visited = False for i in range(self.vertices.getLength()): if self.vertices.getNthNode(i).label == startVertex: self.vertices.getNthNode(i).visited = True flag = i S = DSAStack.DSAStack() S.push(self.vertices.getNthNode(i).label) T = linkedLists.DSALinkedList() while S.isEmpty() == False: print(self.vertices.getNthNode(flag).label) vertList = self.getEdge(self.vertices.getNthNode(flag).label) print(vertList.printListInOrder()) print(vertList.getLength()) for i in range(vertList.getLength()): print("hiiiiii") print(vertList.getNthNode(i))
def __init__(self): self.vertices = linkedLists.DSALinkedList() self.edges = linkedLists.DSALinkedList()
def getEdgeReverse(self, label): edgeList = linkedLists.DSALinkedList() for i in range(self.edges.getLength()): if self.edges.getNthNode(i).origin == label: edgeList.insertLast(self.edges.getNthNode(i).to) return edgeList
def getEdge(self, label): edgeList = linkedLists.DSALinkedList() for i in range(self.edges.getLength()): if self.edges.getNthNode(i).origin == label: edgeList.insertFirst(self.edges.getNthNode(i).to) return edgeList.printListInOrder()