Mining significant temporal networks is polynomial