A method for routing packets in a multi-hop heterogeneous wireless network partitioned into a set of subnetworks including a first subnetwork having a first sink node in communication with a node and a second subnetwork having a second sink node in communication with the node, such that the node forms at least a part of the first subnetwork and forms at least a part of the second subnetwork, wherein the node is a routing node configured to route packets to the first sink node over the first subnetwork and configured to route packets to the second sink node over the second subnetwork, wherein steps of the method are performed using a processor of the node, comprising: determining an available routing resource of the node as a function of an allocated routing memory, ARM, in the node and a remaining expected routing lifetime, ERL, of the node, wherein the ARM is a portion of the memory of the node allocated to store routing packets and routing topology for running a routing protocol, and wherein the ERL is remaining time the node can route packets using remaining energy; determining (281-283) at least one required routing resource of the node as a function of a routing protocol used by the node for a subnetwork, a logical location of the node in the subnetwork, and a data traffic in the subnetwork through the node, wherein the determining the required routing resource includes determining a first required routing resource of the node for the first subnetwork and determining a second required routing resource of the node for the second subnetwork, wherein the first required routing resource differs from the second required routing resource, wherein different modes of operation, MOPs, dictate different required routing resources; determining , using the available routing resource and the first required routing resource, a first MOP specifying a type of routing of the node in the first subnetwork; determining , using the available routing resource and the second required routing resource, a second MOP specifying a type of routing of the node in the second subnetwork, wherein the first MOP differs from the second MOP; and routing packets in the first subnetwork according to the first MOP and routing packets in the second subnetwork according to the second MOP. determining an available routing resource of the node as a function of an allocated routing memory, ARM, in the node and a remaining expected routing lifetime, ERL, of the node, wherein the ARM is a portion of the memory of the node allocated to store routing packets and routing topology for running a routing protocol, and wherein the ERL is remaining time the node can route packets using remaining energy; determining (281-283) at least one required routing resource of the node as a function of a routing protocol used by the node for a subnetwork, a logical location of the node in the subnetwork, and a data traffic in the subnetwork through the node, wherein the determining the required routing resource includes determining a first required routing resource of the node for the first subnetwork and determining a second required routing resource of the node for the second subnetwork, wherein the first required routing resource differs from the second required routing resource, wherein different modes of operation, MOPs, dictate different required routing resources; determining , using the available routing resource and the first required routing resource, a first MOP specifying a type of routing of the node in the first subnetwork; determining , using the available routing resource and the second required routing resource, a second MOP specifying a type of routing of the node in the second subnetwork, wherein the first MOP differs from the second MOP; and routing packets in the first subnetwork according to the first MOP and routing packets in the second subnetwork according to the second MOP. <EOS>