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

Suppose I have to find the maximum distance between two dots(.), here there is no source and destination, how to do that ?

```
#######
#.#.###
#.#.###
#.#.#.#
#.....#
#######
```