def finalize(self): self.canvas.setBounds() if self.xaxis: self.createXAxisSpace() if self.yaxis: self.createYAxis() if self.y2axis: self.createY2Axis() if self.xaxis: self.createXAxis() Graph.finalize(self) self.background() self.boundingBox() self.canvas.finalize()
def finalize (self): self.canvas.setBounds () if self.xaxis: self.createXAxisSpace () if self.yaxis: self.createYAxis () if self.y2axis: self.createY2Axis () if self.xaxis: self.createXAxis () Graph.finalize (self) self.background () self.boundingBox () self.canvas.finalize ()
class Interests(): """An object for a group of people connected by interests """ def __init__(self, users_1, users_2, interests): # super().__init__(users_1, users_2, interests) self.interest_graph = Graph(users_1, users_2, interests) @staticmethod def _reconstruct_edges_from_nodes(nodes): """Given a list of nodes, construct all possible edges """ return list(combinations(sorted(nodes), 2)) def construct_full_interest_graph(self): """Calculates the full interest graph If 1 and 2 share interest A and 2 and 3 share interest A too, we will connect 1 and 3 with interest A. """ nodes_by_interests = self.interest_graph.nodes_by_weight() full_interest_graph = Graph([], [], []) for interest, nodes in nodes_by_interests.items(): for edge in self._reconstruct_edges_from_nodes(nodes): full_interest_graph.add_edges([edge[0]], [edge[1]], [interest]) self.full_interest_graph = full_interest_graph return full_interest_graph
def construct_full_interest_graph(self): """Calculates the full interest graph If 1 and 2 share interest A and 2 and 3 share interest A too, we will connect 1 and 3 with interest A. """ nodes_by_interests = self.interest_graph.nodes_by_weight() full_interest_graph = Graph([], [], []) for interest, nodes in nodes_by_interests.items(): for edge in self._reconstruct_edges_from_nodes(nodes): full_interest_graph.add_edges([edge[0]], [edge[1]], [interest]) self.full_interest_graph = full_interest_graph return full_interest_graph
def __init__(self, users_1, users_2, interests): # super().__init__(users_1, users_2, interests) self.interest_graph = Graph(users_1, users_2, interests)
def setSVG(self): self.canvas.create() Graph.setSVG(self)
def __init__(self): Graph.__init__(self, PieCanvas) self.addCSS('graph.css')
def __init__(self, canvas, **attr): Graph.__init__(self, canvas) self.setProperties()
def setSVG (self): self.canvas.create () Graph.setSVG (self)
def __init__ (self): Graph.__init__ (self, PieCanvas) self.addCSS ('graph.css')
def __init__ (self, canvas, **attr): Graph.__init__ (self, canvas) self.setProperties ()