Sale!

CSE 3318 Lab Assignment 5 solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (3 votes)

Goals:
1. Understanding of graph representations.
2. Understanding of reachability.
Requirements:
1. Write a C program that uses the “pebble game” technique to test if an input graph is minimally rigid (in two dimensions).
The first line of the input will be n, the number of vertices. n will not exceed 100. Each of the remaining 2n – 3 lines will
contain two values in the range 0 . . . n – 1 to designate an undirected edge. (Self-loops and parallel edges will not be
included.) Each input line should be echoed to the output before being processed. The last line of your output should be
either 1) an indication that the graph is minimally rigid (“Laman”) or 2) an indication that the last edge processed is
“redundant” along with the set of vertices giving the rigid subgraph for the redundant edge.
2. If a pebble is moved, you should output the vertices on the pebble’s path.
3. Submit your C program on Canvas by 5:00 pm on December 8. Comments at the beginning of the source file should
include: your name, your ID number, and the command used to compile your code on Omega (5 point penalty for noncompliance).
Getting Started:
1. The input is easily read by using scanf(). Do not prompt for a file name!
2. The following bar-and-joint system has n = 6 vertices, 2n – 3 = 9 edges, and is initialized with two pebbles at each vertex:
3. The first rule of the pebble game changes an undirected edge between vertices x and y to a directed edge from x to y.
Before applying this rule, both vertices must have two pebbles. After applying this rule, x will have just one pebble and y
will still have two pebbles.
4. The second rule allows a pebble to be moved against the direction of a path. i.e. the path
may be converted to:
Undirected edges are not allowed on the path.
5. To analyze rigidity, the two rules may be applied in any order with the goal of making all edges directed.
0 1
3 2
4
5
. . .
. . .
6. The following characterizations of Gerard Laman give an algorithmically expensive way of testing rigidity:
The edges of a graph G = (V, E) are independent (non-redundant) in two dimensions if and only if no subgraph G´ = (V´,
E´) (with n´ vertices) has more than 2n´ – 3 edges.
(Corollary) A graph with 2n – 3 edges is rigid in two dimensions if and only if no subgraph G´ (with n´ vertices) has more
than 2n´ – 3 edges.
7. Jacobs and Hendrickson (http://www.csun.edu/~dj54698/pdf/13.pdf) further developed the “pebble game”
technique to test rigidity in time:
Place two pebbles at each vertex.
for each input edge {x y}
Attempt to get two pebbles (four total) at vertices x and y.
This may be done using BFS (or DFS) to find a directed path
to a vertex (other than x or y) with a pebble. After
the vertex is found, the path must be reversed.
if four pebbles are achieved
Use one pebble on x to record the directed edge x ® y.
else
// Only three pebbles were achieved for {x y}.
{x y} is a redundant edge.
The vertices reached during the last search induce a rigid subgraph.
exit(0)
// All edges have been directed . . . Graph is minimally rigid.
8. The graph in 2. may be shown to be rigid by the following steps:

 


Ο n
⎛ 2

⎜ ⎞


0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5

 

9. The following bar-and-joint system has n = 6 vertices and 2n – 3 = 9 edges, but has issues with rigidity:

 

0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5

 

If a search is attempted for bringing a second pebble to vertex 1, vertices 3, 0, and 2 would be reached using directed
edges. This shows that the {0, 1, 2, 3} subgraph is an overconstrained region.
10. Due to the limited number of edges (2n – 3) and the characteristics of the pebble game, only a simple table is needed to
store the pebbling status. Other data structures will be needed to support the graph search technique that you choose.
11. Your solution must take time, so no adjacency matrices.
12. Inputs lab5.a.dat and lab5.c.dat are minimally rigid. Inputs lab5.b.dat and lab5.d.dat are not.
13. The applet used during lecture may be downloaded from
http://ranger.uta.edu/~weems/NOTES3318/LAB/LAB5FALL21/pebblegame.jar
14. Aside . . . a beautiful book: https://www.amazon.com/dp/0521857570/
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5
0 1
3 2
4
5

Ο n
⎛ 2

⎜ ⎞