Update app.py
Browse files
app.py
CHANGED
@@ -39,37 +39,11 @@ def create_binary_tree_edges(depth):
|
|
39 |
return edges
|
40 |
|
41 |
|
42 |
-
# def create_binary_tree_edges(depth):
|
43 |
-
# edges = []
|
44 |
-
# current_index = 0 # Start with the root node
|
45 |
-
|
46 |
-
# # For each level of depth until the desired depth
|
47 |
-
# for level in range(depth):
|
48 |
-
# # Calculate the number of nodes at this level
|
49 |
-
# level_nodes = 2 ** level
|
50 |
-
|
51 |
-
# # For each node at this level, create edges to its two children
|
52 |
-
# for i in range(level_nodes):
|
53 |
-
# left_child_index = current_index + level_nodes
|
54 |
-
# right_child_index = current_index + level_nodes + 1
|
55 |
-
# edges.append((current_index, left_child_index))
|
56 |
-
# edges.append((current_index, right_child_index))
|
57 |
-
# current_index += 1
|
58 |
-
|
59 |
-
# # The current index is now at the next level, so increase by the number of nodes at this level
|
60 |
-
# current_index += level_nodes
|
61 |
-
|
62 |
-
# return edges
|
63 |
-
|
64 |
-
# # Create edges for a binary tree with depth of 6
|
65 |
-
# binary_tree_edges = create_binary_tree_edges(6)
|
66 |
-
# binary_tree_edges
|
67 |
-
|
68 |
|
69 |
def plot_tree_using_igraph():
|
70 |
# Define the edges in a tree structure
|
71 |
# edges = [(0, 1), (0, 2), (1, 3), (1, 4), (2, 5), (2, 6)]
|
72 |
-
edges = create_binary_tree_edges(
|
73 |
# edges = [(str(n1), str(n2)) for (n1, n2) in edges]
|
74 |
|
75 |
print(edges)
|
|
|
39 |
return edges
|
40 |
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
def plot_tree_using_igraph():
|
44 |
# Define the edges in a tree structure
|
45 |
# edges = [(0, 1), (0, 2), (1, 3), (1, 4), (2, 5), (2, 6)]
|
46 |
+
edges = create_binary_tree_edges(8)
|
47 |
# edges = [(str(n1), str(n2)) for (n1, n2) in edges]
|
48 |
|
49 |
print(edges)
|