Design and Analysis of Algorithms

CSE 5311 Section 003 Fall 2004

Program 3

Due: November 24, 2004 (midnight). No late submissions accepted.

A social network is a graph whose vertices represent people and whose edges represent relationships between people. For this assignment you will implement a program that reads in and analyzes a social network, where the relationship is defined as "knowing" one another. So, if two people know one another, there will be an undirected edge connecting their corresponding vertices in the graph representation of the social network. Your program will analyze the minimum, maximum and average degree of vertices in the network, the average shortest path length between every pair of persons, the longest shortest path length between two people, and the largest clique in the graph (a set of people who all know each other). The specifics follow.

  1. All data structures and algorithms must be implemented by you. No part of your program can be copied from other sources.

  2. Your program will take a file name as an argument. The first two lines of the file will contain the number of persons P and number of "knows" relationships R in the file, respectively. The next P lines each start with a consecutive integer (1..P) followed by a space, followed by the person's name, which is a string of lowercase characters (a-z). The remaining R lines each consist of two integers u and v (1 ≤ u,vP, uv) separated by a space, which implies that person u and person v know each other. You can see a sample input file here.

  3. Your program will represent the information from the file as a graph using either an adjacency list or adjacency matrix representation.

  4. Your program will compute and output several statistics about the graph. You can see a sample output here.

    Note: Finding the largest clique in a graph is a NP-Complete problem, i.e., may incur an exponential running time in the number of persons P in the graph. So, you should implement an efficient version of the clique-finding algorithm, but any version that always finds the maximal clique may take a long time for large graphs.

  5. After ensuring that your program compiles and runs correctly on the omega or gamma system, submit all source code to me (holder@cse.uta.edu) by the above deadline. Please only send one email message; use attachments if sending multiple files. In addition to correct functionality and satisfaction of the above constraints, your submission will be graded based on good programming style and documentation.