示例#1
0
 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()
示例#2
0
 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 ()
示例#3
0
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
示例#4
0
    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
示例#5
0
 def __init__(self, users_1, users_2, interests):
     # super().__init__(users_1, users_2, interests)
     self.interest_graph = Graph(users_1, users_2, interests)
示例#6
0
 def setSVG(self):
     self.canvas.create()
     Graph.setSVG(self)
示例#7
0
 def __init__(self):
     Graph.__init__(self, PieCanvas)
     self.addCSS('graph.css')
示例#8
0
 def __init__(self, canvas, **attr):
     Graph.__init__(self, canvas)
     self.setProperties()
示例#9
0
 def setSVG (self):
     self.canvas.create ()
     Graph.setSVG (self)
示例#10
0
 def __init__ (self):
     Graph.__init__ (self, PieCanvas)
     self.addCSS ('graph.css') 
示例#11
0
 def __init__ (self, canvas,  **attr):
     Graph.__init__ (self, canvas)
     self.setProperties ()