<commit_before>#!/usr/bin/env python

import vtk

g = vtk.vtkMutableDirectedGraph()

# Create 10 vertices
verts = [g.AddVertex() for i in range(0, 10)]

# Create a tree
g.AddGraphEdge(verts[4], verts[8])
g.AddGraphEdge(verts[6], verts[8])
g.AddGraphEdge(verts[0], verts[6])
g.AddGraphEdge(verts[2], verts[6])
g.AddGraphEdge(verts[1], verts[3])
g.AddGraphEdge(verts[3], verts[5])
g.AddGraphEdge(verts[5], verts[9])
g.AddGraphEdge(verts[7], verts[9])
g.AddGraphEdge(verts[8], verts[9])

tree = vtk.vtkTree()
tree.CheckedShallowCopy(g)

graphLayoutView = vtk.vtkGraphLayoutView()
graphLayoutView.AddRepresentationFromInput(tree)

treeStrategy = vtk.vtkTreeLayoutStrategy()

graphLayoutView.SetLayoutStrategy(treeStrategy)
graphLayoutView.ResetCamera()
graphLayoutView.Render()<commit_msg>attempting to fix the tree issue<commit_after>#!/usr/bin/env python

import vtk

g = vtk.vtkMutableDirectedGraph()

# Create 10 vertices
verts = [g.AddVertex() for i in range(0, 10)]
#v1 = g.AddVertex()
#v2 = g.AddVertex()
#
#g.AddGraphEdge(v1, v2)

# Create a tree
g.AddGraphEdge(verts[1], verts[0])
g.AddGraphEdge(verts[3], verts[1])
g.AddGraphEdge(verts[5], verts[1])
g.AddGraphEdge(verts[7], verts[5])
g.AddGraphEdge(verts[9], verts[5])
g.AddGraphEdge(verts[2], verts[0])
g.AddGraphEdge(verts[4], verts[2])
g.AddGraphEdge(verts[6], verts[2])
g.AddGraphEdge(verts[8], verts[4])
#g.AddGraphEdge(verts[4], verts[8])
#g.AddGraphEdge(verts[6], verts[8])
#g.AddGraphEdge(verts[0], verts[6])
#g.AddGraphEdge(verts[2], verts[6])
#g.AddGraphEdge(verts[1], verts[3])
#g.AddGraphEdge(verts[3], verts[5])
#g.AddGraphEdge(verts[5], verts[9])
#g.AddGraphEdge(verts[7], verts[9])
#g.AddGraphEdge(verts[8], verts[9])

tree = vtk.vtkTree()
success = tree.CheckedShallowCopy(g)

print("Success? " + str(success))

graphLayoutView = vtk.vtkGraphLayoutView()
graphLayoutView.AddRepresentationFromInput(tree)

treeStrategy = vtk.vtkTreeLayoutStrategy()

graphLayoutView.SetLayoutStrategy(treeStrategy)
graphLayoutView.ResetCamera()
graphLayoutView.Render()
{'fraction_non_alphanumeric': 0.17292490118577075, 'fraction_numerical': 0.03359683794466403, 'mean_word_length': 8.204545454545455, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4841395', 'n_tokens_mistral': 823, 'n_tokens_neox': 809, 'n_words': 127}