Introduction
Are you a Hollywood Movie lover? If you are, you must know about Kevin Bacon, a popular American Actor. I'm not gonna tell his biography here but I will discuss about a project named after him.
In this tutorial, we will discuss about Six Degrees of Kevin Bacon in Python. It's an advanced Python Project solved by Artificial Intelligence. You can use this AI project for your final year submission too.
Let's dig more deep into the working principle of the project.
☛Visit Also: Tic Tac Toe Game in Python with Artificial Intelligence
Project Details
The logic of this project is based on the six degrees of separation. The concept is, Every Person in the World is connected Less than Six or Six Social Connections away from each other.
Here, we will find the shortest distance between two actors via a film on which both actors have worked together(based on the given data). This time a movie will be the connection between two actors.
The program uses the Breath-First Search technique to find the shortest distance between two actors.
This project was given at CS50 Artificial Intelligence with Python, Project 0. There we have given two python files, and two folders, 'large' and 'small'. Both folders contain three CSV files(same file names): 'people.csv', 'movies.csv', 'stars.csv'. These files contain person id, person name, movie id, movie name, stars id, etc.
Files present in the 'small' folder contain a few amount of data(for testing purpose only. It helps to find if the program is working or not) but in the 'large' folder, all the CSV files contain millions of data. With the help of these data, we will find the shortest distance between two actors.
Image - The Project Folder |
Between these two python files: degrees.py, and util.py we will run the first one. The program takes two names as input. If both names are present in the people.csv file then the program will return the shortest path via they are connected otherwise, it will return the "The Person not found" message.
For example, you want to find the distance between Tom Cruise and Tom Hanks. For these two inputs the program may return the output like this.
What can you learn from this project?
- Working with millions of data
- Working with CSV file using Python
- Solving a real-world problem using Artificial Intelligence.
- Application of Breadth-First Search.
- Real-life problem solving with data structure: Queue, Stack, etc.
Source Code
Download the source code from my GitHub Page(https://github.com/subhankar-rakshit/) through the download button given below.
Image - GitHub Page |