Imported from https://github.com/networkdynamics/PolNeAR
