Exemplo n.º 1
0
def test_badness_real():
    #networks = ['data/protein_interaction.adj']
    networks = ['data/food_web.adj', 'data/protein_interaction.adj', 'data/pierre_auger.adj']
    for filename in networks:
        G = Graph(readwrite.read_adjacency_list(filename))
        G = G.largest_component()
        G.defragment_indices()
        G.embed_ncMCE()
        badness = G.greedy_routing_badness()
        max_badness = max(badness.values())
        for vertex, attributes in G.vert.items():
            attributes.update({'color':badness[vertex]/max_badness})
            attributes.update({'size':badness[vertex]/max_badness})
        G.draw(representation='hyperbolic_polar', vertex_scale=50)
        G.embed_ncMCE(angular_adjustment=embedding.circular_adjustment)
        badness = G.greedy_routing_badness()
        max_badness = max(badness.values())
        for vertex, attributes in G.vert.items():
            attributes.update({'color':badness[vertex]/max_badness})
            attributes.update({'size':badness[vertex]/max_badness})
        G.draw(representation='hyperbolic_polar', vertex_scale=50)
    return