15-396A Science of the Web
                                                                   Assignment 1
                                                                   Due September 2, 2008 @ 3:00pm




1. Milgram 2.0 (20 Points)
In this problem you will reproduce Milgram’s famous “Small World” experiment, which was designed to
measure the path lengths between any two people by developing a procedure to count the number of
ties between them.

Milgram’s Basic Procedure

Though the experiment went through several variations, Milgram typically chose individuals in the U.S.
cities of Omaha, Nebraska and Wichita, Kansas to be the starting points and Boston, Massachusetts to
be the end point of a chain of correspondence. These cities were selected because they represented a
great distance in the United States, both socially and geographically.

Information packets were initially sent to randomly selected individuals in Omaha or Wichita. They
included letters, which detailed the study’s purpose, and basic information about a target contact
person in Boston. The letters additionally contained a roster on which participants could write their own
name, as well as business reply cards that were pre-addressed to Harvard (Milgram’s home institution at
the time of the experiment).

Upon receiving the invitation to participate, the recipient was asked whether he or she personally knew
the contact person described in the letter. If so, the participant was to forward the letter directly to that
person. For the purposes of this study, knowing someone “personally” was defined as knowing them on
a first-name basis.

In the more likely case that the person did not know the target, then the person was to think of a friend
or relative they knew that was more likely to know the target. They were then directed to sign their
name on the roster and forward the packet to that person. A postcard was also mailed to the
researchers at Harvard so that they could track the chain’s progression toward the target.

When and if the package eventually reached the contact person in Boston, the researchers could
examine the roster to count the number of times it had been forwarded from person to person.
Additionally, for packages that never reached the destination, the incoming postcards helped identify
the break point in the chain.

Your Task

Using only messages to people who are your Facebook friends, you must find a way to eventually reach
your “targets.” Each target was chosen because they are (hopefully) far away from you in the network.
All targets are guaranteed to be on Facebook. You will be given each target’s real name, the town they
currently live in, and what they do for a living. Notice that you will not be given the name they use on
Facebook, which might be different from their real name.

In all likelihood you will not be Facebook friends with any of your targets. In which case, you must send a
message to one of your friends, who you think has a higher likelihood of knowing the person. If your
friend knows the target, they should forward the message directly to them. On the other hand, if they
don’t, they should also forward the message to somebody who they think is more likely to know the
target. This should continue inductively until the target is reached.

It is your job to compose the letter that will be forwarded to the targets, explaining the situation so that
the intermediaries are most likely to do their job well. (It is also recommended that you send the
message to friends that you think have a higher likelihood of actually forwarding the letter.)

It is also your job to make sure enough information is collected to reconstruct the path from you to each
target (so, for example, you could ask every intermediary to add their name to a list, or to send you a
message whenever they get your letter).

The targets have all agreed to participate in this exercise and have instructions to forward every
communication relating to it directly to the course staff.

For each target, each person should only forward the letter to ONE of their Facebook friends. We can
catch you if you flood all your friends because in such case the targets will probably receive more than
one copy of your message. You also may not forward your letter to any members of the course staff (we
will not forward any correspondence relating to this assignment). Finally, you may not befriend your
targets, nor should you ask intermediaries to befriend them. You can only befriend new individuals if
you actually know them in real life.

Grading for this problem will consist of two parts: (1) 10 points will be given for a detailed description of
the steps you took to ensure that your target was reached, such as: the letter you wrote, which of your
friends you originally sent it to, and how far along the letter got. (2) 10 points will be given if your letter
reaches at least one of the targets. (3) Zero points out of 20 will be given if we catch you spamming all
your friends. (4) If your letter reaches both targets, you will receive 5 points of extra credit.

The targets are:

Name: Antonio Juarez
Currently Lives In: Austin, TX (recently moved from Guatemala City)
Occupation: Software Engineer

Name: Babak Haghpanah
Currently Lives In: Tehran, Iran
Occupation: Graduate Student in Mechanical Engineering



                                                       2
2. MyFace (80 Points)
The goal of this problem is to write a Facebook App that allows you to determine some facts about your
friend network. In particular, we are interested in:

       How many of your friends are in a relationship.

       Who is the most “central” person in your network other than you (based on different notions of
        centrality).

       Your clustering coefficient.

To do this you will need to understand the Facebook API and some basic PHP. To learn about the
Facebook API visit http://developers.facebook.com/. For a quick tutorial on PHP, visit
http://devzone.zend.com/node/view/id/627 (or do a Web search for “PHP Tutorial”).

