Base for building weighted X-Min algorithms
First attempts to make weighted algos.