Polynomial Time Algorithm for Min-Ranks of Graphs with Simple Tree Structures