replaced non-working function addNode from class Graph