You must solve this problem using PHP – no other language (scripting or otherwise) will be tolerated.

Since you’ll need a server to run your application, we’ve set up an account for you on the main course
server: scienceoftheweb.org. Each of you has received an email with your password for this account. To
log in, simply ssh <your_andrew_id>@scienceoftheweb.org. After typing your password, you will land
on your home directory, which has a link to your html directory. The html directory is where your
application should live. To view your html directory on a browser, you can simply go to:

http://scienceoftheweb.org/students/<your_andrew_id>/

Thus, the file test.php in /home/<your_andrew_id>/html/ can be viewed at:

http://scienceoftheweb.org/students/<your_andrew_id>/test.php

This problem will be graded manually, so it is imperative that your code be easy to read. We will also run
MOSS on your code to determine if it was written by you.

The particular requirements are:

    1. In both the canvas page and the profile box, your application should display the total number of
       your friends who, according to Facebook, are in a relationship.

    2. In the canvas page, it should display the names and profile pictures of the people who are most
       central on your network according to the following three definitions of centrality: degree
       centrality, node-closeness centrality, and betweenness-centrality. Make sure that you (or any
       links involving you) are not considered in the calculations. These terms will be explained on
       Lecture 2 of the course.



                                                    3
3. In both the canvas page and the profile box, your application should display your clustering
       coefficient.

    4. The application should be written in PHP and HTML (with Javascript if necessary).

Additional points will be given for applications that display more information or are otherwise built to be
more compelling. The grading will be as follows: 60 points will be dedicated to “correctness” (i.e. the
application does everything it is supposed to do); and 20 points will be dedicated to cleanliness of your
code. Finally, up to 30 extra points can be obtained for compelling additions to the basic requirements
of this problem.

Your application should allow other Facebook users to add it to their own profile, since the grading will
be done by adding the App to a selected group of users. Please submit the URL of your application in
your writeup.

Note: You will be given an account on the class server for the duration of the course. This account is only
to help you become proficient at Web programming. Please do not touch any files that are not on your
own directory. If mess with the server and we catch you, Bren Meeder will physically crush you.

Submission Instructions
You must hand in a printed (typeset) version of your solutions on Tuesday September 2nd at the
beginning of lecture (3:00pm). In addition, all the code for your Facebook App should be on your html
directory in the class server at that time. Do not hand in printed code! All you need to put on your
writeup for Problem 2 is the Facebook URL of your App.




                                                    4

