Link between ecology and graph theory