A method, comprising: receiving a packet at a network device of a plurality of network devices in a fully connected multidimensional network, wherein the packet is to be routed to a destination network device and wherein the fully connected multidimensional network comprises at least a first dimension and a second dimension, wherein the first dimension is a first set of network devices that are connected such that there is at least one path between every distinct pair of network devices in the first set of network devices; and the second dimension is a second set of network devices that are connected such that there is at least one path between every distinct pair of network devices in the second set of network devices; determining, by a routing engine of the network device, all possible candidate output ports for the packet to be routed to the destination network device in a dimensional order, the candidate output ports corresponding to candidate minimal paths and candidate non-minimal paths between the network device and the destination network device; selecting, by the routing engine, an optimal output port among all the candidate output ports, by calculating a weight for each candidate path, the weight being based on a combination of a number of hops of the candidate path and a congestion along the candidate path and being the product between the number of hops of the candidate path and the congestion along the candidate path; and associating the weight to the corresponding candidate output port; and routing, by the routing engine, the packet to a next hop of the network through the optimal output port using a first resource class when the optimal output port corresponds to a candidate minimal path and a second resource class when the optimal output port corresponds to a candidate non-minimal path, wherein the first resource class is a first virtual channel, VC, or a first packet buffer, and wherein the second resource class is a second VC or a second packet buffer. receiving a packet at a network device of a plurality of network devices in a fully connected multidimensional network, wherein the packet is to be routed to a destination network device and wherein the fully connected multidimensional network comprises at least a first dimension and a second dimension, wherein the first dimension is a first set of network devices that are connected such that there is at least one path between every distinct pair of network devices in the first set of network devices; and the second dimension is a second set of network devices that are connected such that there is at least one path between every distinct pair of network devices in the second set of network devices; the first dimension is a first set of network devices that are connected such that there is at least one path between every distinct pair of network devices in the first set of network devices; and the second dimension is a second set of network devices that are connected such that there is at least one path between every distinct pair of network devices in the second set of network devices; determining, by a routing engine of the network device, all possible candidate output ports for the packet to be routed to the destination network device in a dimensional order, the candidate output ports corresponding to candidate minimal paths and candidate non-minimal paths between the network device and the destination network device; selecting, by the routing engine, an optimal output port among all the candidate output ports, by calculating a weight for each candidate path, the weight being based on a combination of a number of hops of the candidate path and a congestion along the candidate path and being the product between the number of hops of the candidate path and the congestion along the candidate path; and associating the weight to the corresponding candidate output port; and routing, by the routing engine, the packet to a next hop of the network through the optimal output port using a first resource class when the optimal output port corresponds to a candidate minimal path and a second resource class when the optimal output port corresponds to a candidate non-minimal path, wherein the first resource class is a first virtual channel, VC, or a first packet buffer, and wherein the second resource class is a second VC or a second packet buffer.