Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Data Structures II - Graphs in COMP385 at Wentworth Institute, Assignments of Data Structures and Algorithms

Instructions for homework 11 in the data structures ii course offered by wentworth institute of technology's division of professional and continuing studies. The assignment focuses on using graph operations and is based on problem 10 from ford and topp. Students are required to perform various graph operations using the digraph.readgraph() method and print the graph after each operation. The due date for submission is december 6, 2005.

Typology: Assignments

Pre 2010

Uploaded on 08/16/2009

koofers-user-9na
koofers-user-9na 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Wentworth Institute of Technology
Division of Professional and Continuing Studies
COMP385 Section 71 - Data Structures II - Fall, 2005
Homework 11 – Using Graphs
Instructor: Bob Goldstein (617) 912-2512
bobg@vision.eri.harvard.edu
http://webpages.charter.net/tlgcreations/Courses/index.html
http://goldstein.eri.harvard.edu/courses/index.html
http://public.wit.edu/~goldsteinr/index.html
Due Date: December 6, 2005
Hand In: Printout of program code and dialogue of how it runs.
Purpose:
Get experience using Graph Operations.
This homework is based on problem 10, page 759 of Ford and Topp.
Description:
Start with the datafile graphB.dat that is in the ch24ex directory of the software supplement to Ford and Topp.
Read in the datafile using the DiGraph.readGraph() method. Once the graph is loaded, programmatically
perform the following operations, and print the graph after each operation using toString():
1. Insert an edge from F to D with weight 1.
2. Delete vertex F
3. Erase the edge (A,D).
4. Prompt the user to input a vertex, and list all of the neighbors of the vertex
5. Insert a new vertex, G.
6. Add the following edges with weight 8: (G,C), (G,E), (D,G)
7. Prompt the user to input a vertex, and print the neighbors of the vertex. Make sure you test this with vertex E.
Extra Credit:
Find a program on the internet that can graphically draw a graph datastructure. Implement this into your
program and in the above problem, instead of printing the graph with toString(), draw the graph after each
operation.
If you cannot find such a program on the internet, modify the drawTree program of Ford and Topp so that it
draws graphs instead of trees. To simplify the placement, assume there is no more than 10 vertices in the
graph.
/app/work/qkdb8q-369226-2765045-homework11-doc.doc 1 12/3/2020 12/3/2020

Partial preview of the text

Download Data Structures II - Graphs in COMP385 at Wentworth Institute and more Assignments Data Structures and Algorithms in PDF only on Docsity!

Wentworth Institute of Technology

Division of Professional and Continuing Studies

COMP385 Section 71 - Data Structures II - Fall, 2005

Homework 11 – Using Graphs

Instructor: Bob Goldstein (617) 912- bobg@vision.eri.harvard.edu http://webpages.charter.net/tlgcreations/Courses/index.html http://goldstein.eri.harvard.edu/courses/index.html http://public.wit.edu/~goldsteinr/index.html Due Date: December 6, 2005 Hand In: Printout of program code and dialogue of how it runs. Purpose: Get experience using Graph Operations. This homework is based on problem 10, page 759 of Ford and Topp. Description: Start with the datafile graphB.dat that is in the ch24ex directory of the software supplement to Ford and Topp. Read in the datafile using the DiGraph.readGraph() method. Once the graph is loaded, programmatically perform the following operations, and print the graph after each operation using toString():

  1. Insert an edge from F to D with weight 1.
  2. Delete vertex F
  3. Erase the edge (A,D).
  4. Prompt the user to input a vertex, and list all of the neighbors of the vertex
  5. Insert a new vertex, G.
  6. Add the following edges with weight 8: (G,C), (G,E), (D,G)
  7. Prompt the user to input a vertex, and print the neighbors of the vertex. Make sure you test this with vertex E. Extra Credit: Find a program on the internet that can graphically draw a graph datastructure. Implement this into your program and in the above problem, instead of printing the graph with toString(), draw the graph after each operation. If you cannot find such a program on the internet, modify the drawTree program of Ford and Topp so that it draws graphs instead of trees. To simplify the placement, assume there is no more than 10 vertices in the graph. /app/work/qkdb8q-369226-2765045-homework11-doc.doc 1 12/3/2020 12/3/