예제 #1
0
파일: animation.py 프로젝트: rik0/pynetsym
 def make_frame(self):
     fig = plt.figure(figsize=(5, 5))
     ax = fig.add_subplot(111)
     graph = self.graph.handle
     dst = degrees_to_hist(graph.degree())
     ccdf = sna.ccdf(dst)
     ax.loglog(ccdf)
     return fig
예제 #2
0
        label = '%d starting size' % sim.starting_network_size
        steps = sim.steps
        starting_edges = sim.starting_edges
        starting_networks_size = sim.starting_network_size

        if isinstance(sim.graph.handle, nx.Graph):
            graph = sim.graph.handle
        else:
            sim.graph.handle.write(filename)
            graph = nx.read_graphml(filename)

        print graph.number_of_nodes(), graph.number_of_edges()

        del sim

        dst = degrees_to_hist(graph.degree())
        ccdf = ccdf(dst)

        if ba_graph is None:
            ba_graph = nx.barabasi_albert_graph(steps + starting_networks_size,
                                                starting_edges)

            print 'Agent:', graph.number_of_nodes(),
            print graph.number_of_edges()
            print 'PB:', ba_graph.number_of_nodes(),
            print ba_graph.number_of_edges()

            ba_dst = degrees_to_hist(ba_graph.degree())
            F_pdf.gca().loglog(ba_dst,
                               marker=ba_marker,
                               color=ba_color,
예제 #3
0
        label = '%d starting size' % sim.starting_network_size
        steps = sim.steps
        starting_edges = sim.starting_edges
        starting_networks_size = sim.starting_network_size

        if isinstance(sim.graph.handle, nx.Graph):
            graph = sim.graph.handle
        else:
            sim.graph.handle.write(filename)
            graph = nx.read_graphml(filename)

        print graph.number_of_nodes(), graph.number_of_edges()

        del sim

        dst = degrees_to_hist(graph.degree())
        ccdf = ccdf(dst)

        if ba_graph is None:
            ba_graph = nx.barabasi_albert_graph(
                steps + starting_networks_size,
                starting_edges)

            print 'Agent:', graph.number_of_nodes(),
            print  graph.number_of_edges()
            print 'PB:', ba_graph.number_of_nodes(),
            print  ba_graph.number_of_edges()

            ba_dst = degrees_to_hist(ba_graph.degree())
            F_pdf.gca().loglog(ba_dst, marker=ba_marker, color=ba_color,
                linestyle='', label=ba_label)