hwk1

  • 1.
    15-396A Science ofthe Web Assignment 1 Due September 2, 2008 @ 3:00pm 1. Milgram 2.0 (20 Points) In this problem you will reproduce Milgram’s famous “Small World” experiment, which was designed to measure the path lengths between any two people by developing a procedure to count the number of ties between them. Milgram’s Basic Procedure Though the experiment went through several variations, Milgram typically chose individuals in the U.S. cities of Omaha, Nebraska and Wichita, Kansas to be the starting points and Boston, Massachusetts to be the end point of a chain of correspondence. These cities were selected because they represented a great distance in the United States, both socially and geographically. Information packets were initially sent to randomly selected individuals in Omaha or Wichita. They included letters, which detailed the study’s purpose, and basic information about a target contact person in Boston. The letters additionally contained a roster on which participants could write their own name, as well as business reply cards that were pre-addressed to Harvard (Milgram’s home institution at the time of the experiment). Upon receiving the invitation to participate, the recipient was asked whether he or she personally knew the contact person described in the letter. If so, the participant was to forward the letter directly to that person. For the purposes of this study, knowing someone “personally” was defined as knowing them on a first-name basis. In the more likely case that the person did not know the target, then the person was to think of a friend or relative they knew that was more likely to know the target. They were then directed to sign their name on the roster and forward the packet to that person. A postcard was also mailed to the researchers at Harvard so that they could track the chain’s progression toward the target. When and if the package eventually reached the contact person in Boston, the researchers could examine the roster to count the number of times it had been forwarded from person to person. Additionally, for packages that never reached the destination, the incoming postcards helped identify the break point in the chain. Your Task Using only messages to people who are your Facebook friends, you must find a way to eventually reach your “targets.” Each target was chosen because they are (hopefully) far away from you in the network. All targets are guaranteed to be on Facebook. You will be given each target’s real name, the town they
  • 2.
    currently live in,and what they do for a living. Notice that you will not be given the name they use on Facebook, which might be different from their real name. In all likelihood you will not be Facebook friends with any of your targets. In which case, you must send a message to one of your friends, who you think has a higher likelihood of knowing the person. If your friend knows the target, they should forward the message directly to them. On the other hand, if they don’t, they should also forward the message to somebody who they think is more likely to know the target. This should continue inductively until the target is reached. It is your job to compose the letter that will be forwarded to the targets, explaining the situation so that the intermediaries are most likely to do their job well. (It is also recommended that you send the message to friends that you think have a higher likelihood of actually forwarding the letter.) It is also your job to make sure enough information is collected to reconstruct the path from you to each target (so, for example, you could ask every intermediary to add their name to a list, or to send you a message whenever they get your letter). The targets have all agreed to participate in this exercise and have instructions to forward every communication relating to it directly to the course staff. For each target, each person should only forward the letter to ONE of their Facebook friends. We can catch you if you flood all your friends because in such case the targets will probably receive more than one copy of your message. You also may not forward your letter to any members of the course staff (we will not forward any correspondence relating to this assignment). Finally, you may not befriend your targets, nor should you ask intermediaries to befriend them. You can only befriend new individuals if you actually know them in real life. Grading for this problem will consist of two parts: (1) 10 points will be given for a detailed description of the steps you took to ensure that your target was reached, such as: the letter you wrote, which of your friends you originally sent it to, and how far along the letter got. (2) 10 points will be given if your letter reaches at least one of the targets. (3) Zero points out of 20 will be given if we catch you spamming all your friends. (4) If your letter reaches both targets, you will receive 5 points of extra credit. The targets are: Name: Antonio Juarez Currently Lives In: Austin, TX (recently moved from Guatemala City) Occupation: Software Engineer Name: Babak Haghpanah Currently Lives In: Tehran, Iran Occupation: Graduate Student in Mechanical Engineering 2
  • 3.
    2. MyFace (80Points) The goal of this problem is to write a Facebook App that allows you to determine some facts about your friend network. In particular, we are interested in:  How many of your friends are in a relationship.  Who is the most “central” person in your network other than you (based on different notions of centrality).  Your clustering coefficient. To do this you will need to understand the Facebook API and some basic PHP. To learn about the Facebook API visit http://developers.facebook.com/. For a quick tutorial on PHP, visit http://devzone.zend.com/node/view/id/627 (or do a Web search for “PHP Tutorial”). You must solve this problem using PHP – no other language (scripting or otherwise) will be tolerated. Since you’ll need a server to run your application, we’ve set up an account for you on the main course server: scienceoftheweb.org. Each of you has received an email with your password for this account. To log in, simply ssh <your_andrew_id>@scienceoftheweb.org. After typing your password, you will land on your home directory, which has a link to your html directory. The html directory is where your application should live. To view your html directory on a browser, you can simply go to: http://scienceoftheweb.org/students/<your_andrew_id>/ Thus, the file test.php in /home/<your_andrew_id>/html/ can be viewed at: http://scienceoftheweb.org/students/<your_andrew_id>/test.php This problem will be graded manually, so it is imperative that your code be easy to read. We will also run MOSS on your code to determine if it was written by you. The particular requirements are: 1. In both the canvas page and the profile box, your application should display the total number of your friends who, according to Facebook, are in a relationship. 2. In the canvas page, it should display the names and profile pictures of the people who are most central on your network according to the following three definitions of centrality: degree centrality, node-closeness centrality, and betweenness-centrality. Make sure that you (or any links involving you) are not considered in the calculations. These terms will be explained on Lecture 2 of the course. 3
  • 4.
    3. In boththe canvas page and the profile box, your application should display your clustering coefficient. 4. The application should be written in PHP and HTML (with Javascript if necessary). Additional points will be given for applications that display more information or are otherwise built to be more compelling. The grading will be as follows: 60 points will be dedicated to “correctness” (i.e. the application does everything it is supposed to do); and 20 points will be dedicated to cleanliness of your code. Finally, up to 30 extra points can be obtained for compelling additions to the basic requirements of this problem. Your application should allow other Facebook users to add it to their own profile, since the grading will be done by adding the App to a selected group of users. Please submit the URL of your application in your writeup. Note: You will be given an account on the class server for the duration of the course. This account is only to help you become proficient at Web programming. Please do not touch any files that are not on your own directory. If mess with the server and we catch you, Bren Meeder will physically crush you. Submission Instructions You must hand in a printed (typeset) version of your solutions on Tuesday September 2nd at the beginning of lecture (3:00pm). In addition, all the code for your Facebook App should be on your html directory in the class server at that time. Do not hand in printed code! All you need to put on your writeup for Problem 2 is the Facebook URL of your App. 4