use NodeIndex struct instead of passing both separately