Small and simple algorithm that moves through a graph and find the leaves and articulation points