# Graph Algorithms

### Graph problems

#### Find neighbour in array

Find all the neighbours of a given element in array

Neighbours can be defined as

1. Neighbours are only vertical and horizontal elements next to given element
2. Neighbours are only vertical, horizontal and diagonal elements next to given element
3. Neighbours are all vertical, horizontal and diagonal elements next to given element

#### Find all the ascending paths in graph

Given array as

Find all the paths from 1 to 3. The possible ascending path are

1 ->6->8->9-> 3

1 ->4->7->9->3

1 ->6->7->2->3 is not the right solution as 7 > 2