- Six Degrees of Kevin Bacon in Python: AI Project
- Project Details
- What can you learn from this project?
- Source Code
- Output
- Saved searches
- Use saved searches to filter your results more quickly
- License
- winwaed/kevin_bacon
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Saved searches
- Use saved searches to filter your results more quickly
- santiagomariani/Six-Degrees-of-Kevin-Bacon-Python
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- About
- Stars
- Watchers
- Forks
- Releases
- Packages 0
- Languages
- Footer
- Six degrees of Kevin Bacon: python
- Написать алгоритм
Six Degrees of Kevin Bacon in Python: AI Project
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.
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.
Output
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Solving the 6 Degrees of Kevin Bacon Problem using Python & SPARQL
License
winwaed/kevin_bacon
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Solving the 6 Degrees of Kevin Bacon Problem using Python 3 & SPARQL
This script is fully described in the blog post at:
Script to solve the Six Degrees of Kevin Bacon problem Finds the number of hops from the specified actor to Kevin Bacon, stopping at 6. Uses DBpedia’s SPARQL interface to query actors in films.
< actor >must be the DBpedia identifier for the label without a namespace eg. «Gillian_Anderson» (no quotes)
About
Solving the 6 Degrees of Kevin Bacon Problem using Python & SPARQL
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
The Bacon number of an actor or actress is the number of degrees of separation they have from actor Kevin Bacon. The higher the Bacon number, the farther away from Kevin Bacon the actor is. This implementation uses a csv file wich contains lot of movies and actors from IMDB and uses that to connect actors/actress through the movies. This informa…
santiagomariani/Six-Degrees-of-Kevin-Bacon-Python
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
About
The Bacon number of an actor or actress is the number of degrees of separation they have from actor Kevin Bacon. The higher the Bacon number, the farther away from Kevin Bacon the actor is. This implementation uses a csv file wich contains lot of movies and actors from IMDB and uses that to connect actors/actress through the movies. This informa…
Stars
Watchers
Forks
Releases
Packages 0
Languages
Footer
You can’t perform that action at this time.
Six degrees of Kevin Bacon: python
I have to complete a project which have an text file and finds path between 2 actors(kevin bacin game) that you input by going through the movies in the text file. For example if the text file is:
Apollo13 Kevin Bacon Tom Hanks Gary sinise HollowMan Elisabeth Shue Kevin Bacon Josh Brolin AFewGoodMen Tom Cruise Demi Moore Jack Nicholson Kevin Bacon OneCrazySummer John Cusack Demi Moore DaVinciCode Tom Hanks Ian McKellen Audrey Tautou
# Class for node class node: slots = ('movie','neighbor') # Node constructor def mkNode(name): n = node() n.name = name n.neighbor = [] return n # Find if node is in the graph def findNode(nodelist, name): for n in nodelist: if n.name == name: return n #Creates graph def loadGraphFile(file): graph = [] for line in file: contents = line.split() movieName = contents[0] actorNames = [contents[i]+ " " + contents[i+1] for i in range(1, len(contents), 2)] movieNode = findNode(graph, movieName) if movieNode == None: movieNode = mkNode(movieName) graph.append(movieNode) for actorName in actorNames: actorNode = findNode(graph,actorName) if actorNode == None: actorNode = mkNode(actorName) graph.append(actorNode) actorNode.neighbor.append(movieNode) movieNode.neighbor.append(actorNode) return graph def loadGraphFileName(file = "C:/Users/******/Desktop"): return loadGraphFile(open(file)) # Searches graph for path def search(start,goal,visited): if start == goal: return [start] else: for n in start.neighbor: content = line.split() for x in range(0,(len(content)-1),2): z = (content[x] + content[x+1]) if not z in visited: visited.append(z) path = search(z,goal,visited) if path != None: return [start] + path visited.append(x)
Написать алгоритм
Здравствуйте,нужна помощь. Есть задача ‘Число Бейкона'(six degrees of Kevin Bacon’). Есть текстовый документ ( https://github.com/taolin204/a. movies.txt ). Подскажите как решить эту задачу,сам алгоритм действий. Я понимаю, что сначала нужно найти все фильмы с Бейконом,потом с требуемым актером,а дальше что делать ? И как лучше преобразовать входные данные из текстового файла ?Создать список или словарь,где ключ-это актер(Бейкон),а значения это все те актеры,которые снимались с ним ?
Написать алгоритм
Помогите, пожалуйста, написать подробный алгоритм к коду: import math c=0.72 strBin = "" while.
Написать алгоритм
На плоскости задано множество из n точек и прямая ax+by+c=0. Найдите максимальное расстояние между.
Разработать алгоритм и написать код для решения
Компьютер загадывает число от 1 до n. У пользователя k попыток отгадать. После каждой неудачной.
Написать алгоритм и программу проверки прямоугольников на равенство
Стороны одного прямоугольника равны А и В. Стороны другого равны Х и Y. Написать алгоритм и.
Написать алгоритм и программу для нахождения количества всех месторождений железной руды
Доброго времени суток. Очень нужна помощь. Дана карта Свердловской области: Написать алгоритм и.
Используя алгоритм, написать программу
Не могу написать бинарный алгоритм
Не работает бинарный алгоритм,как можно сделать так чтобы он заработал? def binary_search(lists.
Написать алгоритм, строящий список из двух заданных списков а и b следующим образом
Написать алгоритм, строящий список из двух заданных списков а и b следующим образом: , b, а, b.
Написать алгоритм, строящий список из двух заданных списков а и b следующим образом
Задача 1.Написать алгоритм, строящий список из двух заданных списков а и b следующим образом: , b.
Написать алгоритм, который для заданного списка чисел находит сумму наименьшего элемента
Задача 2. Написать алгоритм, который для заданного списка чисел находит сумму наименьшего элемента.