jeudi 1 octobre 2015

Avoiding overlaps in random spatial embedding of vertices

One indirect solution may be to use vertex_size property and make them smaller, thus reduce their chance of overlapping (or simply generating the drawing many times, until one without overlaps comes across). But I figure there may be more elegant way of going about this.

Example code:

ex1 = Graph(directed=False)
ex1.add_vertex(10)
ex1.add_edge_list([(0,1),(0,2),(0,3),(0,4)])
pos = random_layout(ex1)
graph_draw(ex1, pos=pos, vertex_text=vertex_index, bg_color=[1,1,1,1], output="test.png")

Example of overlaps:

enter image description here

enter image description here




Aucun commentaire:

Enregistrer un commentaire