implementation of the graph package functions. Missing the constraints