Programming project

Programming project - CS161, Winter 2010 Handout #15...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS161, Winter 2010 Handout #15 Programming Project Due by noon on Friday, February 19th. 1 Overview The purpose of this assignment is to give you experience implementing and experimenting with an algorithm. You will implement an algorithm for computing the strongly connected components of a directed graph and use it to investigate such components in random graphs and real-world networks. You can work individually or with one partner. If you work in a pair, both partners will receive the same grade. You can write your program(s) in C, C++ or Java and it must run on the machines of Stanfords myth cluster. The machines can be accessed via an ssh to myth.stanford.edu. 2 Assignment 2.1 Part I: Strongly Connected Components Program (35 points) Write a program that takes a directed graph as input and outputs the sizes (in terms of number of nodes) of the five largest strongly connected components, listed in order from largest to smallest. If there are less than 5 components in the graph, you should output 0 for the remaining components. You can implement any algorithm that you like, as long as it produces the correct result under the time constraints described below. For this part, you will be graded on the correctness of your program and not on style or whether you comment your code. Your code will be tested on 25 graphs, 10 of which we will provide to you in advance. The sizes of the networks your algorithm will be tested on vary from 100 nodes and 50 edges to one million nodes and 7 million edges. To get full credit, your program must produce the correct answer in a reasonable amount of time. As a guideline, we expect your program to solve each of the 25 test graphs within 2 minutes, and networks with 10000 nodes and 30000 edges within 5 seconds. 2.1.1 If you are using C/C++... 1. The name of your main file should be sccfinder.c (or sccfinder.cpp). You should copy the code under /usr/class/cs161/startercode/c to the folder you want to work in. The starter code includes a file called sccfinder.cpp: this is the skeleton code that should get you started. Do not change the main function of this file because it contains the code that makes sure your output format is correct. Start by implementing the findSccs(char* inputFile, int out[5]) function and add any new functions or files you may need. The startercode/c folder also includes a simple Makefile. 2. How to compile locally: We will be expecting make to generate a binary called sccfinder. We will compile your source code by calling the following command: myth12:~your-local-dir/$ make So before submitting your code, make sure that your code makes without errors and outputs a bi- nary called sccfinder. 3. How to run locally: After you compile your code, you should run the following command to run your code: myth12:~your-local-dir/$ ./sccfinder <inputfile> <outputfile> Here < inputfile > and < outputfile > will be substituted with a file path (see the section on input and output format)....
View Full Document

This document was uploaded on 03/03/2010.

Page1 / 6

Programming project - CS161, Winter 2010 Handout #15...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online