Tree-partite graphs and the complexity of algorithms