hypernodes: algorithm wrapped into function