dependencyGraph = DependencyGraph() dependencyGraph.addVertex("A") dependencyGraph.addVertex("B") dependencyGraph.addVertex("C") dependencyGraph.addVertex("D") print "\n" print dependencyGraph.es print dependencyGraph.vs["A"]["depList"] print dependencyGraph.vs["B"]["depList"] print dependencyGraph.vs["C"]["depList"] print dependencyGraph.vs["D"]["depList"] dependencyGraph.addEdge("B", 2, "A") dependencyGraph.addEdge("C", 5, "B") dependencyGraph.addEdge("D", 1, "B") print "\n" print dependencyGraph.es print dependencyGraph.vs["A"]["depList"] print dependencyGraph.vs["B"]["depList"] print dependencyGraph.vs["C"]["depList"] print dependencyGraph.vs["D"]["depList"] # dependencyGraph.setPrice("C", 2) # print "-" * 40 # print "(A)", dependencyGraph.vs["A"]["directPrice"], "-", dependencyGraph.vs["A"]["craftPrice"] # print "(B)", dependencyGraph.vs["B"]["directPrice"], "-", dependencyGraph.vs["B"]["craftPrice"] # print "(C)", dependencyGraph.vs["C"]["directPrice"], "-", dependencyGraph.vs["C"]["craftPrice"]
auctionItem = str(auction["item"]) auctionPrice = auction["buyout"] auctionQuant = auction["quantity"] auctionPricePU = float(auctionPrice) / auctionQuant dependencyGraph.addVertex(auctionItem) vertexPrice = dependencyGraph.getPrice(auctionItem) if vertexPrice > auctionPricePU: dependencyGraph.setPrice(auctionItem, auctionPricePU) edges = relationsGraph.getEdges(auctionItem) for edge in edges: dependencyGraph.addEdge(auctionItem, edge[0], edge[1]) # get a sorted list of craft / direct price differences diffs = dependencyGraph.getPriceDiffs() # dump price differences to file diffFile = open("/ABSOULTE_PATH_TO/data/diff-file.csv", "w") for diff in diffs: diffFile.write( ",".join([ relationsGraph.getLabel(diff[0]), str(diff[0]), str(diff[1]), str(diff[2]), str(diff[3]),