1. A non-transitory machine readable medium having instructions stored thereon configured to be executed by a processor of a subnet manager in a network environment including a plurality of compute nodes interconnected via a plurality of switches and links, wherein execution of the instructions enables the subnet manager, when the subnet manager is linked in communication with a switch in the network environment, to: receive notifications from compute nodes indicating they are joining a collective group; determine a spanning tree to be used for the collective group comprising a plurality of nodes including the compute nodes providing notifications indicating they are joining the collective group and a set of switches including edge switches connected to the compute nodes and one or more levels of core switches including a core switch at the root of the spanning tree, wherein the spanning tree is configured such that each node in the spanning tree is enabled to communicate with each of the other nodes via a single respective specified route comprising at least one link segment; and provide configuration information to each of the switches in the spanning tree for implementing message forwarding operations for the portion of the spanning tree that includes links coupled to that switch.