I want to create a graph using VTK class https://lorensen.github.io/VTKExamples/site/Python/Graphs/ConstructGraph/
def main():
g = vtk.vtkMutableUndirectedGraph()
v1 = g.AddVertex()
v2 = g.AddVertex()
g.AddEdge ( v1, v2 )
print ('Number of vertices:', g.GetNumberOfVertices())
print ("Number of edges:", g.GetNumberOfEdges())
g.AddEdge ( v1, v2 )
print ('Number of vertices:', g.GetNumberOfVertices())
print ('Number of edges:', g.GetNumberOfEdges())
graphLayoutView = vtk.vtkGraphLayoutView()
graphLayoutView.AddRepresentationFromInput(g)
graphLayoutView.ResetCamera()
graphLayoutView.Render()
graphLayoutView.GetInteractor().Start()
is the function defined. But I not quite sure how to use this.
For instance, in networkx I would do
t = [0, 2, 4, 5, 6, 8, 9, 11, 13, 1, 10, 1, 3, 7]
h= [1, 3, 3, 1, 7, 7, 10, 12, 12, 14, 14, 12, 14, 10]
ed_ls = [(x, y) for x, y in zip(tail, head)]
G = nx.OrderedGraph()
G.add_edges_from(ed_ls)
nx.draw(G)
Suggestions on how to create the same graph in VTK will be helpful