{"id":15994038,"url":"https://github.com/knutwalker/bacon-number","last_synced_at":"2025-10-21T03:30:40.030Z","repository":{"id":11867198,"uuid":"14426990","full_name":"knutwalker/bacon-number","owner":"knutwalker","description":"Calculates the Bacon Number based upon the Neo4j example data","archived":true,"fork":false,"pushed_at":"2014-01-02T06:18:09.000Z","size":116,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T23:38:51.933Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://blog.knutwalker.de/bacon-number/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knutwalker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-15T14:56:52.000Z","updated_at":"2024-10-14T14:07:24.000Z","dependencies_parsed_at":"2022-09-14T22:03:15.733Z","dependency_job_id":null,"html_url":"https://github.com/knutwalker/bacon-number","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2Fbacon-number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2Fbacon-number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2Fbacon-number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knutwalker%2Fbacon-number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knutwalker","download_url":"https://codeload.github.com/knutwalker/bacon-number/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237429406,"owners_count":19308788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-08T07:05:19.167Z","updated_at":"2025-10-21T03:30:39.637Z","avatar_url":"https://github.com/knutwalker.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"bacon-number\n============\n\nCalculates the [Bacon Number](http://en.wikipedia.org/wiki/Bacon_number#Bacon_numbers) based upon the Neo4j example data\n\n### Usage ###\n\nYou'll need to have [Neo4j](http://www.neo4j.org/) running and populated with a data set about movies and actors.\nNeo4j comes with such a data set as an example. The essential relationship is `(:Person)-[:ACTED_IN]-\u003e(:Movie)`\n\nOn *NIX, you can install Neo4j as follows\n\n    wget -qO- http://dist.neo4j.org/neo4j-community-2.0.0-M06-unix.tar.gz | tar xzf -\n    cd neo4j-community-2.0.0-M06/\n    bin/neo4j start\n    # open http://localhost:7474/browser/\n    # stop with bin/neo4j stop\n\nIn this UI, type in `:play movies` and follow the instructions until the data in imported\n(which will take a couple of secs).\n\nThen, to start the python app, you'll have to install [flask](http://flask.pocoo.org/docs/installation/) and\n[requests](http://www.python-requests.org/en/v2.0-0/user/install/#install).\nOr you can just `pip install -r requirements.txt` in your favourite virtualenv.\n\nEither way, start the app by\n\n    python bacon_number.py\n\nFor more options, see `python bacon_number.py --help`\n\n### API\n\nThe app has two endpoints:\n\n- /\\\u003cactor\u003e\n\n  This will calculate the Bacon Number for the given author\n\n- /\\\u003cactor\u003e/\\\u003csome\\_other\\_actor\u003e\n\n  This will calculate the distance between the two given authors. (some\\_other\\_author is treated as Kevin Bacon)\n\nThe output format is shamelessly ripped off of [Google](https://www.google.com/#q=bacon+number+of+keanu+reeves)\n\n\n### The Query\n\nThe [Cypher](http://www.neo4j.org/learn/cypher) Query to retrieve the Bacon Number and its intermediate steps is\n\n\tMATCH\n\t\tp=shortestPath((kevin:Person)-[r:ACTED_IN*]-(actor))\n\tWHERE\n\t\tkevin.name={kevin} AND actor.name={actor}\n\tRETURN\n\t\tlength([m in nodes(p) WHERE m:Movie]) as BaconNumber,\n\t\t[m in nodes(p) WHERE m:Movie | m.title] as Movies,\n\t\t[a in nodes(p) WHERE a:Person | a.name][1..-1] as KnowsActors\n\n`{kevin}` and `{actor}` are substituted with the given actor names.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknutwalker%2Fbacon-number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknutwalker%2Fbacon-number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknutwalker%2Fbacon-number/lists"}