added general graph object builder to handle graph algorithms