Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hudshiy1 authored Dec 17, 2023
1 parent b2142bd commit 194985c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions trunk/ii02301/task_03/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
text_on_vertex='text on vertex'
id_text='id text'
num_of_vertex='num of vertex'
canvas=none
main_label=main_label(tk)
canvas = None
main_label = tk.Label(root)


main_label = main_label
cord_edge2 = {'id_vertex1': [], 'id_vertex2': []}
cord_edge = {'id_edge_text': [], 'id_vertex1': [], 'id_vertex2': []}
cord = {'id': [], id_text: [], text_on_vertex: [], 'textID': [], num_of_vertex: [], 'coordinatesX': [],
Expand Down Expand Up @@ -53,7 +56,7 @@ def draw_canvas1(event):


def draw_edge():
global canvas
canvas
main_label.configure(text="Выбрано создание ребер, нажмите на вершину для создания ребра")
canvas.unbind(button_1)
canvas.bind(button_1, draw_canvas2)
Expand Down Expand Up @@ -193,7 +196,7 @@ def adjacency_matrix():
adj_matrix.title("Adjacency matrix")
adj_matrix.geometry("150x150")
matrix = [[0 for _ in range(len(ovals))] for _ in range(len(ovals))]
for index, value in enumerate(cord_edge['id_vertex1']):
for index in enumerate(cord_edge['id_vertex1']):
matrix[cord['id'].index(cord_edge['id_vertex1'][index])][cord['id'].index(cord_edge['id_vertex2'][index])] = 1
matrix[cord['id'].index(cord_edge['id_vertex2'][index])][cord['id'].index(cord_edge['id_vertex1'][index])] = 1

Expand All @@ -210,7 +213,7 @@ def incidence_matrix():
inc_matrix.title("Incidence matrix")
inc_matrix.geometry("150x150")
matrix = [[0 for _ in range(len(edges))] for _ in range(len(ovals))]
for index, value in enumerate(cord_edge['id_vertex1']):
for index in enumerate(cord_edge['id_vertex1']):
matrix[cord['id'].index(cord_edge['id_vertex1'][index])][edges.index(cord_edge['id_edge_text'].index(
cord_edge['id_edge_text'][index]))] = 1
matrix[cord['id'].index(cord_edge['id_vertex2'][index])][edges.index(cord_edge['id_edge_text'].index(
Expand Down

0 comments on commit 194985c

Please sign in to comment.