Skip to content

Commit

Permalink
Create README description
Browse files Browse the repository at this point in the history
README is describing how the program works, and is quite nice because of
the way it's used on Github. It allows to display right on the home page
all the information about how to use the program.
  • Loading branch information
apelisse committed Aug 23, 2013
1 parent 6f220da commit 20b952d
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions README.rst
@@ -0,0 +1,86 @@
Actor Network
=============

This can be used to calculate bacon number between two actors (it
doesn't have to be with Kevin Bacon), and to display the result as a
graph.

It requires several step to make it work, but some shortcuts can be taken:
- Create all the commands to describe the graph (that can be done with
`parse_actors.py` or `generator.py`)
- Convert the commands into an actual graph database (using `importer` C
program)
- Read the database and display the resulting graph (using `bacon` C program

0. Compiling the application
----------------------------

The first thing you will need to do it to compile the application:

$ make

You can change some parameters, creating a `config.mak` with, for
example `CFLAGS` and `CC` variables.

Building the application will require you to have glib-2 development
library.

1. Building the database
------------------------

Of course, you need to build a database to use the program. There are
two ways to create a database, either you generate a random one (that is
fast, nothing to download), or you do it from IMDb database files (but
you need to download it first).

a. The fast way
---------------

The fastest way to build a graph database is to generate a random graph
using the `generator.py`. It will build a random graph, where:
- Every actor will be called Actor %i, with %i being an integer
- Every movie will be called Movie %i, with %i also being an integer

You can choose the number of movies and actors, and also the average
number of movies per actors.

The output of ̀generator.py` should be passed to ./importer

$ python generate.py | ./importer graph.db

This will build a very small database (thus very fast to build). If you
have more time (probably a couple of minutes), you can build a
"real-life" database:

$ python generate.py -a 2600000 -m 2000000 -r 8 -d 4 | ./importer graph.db

b. The real way
---------------

If you agree with IMDb policy, you can download the following files from
__: http://www.imdb.com/interfaces :
- actors.list
- actresses.list

Then, run the ̀parse_actors.py` script:

$ python parse_actors.py actors.list actresses.list | ./importer graph.db

2. Using the database
---------------------

The simplest way to use the database, is to use the ̀run.sh` script that
will generate the png file for you, and display it. There are a couple
of dependencies though:
- graphvi dot is required to interpet the dot graph. It should be
compiled with png support
- ImageMagic display will be required to display the image. Of course
you can replace it by the program of your choice.

Using the `run.sh` is pretty straigt-forward:

$ ./run.sh graph.db "De Niro, Robert" "Bacon, Kevin (I)"

Or if you generated the graph using the fast method:

$ ./run.sh graph.db "Actor 0" "Actor 1"

0 comments on commit 20b952d

Please sign in to comment.