-
Notifications
You must be signed in to change notification settings - Fork 0
π Beginner diploma
Your mission is to create a social graph and to write functions that answer questions about the social graph:
- Are two members friends?
- What's the average number of friends?
- Given two friends, calculate how many friends they have in common
- BONUS: Are two members connected through a friendship path (Dijsktra algo might help)?
Also, please write functions that change the graph, without using any atoms:
- Add a member
- Remove a member
- Add friendship
- Remove friendship
Remark: Make sure the main functions have a docstring (at least 5 functions!)
Think about how to represent the social graph with immutable data structures.
Write code that generate a graph with around 1000 members and 5000 friend relationships.
For sake of simplicity, you can represent a member with a string that contains the member name (and assume that no two members have the same name).
Remark: The name of the persons should be real names like David or Jessica. Not machine generated names like "xhcjhfjd".
Write functions that add or remove members and friends. The functions should return a new version of the graph.
Write functions that query the graph:
- Are two members friends?
- What's the average number of friends of a member
- Are two members connected?
Good luck!
Feel free to ask questions on Slack for clarification or π help.