Minimal Spanning Tree (MST) HW4 Solution - STAT 534, Assignments of Statistics

The solution to hw4 of stat 534 - minimal spanning tree, which includes the output of the test-mst.c program, a minimal spanning tree plot, and the source code of the mst.c function.

Typology: Assignments

Pre 2010

Uploaded on 03/10/2009

koofers-user-hp0
koofers-user-hp0 🇺🇸

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Hil Lyons
STAT 534
HW 4
1) Original output
Below is the output from the test-mst.c program, which created the minimal spanning
tree.
Set: 3493064
Elements:
Point 3493384, x1 = 0.000000, x2 = 0.000000, id = 1
Point 3493528, x1 = 0.000000, x2 = 1.000000, id = 2
Point 3493672, x1 = 2.000000, x2 = 0.000000, id = 3
Point 3493816, x1 = 3.000000, x2 = 0.000000, id = 4
Graph: 3485400
Vertex set:
Set: 3485472
Elements:
Point 3493384, x1 = 0.000000, x2 = 0.000000, id = 1
Point 3493528, x1 = 0.000000, x2 = 1.000000, id = 2
Point 3493672, x1 = 2.000000, x2 = 0.000000, id = 3
Point 3493816, x1 = 3.000000, x2 = 0.000000, id = 4
Edge set:
Set: 3485616
Elements:
Edge 3493456
Point 3493528, x1 = 0.000000, x2 = 1.000000, id = 2
Point 3493384, x1 = 0.000000, x2 = 0.000000, id = 1
Edge 3493600
Point 3493672, x1 = 2.000000, x2 = 0.000000, id = 3
Point 3493384, x1 = 0.000000, x2 = 0.000000, id = 1
Edge 3493744
Point 3493816, x1 = 3.000000, x2 = 0.000000, id = 4
Point 3493672, x1 = 2.000000, x2 = 0.000000, id = 3
2) Minimal spanning tree for the set of 249 points
Shown (next page) is a plot of the points and minimal spanning tree for the points. The
list of vertices and edges are not shown but can be provided upon request.
Hil Lyons Page 1 5/1/2006
pf3
pf4

Partial preview of the text

Download Minimal Spanning Tree (MST) HW4 Solution - STAT 534 and more Assignments Statistics in PDF only on Docsity!

Hil Lyons

STAT 534

HW 4

1) Original output

Below is the output from the test-mst.c program, which created the minimal spanning

tree.

Set: 3493064

Elements:

Point 3493384, x1 = 0.000000, x2 = 0.000000, id = 1

Point 3493528, x1 = 0.000000, x2 = 1.000000, id = 2

Point 3493672, x1 = 2.000000, x2 = 0.000000, id = 3

Point 3493816, x1 = 3.000000, x2 = 0.000000, id = 4

Graph: 3485400

Vertex set:

Set: 3485472

Elements:

Point 3493384, x1 = 0.000000, x2 = 0.000000, id = 1

Point 3493528, x1 = 0.000000, x2 = 1.000000, id = 2

Point 3493672, x1 = 2.000000, x2 = 0.000000, id = 3

Point 3493816, x1 = 3.000000, x2 = 0.000000, id = 4

Edge set:

Set: 3485616

Elements:

Edge 3493456

Point 3493528, x1 = 0.000000, x2 = 1.000000, id = 2

Point 3493384, x1 = 0.000000, x2 = 0.000000, id = 1

Edge 3493600

Point 3493672, x1 = 2.000000, x2 = 0.000000, id = 3

Point 3493384, x1 = 0.000000, x2 = 0.000000, id = 1

Edge 3493744

Point 3493816, x1 = 3.000000, x2 = 0.000000, id = 4

Point 3493672, x1 = 2.000000, x2 = 0.000000, id = 3

2) Minimal spanning tree for the set of 249 points

Shown ( next page ) is a plot of the points and minimal spanning tree for the points. The

list of vertices and edges are not shown but can be provided upon request.

Minimal Spanning Tree, HW

x x

new edge, and the graph and point set are updated. The distance array at this index is set to -1, indicating that the row is obsolete and should be skipped in the pass through./ while (si_pts->current != NULL){ set_iterator_next(&vtx, si_vtx); min_dist = -1; for (i = 0; i < num_pts - 1; i++){ / initial pass through, all distances updated/ if (ini_dist == TRUE){ distance[i] = point_distance(isolated[i], vtx); fragment[i] = vtx;} / otherwise, skip if -1 or update dist as req/ else if (distance[i] != -1){ new_dist = point_distance(isolated[i], vtx); if (new_dist < distance[i]){ distance[i] = new_dist; fragment[i] = vtx; } } / update the min distance and pair/ if (distance[i] != -1){ if (min_dist == -1 || distance[i] < min_dist){ pair = i; min_dist = distance[i]; } } } / update graph, point set; use new vertex for next pass through*/ graph_add_edge(edge_make(isolated[pair], fragment[pair]), mstree); graph_add_vertex(isolated[pair], mstree); set_remove_element(isolated[pair], point_set); set_iterator_next(&vtx, si_vtx); distance[pair] = -1; set_iterator_reset(si_pts); ini_dist = FALSE; } return(mstree); }