use a simple algorithm to generate branches