data structures - grid representing as graph -


i thinking of grid , suppose in grid '#' represents way blocked , '.'(dot without quotes) represents there way.so if inside grid can walk inside when found way(.) e.g.,

####### ##a#### ##.#.## ##.#.## ##...## ####### 

for above example, found way , reaches other place below in picture:

####### ##.#### ##.#a## ##.#.## ##...## ####### 

if thinking problem graph how represent grid graph ? how represent adjacency list ? new graph stuided bfs only, please answer in easy words

each cell have edges 4 neighbouring cells. every cell appear in adjacency lists of 4 neighbouring cells.

actually don't need explicitly construct graph, can work on grid itself. represent specific node, can use coordinates of applicable cell , go neighbour, can increase / decrease x / y one.

i hope clear enough.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -