added nested classes Edge and Node