convert topological sort stats to a struct with methods