void init(){ string line; getline(cin, line); Vertex::init(atoi(line.c_str())); while(getline(cin, line)){ if(line.find("->") != string::npos){ size_t found = line.find("->"); Vertex *current = Vertex::getVertexWithId(atoi(line.substr(0, found).c_str())); line = line.substr(found + 2); vector<string> neighbors = split(line, ','); for(int i = 0; i < (int)neighbors.size(); i++){ int id = atoi(neighbors.at(i).c_str()); current->addNeighbor(Vertex::getVertexWithId(id)); } } } }