update math set unit tests and fix discovered bugs
update labeled_graphs test and fix discovered bugs