MIT1_204S10_assn3

MIT1_204S10_assn3 - 1.204 Computer Algorithms in Systems...

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

View Full Document Right Arrow Icon
1.204 Computer Algorithms in Systems Engineering Spring 2010 Problem Set 3 Due: 12 noon, Monday March 8, 2010 Problem 1: Arlington network a. Problem statement You are given a database table with TIGER (US Census and US Geological Survey) data for the town of Arlington, Massachusetts. Please download it, unzip it and attach it to your SQL Server instance. It is under Homework->Homework3 (ArlingtonNetwork.zip). The database consists of a single table, ArlingtonNetwork. It is not normalized, since it repeats latitude and longitude data. You will SELECT the data you need from this table. The data you will use will be normalized—you’re only selecting 3 columns from the table. The columns in the table and their descriptions are given below: 1. ID: Arc or street segment number. 2. StreetName 3. StartLatitude 4. StartLongitude 5. StartNode: node number at start of arc 6. EndLatitude 7. EndLongitude: 8. EndNode: node number at end of arc 9. StartAddress-L: the starting street address of the street on the left side 10. EndAddress-L: the ending street address of the street on the left side 11. StartAddress-R: similar to column 9, on the right side 12. EndAddress-R: similar to column 10, on the right side 13. ZipCode-L: zip code on the left side 14. ZipCode-R: zip code on the right side 15. Distance: length of the arc in meters You only need to use fields 5, 8 and 15 to create a network on which you can find shortest paths. These fields define from node (field 5), to node (field 8) and distance (field 15). Optional: also use street name (field 2), and display it when you output the network (in the steps below). You may ignore the other fields. Assign your own arc number instead of field 1. You will read this data from the SQL Server database table and create a modified Graph data structure. You will extend the adjacency array data structure to allow a program to
Background image of page 1

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

View Full DocumentRight Arrow Icon
not only easily find all the arcs out of a node, but also to find all the arcs into a node. An example is: 0 2 1 3 4 If we read the arcs from input and sort by ‘from’ node, we get: From To Cost (Arc number) 0 1 4 3 0 0 2 5 2 1 0 3 9 4 2 1 2 2 2 3 3 4 7 1 4 3 1 3 7 5 The ‘from’ node repeats when out-degree > 1 We recast this structure as arrays H, To, Cost (and T): (Node) H (Arc) To Cost Index T (Node) 0 0 0 1 4 3 0 00 1 3 1 2 5 2 5 01 2 4 2 3 9 4 1 22 3 4 3 2 2 2 3 43 4 6 4 4 7 1 2 54 5 6 (sentinel) 5 1 37 4 6(sent) 5 In the example, we use an ‘index’ array to put the arcs in order of their destination. If we read down ‘index’, it says that the arcs must be accessed in the order 0, 5, 1, 3, 2, 4 to be sorted by ‘to’ node rather than ‘from’ node: There are no arcs into node 0 Arcs 0 and 5 go into node 1 Arcs 1 and 3 go into node 2
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

MIT1_204S10_assn3 - 1.204 Computer Algorithms in Systems...

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

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