added database function for returning all endpoints in tree graph