maximal weighted independent sets in Javascript