update queue stack and add graph list