I want to write interactive simulation using graph-tool. What I would like to do is first to visualize the graph, then pick nodes as an input for later actual simulation. How do I pass information from plot to function?
What I did so far - I looked through documentation and examples which do not provide such info.
If you invoke
output parameter set to
None (which is the default), it returns a:
Boolean-valued vertex property map marking the vertices which were selected interactively.
A group of vertices may be selected by holding the “shift” button while the pointer is dragged while pressing the left button.
import numpy as np import graph_tool.all as gt points = np.random.random((25, 2)) g, pos = gt.geometric_graph(points, 0.3) _, selected = gt.graph_draw(g, pos=pos) print(*selected.a)
1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0