コード例 #1
0
ファイル: graph.py プロジェクト: aristotll/PyScholarGraph
    def add_second_layer_nodes(self, g, pos):
        for key in [x.encode('utf-8') for x in sort_articles(self.articles2L)]:
            s = str(self.get_size_of_art(key)) + '!'
            g.node(key,
                   group='2L',
                   width=s,
                   height=s,
                   # pos=str_(pos),
                   style="filled",
                   fillcolor=self.get_color_of_node(key),
                   color='black',
                   URL=cgi.escape(
                       self.articles2L[key]['url'].replace('http://scholar.google.com/', '')),
                   tooltip=self.get_tooltip(key))

            pos[0], pos[1] = pos[0]+SIZE_MAX*4, pos[1]  # - 5*4
コード例 #2
0
ファイル: graph.py プロジェクト: aristotll/PyScholarGraph
    def add_invis_art_paths(self, g):
        layers = []
        for y in range(MIN_YEAR_LAYERS, self.MAX_YEAR+1):
            if y == MIN_YEAR_LAYERS:
                arts = get_before_and_in_year(
                    y, self.all_articles, self.MIN_YEAR)
            else:
                arts = get_in_year(y, self.all_articles)
            r = sort_articles(arts)
            for i in range(len(r)-1):
                g.edge(r[i],
                       r[i+1],
                       minlen=str(0),
                       weight='150',
                       constraint='true',
                       style='invis')
            layers.append(r) if len(r) > 0 else None

        layers = [self.authors[:len(self.authors)/2]] + layers
        for i_l in range(len(layers)-1):
            self.add_invis_list_to_list_paths(g, layers[i_l], layers[i_l+1])