This paper presents a concept of q-optimal partition of a tree by using the concept of set partition.An exact algorithm and a heuristic algorithm for finding the q-optimal partition of a tree are developed respectively.A practical example of planning an electrical distribution network is given.