add graph functions