    random_graph_source = vtkRandomGraphSource()
    random_graph_source.SetNumberOfVertices(5)
    random_graph_source.SetNumberOfEdges(4)
    # This ensures repeatable results for testing. Turn this off for real use.
    random_graph_source.SetSeed(123)
    random_graph_source.Update()
--
source = vtkRandomGraphSource()
source.Update()

view = vtkGraphLayoutView()
view.AddRepresentationFromInputConnection(source.GetOutputPort())

--
    source = vtkRandomGraphSource()
    source.DirectedOff()
    source.SetNumberOfVertices(100)
    source.SetEdgeProbability(0)  # Basically generates a tree
    source.SetUseEdgeProbability(True)
    source.SetStartWithTree(True)
