Пример #1
0
 def set_levels(self):
     relationships = self.get_relationships()
     nodes = self.get_nodes()
     golden_sources = self.get_golden_sources()
     levels = NodeCalculator.calculate_levels(relationships=relationships, nodes=nodes,
                                              golden_sources=golden_sources)
     self.__levels = levels
Пример #2
0
    def set_node_usage_scores(self, nodes, relationships):
        node_root_scores = list()
        for node in nodes:
            score = NodeCalculator.calculate_usage_score(
                node=node, relationships=relationships)

            node_root_scores.append(score)

        self.__node_usage_scores = node_root_scores
Пример #3
0
    def test_root_score(self):
        test = NodeCalculator.calculate_root_scores(
            relationships=self.__relationships,
            grouped_weights=self.__grouped_weights,
            levels=self.__levels)

        # test = NodeCalculator.calculate_levels(golden_sources=self.__golden_sources, nodes=self.__nodes,
        #                                                 relationships=self.__relationships)
        pprint(test)
Пример #4
0
    def set_node_root_scores(self, nodes, relationships, grouped_weights):
        print(99, nodes)
        node_root_scores = list()
        for node in nodes:

            score = NodeCalculator.calculate_root_score(
                node=node,
                relationships=relationships,
                grouped_weights=grouped_weights)

            node_root_scores.append(score)

        self.__node_root_scores = node_root_scores
Пример #5
0
    def set_node_root_scores(self, nodes, levels, relationships,
                             grouped_weights):
        node_root_scores = list()

        root_scores = NodeCalculator.calculate_root_scores(
            relationships=relationships,
            grouped_weights=grouped_weights,
            levels=levels)
        for node in nodes:
            if node in root_scores:
                node_root_score = root_scores[node]
                node_root_scores.append(node_root_score)
            else:
                node_root_scores.append(0)

        self.__node_root_scores = node_root_scores
Пример #6
0
    def set_node(self, nodes, relationships, node_size_config, grouped_weights):
        node_sizes = list()

        for node in nodes:
            found = 0
            test = list()
            size = NodeCalculator.calculate_root_score(node=node, relationships=relationships,
                                                       grouped_weights=grouped_weights)

            for node_size, node_config in node_size_config.items():
                test.append(node_config[0])
                test.append(node_config[1])
                if node_config[0] <= int(size) < node_config[1]:
                    found_node_size = node_size
                    node_sizes.append(found_node_size)
                    found = 1

            if found == 0:
                found_node_size = max(test)
                node_sizes.append(found_node_size)

        self.__node_sizes = node_sizes
Пример #7
0
 def test_root_score(self):
     test = NodeCalculator.new_calculate_root_scores(
         relationships=self.__relationships,
         grouped_weights=self.__grouped_weights,
         levels=self.__levels)