networkx/networkx — pull request #925 by markusian (2013-08-08 21:48:57+00:00)
Title: Added tree recognition functionality

I have written a simple function to recognise if a certain graph is a tree or not. If the following is true, the input graph is considered a tree:
- The number of edges is equal to the number of nodes minus one
- It has no self-loops
- It is connected
- It is undirected (an object of the Graph class). Actually I'm not really sure that using the type function is a good approach. Also an exception could be raised if another type of graph is given as input.
In my implementation, an empty graph is considered a tree too.

This is my first attempt to collaborate on this project and also to an open source project in general, so let me know if I'm going in the right direction, if I need to modify something, what I'm doing wrong and so on. I have also tried to write a series of tests for the function.
If I'm going well I would like to add some other small functions, like a forest recognition. I know that these are really simple functions but I've encountered the need of them in a school project and I had to implement them myself, using a really stupid implementation at that time. So I think that this could be useful to someone else.
So, be kind with me and let me know what you think :)