Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pos={{1,4},{1,8},{1,9},{2,2},{2,3},{2,4},{2,5},{2,6},{2,8},{2,9},{3,2},{3,6},{4,1},{4,2},{4,3},{4,4},{4,5},{4,6},{4,7},{4,8},{5,2},{5,7},{6,2},{6,5},{6,6},{6,7},{7,2},{7,5},{7,8},{8,2},{8,4},{8,5},{8,6},{8,7},{8,8},{8,9},{9,2}};
- m=SparseArray[pos->0,{9,9},1];
- ArrayPlot[m,Mesh->All]
- g = Graph[Range[81],
- UndirectedEdge @@@ {36 -> 35, 17 -> 26, 26 -> 35, 35 -> 44,
- 44 -> 53, 17 -> 16, 16 -> 15, 15 -> 14, 14 -> 13, 13 -> 12,
- 12 -> 11, 11 -> 10, 6 -> 15, 15 -> 24, 24 -> 33, 33 -> 42,
- 42 -> 51, 51 -> 60, 60 -> 59, 59 -> 58, 58 -> 49, 49 -> 40,
- 40 -> 39, 39 -> 38, 29 -> 38, 38 -> 47, 47 -> 56, 56 -> 65,
- 65 -> 74, 66 -> 65, 71 -> 72, 72 -> 81, 81 -> 80, 80 -> 71,
- 53 -> 52, 51 -> 52, 60 -> 69}, {
- VertexCoordinates -> Tuples[Range[9], 2]}, VertexLabels -> "Name"]
- FindPath[%, 36, 74, Infinity, All]
- HighlightGraph[g, PathGraph[#]] & /@ %
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement