Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

Grid representation as a graph

$
0
0

I am thinking of a grid and suppose in the grid '#' represents that the way is blocked and '.'(dot without quotes) represents there is a way.So if A is inside the grid then he can walk inside when he found way(.) e.g.,

#######
##A####
##.#.##
##.#.##
##...##
#######

for the above example, A found the way and he reaches to other place like this below in picture:

#######
##.####
##.#A##
##.#.##
##...##
#######

If I am thinking this problem as a graph then How I will represent this grid as a graph ? How to represent this as an adjacency list ? I am new to graph just stuided BFS only, please answer in easy words


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>