def addLink(self, link): """ addLink adds a link to the GraphLib and updates its respective nodes. Call addNode first. @type link: GraphLink """ if link.origNode.id not in self.nodeMap: print('WARNING: Node %d is not present.' % link.origNode, file = sys.stderr) return link.distance = linear.getNorm(link.origNode.coordX, link.origNode.coordY, link.destNode.coordX, link.destNode.coordY) self.linkMap[link.id] = link self.nodeMap[link.origNode.id].outgoingLinkMap[link.id] = link