Docsity

Data Structures and Algorithms Assignment 4: Social Network Experiment - Prof. Amit Jain, Lab Reports of Computer Science

Toggle sidebar
bg1
COMPSCI 342: Data Structures and Algorithms
Programming Assignment 4
Due Date: 8th May (100 points)
1 Introduction
In this assignment you will experiment with various random graphs that simulate social
networks like Facebook. Start with the programs in the examples folder lab/graphs.
Please make sure that the name of your main class is SocialNetworkExperiment.
2 The Experiment
•Generate a random graph with specified average degree. Use the class RandomGraph
provided in the example code.
•Calculate the average, minimum and maximum degrees.
•Calculate the number of connected components.
•Calculate the diameter of each connected component. The diameter is the length of
the longest shortest-path between any two pairs of vertices in that component. Print
the minimum, average and maximum diameter of the components in the graph.
•Repeat the experiment ttimes, where tis specified as a command line argument.
3 Extra credit: Using JFreeChart (20 points)
You will need to download the fat-jar plug-in in order to bundle the JFreeChart jar files
along with your class files in Eclipse. The fat-jar plug in update site for Eclipse is:
http://kurucz-grafika.de/fatjar
Now use the JFreeChart package to plot the following graphs from inside your program.
•Plot the number of components versus the average degree.
•Plot the diameter versus the average degree.
pf2

Partial preview of the text

Download Data Structures and Algorithms Assignment 4: Social Network Experiment - Prof. Amit Jain and more Lab Reports Computer Science in PDF only on Docsity!

COMPSCI 342: Data Structures and Algorithms

Programming Assignment 4

Due Date: 8th May (100 points)

1 Introduction

In this assignment you will experiment with various random graphs that simulate social networks like Facebook. Start with the programs in the examples folder lab/graphs.

Please make sure that the name of your main class is SocialNetworkExperiment.

2 The Experiment

  • Generate a random graph with specified average degree. Use the class RandomGraph provided in the example code.
  • Calculate the average, minimum and maximum degrees.
  • Calculate the number of connected components.
  • Calculate the diameter of each connected component. The diameter is the length of the longest shortest-path between any two pairs of vertices in that component. Print the minimum, average and maximum diameter of the components in the graph.
  • Repeat the experiment t times, where t is specified as a command line argument.

3 Extra credit: Using JFreeChart (20 points)

You will need to download the fat-jar plug-in in order to bundle the JFreeChart jar files along with your class files in Eclipse. The fat-jar plug in update site for Eclipse is:

http://kurucz-grafika.de/fatjar

Now use the JFreeChart package to plot the following graphs from inside your program.

  • Plot the number of components versus the average degree.
  • Plot the diameter versus the average degree.

4 Submission

The program should be bundled as a jar file that contain all needed classes as well as any external jar files for JFreeChart. The name of the jar file must be sne.jar and it should be at the top level of your submitted folder. The program should take three command line arguments:

java -jar sne.jar <n=#vertices> <d=average degree> <t=#iterations> []

The last argument (random seed) is optional. If specified, use that as a random seed and assume that the number of iterations is just one. This option is provided for testing and comparison purposes.

Please submit all the source code with a brief README file with your comments as well.

Make a separate subdirectory for the assignment. Once you are ready to submit, make sure you are in the right directory (that is, in your directory where your programs for this assignment are) and execute the following command (where 4 is the assignment number):

submit amit cs342 4

This will copy all the files in your current directory for submission and will time stamp the files as well.