Skip to content

Commit 26cdf84

Browse files
committed
updated
1 parent b03bb41 commit 26cdf84

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

Figure_1.png

29.7 KB
Loading

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,19 @@ poetry install
88

99
```sh
1010
poetry run python ./social.py
11-
```
11+
```
12+
13+
To find the shortest path between Alice and David.
14+
15+
<img src="./Figure_1.png"></img>
16+
17+
Next exercise proposition:
18+
19+
- Imagine every person starts with a distance of 100 between them.
20+
- Every time that a person share somethin with anyone, the distance between them is reduced by:
21+
distance = 100/(N+1)
22+
23+
Where N = number of time that the user has share something with that user.
24+
25+
- If distance between 2 users that never shared directly, is less than 40, that user should appears as suggestion.
26+
- If distance between 2 users that never shared directly, is less than 10, that user should appear as recommendation as friend.

social.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ def draw_graph(graph, shortest_paths, start_node, end_node):
5555

5656
# Definimos el grafo que representa la red social
5757
graph = {
58-
'Alice': {'Bob': 5, 'Charlie': 2},
58+
'Alice': {'Bob': 5, 'Charlie': 2, 'Jhon':1.5},
5959
'Bob': {'Alice': 5, 'David': 3},
6060
'Charlie': {'Alice': 2, 'David': 7},
61-
'David': {'Bob': 3, 'Charlie': 7}
61+
'David': {'Bob': 3, 'Charlie': 7},
62+
'Jhon': {'Alice':1.5}
6263
}
6364

6465
# Especificamos los nodos de inicio y fin para encontrar la distancia más corta entre ellos

0 commit comments

Comments
 (0)