I need to write a function to compute the diameter of a graph given an array of edges, ie:

1, 2
1, 4
2, 3
3, 4

Any ideas on how to go about doing this?