Skip to content

Commit 36eeb28

Browse files
committed
updated
1 parent 5b9a5b5 commit 36eeb28

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Figure_2.png

37.7 KB
Loading

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,11 @@ Next exercise proposition:
2424

2525
- If distance between 2 users that never shared directly, is less or equal than 40, that user should appears as suggestion.
2626
- If distance between 2 users that never shared directly, is less or equal than 10, that user should appear as recommendation as friend.
27+
28+
Solution for the exercise:
29+
30+
```sh
31+
poetry run python ./exercise.py
32+
```
33+
34+
<img src="./Figure_2.png"></img>

exercise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def draw_graph(graph, suggestions, recommendations):
7373
for friend, weight in edges.items():
7474
G.add_edge(user.name, friend.name, weight=weight, label=f"{weight:.2f}") # Add edge labels
7575

76-
pos = nx.spring_layout(G, seed=42)
76+
pos = nx.fruchterman_reingold_layout(G) # Utilizar fruchterman_reingold_layout para posicionar los nodos
7777
nx.draw(G, pos, with_labels=True, node_size=1000, node_color='lightblue', font_size=10)
7878

7979
# Draw edge labels

0 commit comments

Comments
 (0)