# (Solved) : Using R Write Function Solve Maze Using Edge List Given File Create Function Converts Edge Q42756755 . . .

using R, write a function that will solve a maze. using an edgelist given in a file, create a function that converts the edge listto an adjacency list. Then using the adjacency list, solve themaze.

The maze in Figure 1 can be represented as the graph in Figure 2. Figure 2. The Graph Representing the Maze in Figure 1. This leads to the next question: How do we represent a graph in R? There are at least three ways to do this. First of all, a graph can be represented by an edge list. This is simply a list of edges. For the graph in Figure 2, the edge list would equal the 2-by-24 matrix in Figure 3. 1 2 2 3 2 7 3 4 4 5 6 7 7 8 7 8 9 9 11 13 14 15 16 17 17 18 18 19 19 20 21 12 13 10 14 12 14 15 20 21 18 22 19 23 20 24 25 22 Figure 3. Edge List for the Graph in Figure 2 Each column in represents an edge. Secondly, a graph can be represented by an adjacency matrix, which is a binary matrix containing a row and column for each vertex in V. The (jn entry and G.) entry of the adjacency matrix equals 1 if there is an edge between vertices i and and if not. For the graph in Figure 2. the adjacency matrix would equal the 25- by-25 matrix in Figure 4.
o 1 o o o o o o o o o 1 o o o o o o o o o o o 0 o o o o o o o o 0 o o o o o o o 0 o o o o o o o o o o 1 o o o o o o o o o o 0 0 1 0 0 0 o 0 o o o o o o o o o 0 o o o o o o o o 1 0 1 0 0 o 1 o o o o o o o o o 0 o o o o o o o o o o o o o o o o o 1 0 1 0 o 0 o o o o o o o o o 0 o o o o o o o o o 0 1 0 1 o 0 o o o o o o o o o o o o o o o o o o o o o o 0 o 1 o o 0 o o o o o o o o o o o o o o o o o o o o o o o o o o 1 o o o 1 o 0 o o o o 1 o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o 1 o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o 1 o o o o o o o o o o o o o o o o o 1 o o o o o o o o o o o o o o o o o o o o o 1 o o o o o o o o o o o o o o o o o o o o o 1 o o 1 o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o 1 o o o o o o o o o o o o o o 1 o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o 1 o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o 0 1 0 1 o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o 1 o o o o o o o 1 o o o o o o о 1 o o o o o o o o o o o Figure 3. The Adjacency Matrix Representation of the Graph in Figure 2 Finally, a graph can be represented by an adjacency list. For each vertex in the graph, we keep a list of vertices adjacent to it. Figure 4 contains the adjacency list for the graph in Figure 2. We will use the adjacency list representation for the mazes for this assignment.
Adjacency List Vertex Adiacent Vertices 137 DOU 26812 8 713 9 10 14 12 12 711 8 14 9 13 15 14 20 1722 17 19 23 99 22 2318 24 19 2520 Figure 4. The Adjacency List for the Graph in Figure 2. We will use R’s built-in list data structure to represent this adjacency list. For the maze in Figure 1, the adjacency list A5 (the “A” is for adjacency and the “5” is for the size of the puzzle) is 8 12 2 6 7 13 10 14 7 11 8 14 9 13 15 14 20
15 19 25 3622 17 21 That is, A5[1]) is equal to 2. A5[[2] is equal to the vector (1,3,7), etc. Your input to your function will be the adjacency list, and the output will be the path through the maze. To test your function on these examples, first download the associated text files from CANVAS Here are several examples. “Mayori 11 1 23 915 21 22 23 29 35 36 ma solver(” M ODEL 11 1 2 3 13 23 22 32 33 43 44 54 64 63 73 83 84 94 95 96 86 87 122 88 78 79 80 90 100 > “Mabudget Nepatheists through this man mare Marbodge 1 1 2 3 4 5 6 7 8 9 10 26 27 43 59 75 76 77 93 94 95 111 122 110 126 127 143 144 360 159 158 114 115 191 192208 224 24 29255256 ma solver(” M 32by2dgeList”) 111 1 2 3 4 5 69 68 100 12 164 196 197 229 261 293 125 1 357 356 388 420 452 484 516 517 549 581 582 583 551 552 54 636 135 60 212 245 246 247 745 70 71 72 73 74 752 753 721 722 723 152 724 725 757 58 60 61 729 6979870 4 95 296 254 25 297 298 830 831 863 864 896 928 960 992 3004 ma solver” Ma64b64dget 1 1 65 129 193 194 130 131 132 19 20 21 25 24 23 387 388 389 18453 537 58 582 46 710 774 775 711 712 645 S SS SS 650 734 735 716 737 653 25 26 2 8 33 271 272 273 112 525 531 467 468 469 53 54 5597 661 725 726 701549900 0821 922 858 59 60 61 797 733 734 670 671 672736 737 738 739 9 804 8 868 870 934 998 99 1063 062 061 1125 119 1253137 1388 1254 1255 1191 192 1125 10541000972 871 079 330 320 1101 619 620 621 028 559 95 96 97 97 9 7975 1742 33 34 949 013 1077 1075 SOT 111121201 1255 125 ESET GRESSZ HEZ SZCZoe T OSSEDE ZELTEST GOSSOS DER GES ITE N EET THE T ET LITE EVE TEBETE EESOLES HOSE SEOSES GOUE SE CENE SERGRO ENE SE LET OLE SOCCESESSE SISESEOSESSELSEMESSE 27140

Answer to using R, write a function that will solve a maze. using an edge list given in a file, create a function that converts th…

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.