Algorithm-SixDegrees

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

for the game Six Degrees of Kevin Bacon.

REQUIREMENTS

I have developed this module for use with Perl 5.6.1 and above.
It requires Scalar::Util, which became part of the Perl core in
Perl 5.7.3.

SAMPLES

There are some samples in the F<samples/> directory; they will
require some preparation work to be usable.  Check the scripts
before running them for all the details.  These do have other
dependencies that you will have to satisfy before execution.

INSTALLATION

To install this module, run the following commands:

    perl Makefile.PL
    make

samples/ljc.pl  view on Meta::CPAN


=head1 DESCRIPTION

This sample script uses the popular weblog site LiveJournal
L<http://www.livejournal.com> and creates the necessary framework
for C<Algorithm::SixDegrees> to link users together into a chain.

=head1 FINDING USERS

Before running the script for the first time, please read
L<http://www.livejournal.com/bots/>.  In short, you will need to
change the C<$agent> variable; it must contain your email address.

Also, if you intend to run this more than a couple times, please
implement some form of results caching.  It could be as simple as
a C<tie>d DBM file; just please don't abuse the resource, as other
people rely on this courtesy LiveJournal extends for their own uses.

It will then try to connect the two LiveJournal users given on the
command line.

=head1 WEB VERSION

A web version of this utility is at
L<http://www.petekrawczyk.com/lj_connect/>.  It has extra options,
and will show the users as it progresses.  You may not get the same
result on the web version as this sample, but they should both be
equivalent lengths.

=cut

use warnings;
use strict;
use vars qw/$agent/;

samples/movie.pl  view on Meta::CPAN

	foreach my $result (@{$results}) {
		print "\t'", $result->[0], "' (career: " . $result->[1];
		print '-' . $result->[2] if ($result->[1] != $result->[2]);
		print ")\n";
	};
	exit(0);
}

=head1 MAKING A DATA SOURCE

A sample data source is at L<ftp://ftp.funet.fi/pub/mirrors/ftp.imdb.com/pub/>
I grabbed the F<actors.list.gz> and the F<actresses.list.gz> files from there.

I created a MySQL database table and some indexes:

  create database movact;
  grant all privileges on movact.* to movact identified by 'movact';
  use movact;
  create table movact ( actor varchar(128), movie varchar(128), year int );
  create index movact_actor on movact ( actor );
  create index movact_movie on movact ( movie );



( run in 1.869 second using v1.01-cache-2.11-cpan-df04353d9ac )