Skip to content

Commit 5fa0c74

Browse files
committed
Fixed issue in graph_representation.py
1 parent 10de058 commit 5fa0c74

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/graph/graph_representation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ def parse_xml_to_graph(xml_file_path):
119119
name=_get_value(user_data, "<name>", "</name>"),
120120
)
121121
adjacency_list[user.id] = []
122-
connections[user.id] = set()
122+
if user.id not in connections:
123+
connections[user.id] = set()
123124
# Parse posts
124125
posts_data = _get_values(user_data, "<post>", "</post>")
125126
for post_data in posts_data:
@@ -174,4 +175,4 @@ def _get_values(data, start_tag, end_tag):
174175
# graph = GraphRepresentation.build_graph(r"path to xml file")
175176
# print(graph.adjacency_list)
176177
# print(graph.connections)
177-
# # print(graph.get_user_connections(5))
178+
# print(graph.get_user_connections(5))

0 commit comments

Comments
 (0)