adding more functionality to hypergraph and optimization