add a trn2grn function that works on any network type