getSubnetwork modified, root is passed in as an argument