"Due date: **December 6th, 2023, 5pm** (no extension will be allowed).\n",
"\n",
"Submit your solution by email: romain.vuillemot@ec-lyon.com\n",
"\n",
"## Goal of this assignment\n",
"\n",
"In this assignment we provide you with a dataset of characters from a movie. Your role will be to answer the questions below programmatically, using Pyhon. **Please note you need to answer with fully working python code embedded in this notebook as solution (no external modules or files can be included).** \n",
"\n",
"## Grading\n",
"\n",
"- 30% on the results to the questions\n",
"- 50% on the code quality\n",
"- 20% on the notebook presentation\n",
"- \\+ 10% bonus question\n",
"\n",
"## Getting started\n",
"\n",
"We provide you with a dataset containing movie characters on each row. Each character has connections, based on the movie script, from which you will create a graph-based data structure. To get you started with the dataset, we provide you with the code that loads it:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cf409997-537f-4f89-a039-c2b3494972f2",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"data_file = 'users.csv'\n",
"\n",
"with open(data_file, 'r') as file:\n",
" lines = file.readlines()b\n",
" data = [tuple(line.strip().split(',')) for line in lines[1:]]"
]
},
{
"cell_type": "markdown",
"id": "c48b6391-d858-4a35-b428-b99434ee2d57",
"metadata": {
"tags": []
},
"source": [
"The `data` variable contains the list of characters. You may look at the `users.csv` file to grasp the values of this variable. Here is a sample of the dataset:\n",
"**Question 1 -** How many characters are in the dataset?"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9022b450-6fa6-41d0-999e-e019917cda79",
"metadata": {
"deletable": false,
"nbgrader": {
"cell_type": "code",
"checksum": "6474e3afbe1bbdb5b06ce64fc0534c4f",
"grade": false,
"grade_id": "cell-f45150625899eb53",
"locked": false,
"schema_version": 3,
"solution": true,
"task": false
},
"tags": []
},
"outputs": [],
"source": [
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
},
{
"cell_type": "markdown",
"id": "0a1a4c6c-f95c-4dc3-8bb3-863d1048ae79",
"metadata": {},
"source": [
"**Question 2 -** Write a function that turns the `data` variable into a dictionnary data structure like the one below below. You may be able to plot it with the `plot_character_connections` function provided in the next cell:\n",
"# please run the cells below the \"Utils\" section first\n",
"plot_character_connections(adjacency_list)"
]
},
{
"cell_type": "markdown",
"id": "4a62b350-2bc8-476d-b9c6-13a08d649bdc",
"metadata": {},
"source": [
"**Question 3 -** Is there a character self-connected to her/himself?"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "232f3d2a-8300-40c1-a908-ebfa5e380ae1",
"metadata": {
"deletable": false,
"nbgrader": {
"cell_type": "code",
"checksum": "12487a86c6f58024a3ebbe0d242b5d48",
"grade": false,
"grade_id": "cell-641c5f735f36d3f6",
"locked": false,
"schema_version": 3,
"solution": true,
"task": false
},
"tags": []
},
"outputs": [],
"source": [
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
},
{
"cell_type": "markdown",
"id": "b79c97bc-e7d5-4ff4-bb1c-5bdf1e3abae2",
"metadata": {},
"source": [
"**Question 4 -** How many communities can you identify? We define a community as a sub-graph of connected people by a path (i.e. a connected component)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "98186a3a-bd4c-4bf8-9ebd-2f350a83c856",
"metadata": {
"deletable": false,
"nbgrader": {
"cell_type": "code",
"checksum": "dcfadd1483b4e91449dcd93f77e36868",
"grade": false,
"grade_id": "cell-7b6675c6e2784006",
"locked": false,
"schema_version": 3,
"solution": true,
"task": false
},
"tags": []
},
"outputs": [],
"source": [
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
},
{
"cell_type": "markdown",
"id": "840a8875-2f71-4da9-bbe7-0f1aab5f612b",
"metadata": {},
"source": [
"**Question 5 -** Are connections mutual in the graph?"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "12d15b4d-cf98-45aa-994c-e41070b9ea3a",
"metadata": {
"deletable": false,
"nbgrader": {
"cell_type": "code",
"checksum": "90802fd6bde9d5da3b4577c3d86f9774",
"grade": false,
"grade_id": "cell-8875e1c325dd6853",
"locked": false,
"schema_version": 3,
"solution": true,
"task": false
},
"tags": []
},
"outputs": [],
"source": [
"# YOUR CODE HERE\n",
"raise NotImplementedError()"
]
},
{
"cell_type": "markdown",
"id": "5e1b0409-1dff-4d8b-a5d8-a1efa1c10125",
"metadata": {},
"source": [
"**Question 6 (BONUS) -** Among the community of characters, is there one fully connected? (i.e. where all characters are directly connected to the others)."
Due date: **December 6th, 2023, 5pm** (no extension will be allowed).
Submit your solution by email: romain.vuillemot@ec-lyon.com
## Goal of this assignment
In this assignment we provide you with a dataset of characters from a movie. Your role will be to answer the questions below programmatically, using Pyhon. **Please note you need to answer with fully working python code embedded in this notebook as solution (no external modules or files can be included).**
## Grading
- 30% on the results to the questions
- 50% on the code quality
- 20% on the notebook presentation
-\+ 10% bonus question
## Getting started
We provide you with a dataset containing movie characters on each row. Each character has connections, based on the movie script, from which you will create a graph-based data structure. To get you started with the dataset, we provide you with the code that loads it:
The `data` variable contains the list of characters. You may look at the `users.csv` file to grasp the values of this variable. Here is a sample of the dataset:
**Question 2 -** Write a function that turns the `data` variable into a dictionnary data structure like the one below below. You may be able to plot it with the `plot_character_connections` function provided in the next cell:
**Question 4 -** How many communities can you identify? We define a community as a sub-graph of connected people by a path (i.e. a connected component).
**Question 6 (BONUS) -** Among the community of characters, is there one fully connected? (i.e. where all characters are directly connected to the others).