Trim leaves from the grpah when the number of endpoints exceeds some
threshold.