void BuildPath(map<string, vs> &traces, vvs &pathes, vs &path, string word, string start){
    if(word == start){
        path.push_back(word);
        vs tmp = path;
        reverse(tmp.begin(), tmp.end());
        pathes.push_back(tmp);
        path.pop_back();
        return;
    }
    path.push_back(word);
    vs tmp = traces[word];
    for(int i = 0; i < tmp.size(); ++i)
        BuildPath(traces, pathes, path, tmp[i], start);
    path.pop_back();
}
Ejemplo n.º 2
0
/*
* Parses a string and stores data
* into a vector of vector of strings
*/
void parse(string& someString, vvs &attributeTable)
{
	int attributeCount = 0;
	vs vectorOfStrings;
	while (someString.length() != 0 && someString.find(',') != string::npos)
	{
		size_t pos;
		string singleAttribute;
		pos = someString.find_first_of(',');
		singleAttribute = someString.substr(0, pos);
		vectorOfStrings.push_back(singleAttribute);
		someString.erase(0, pos + 1);
	}
	vectorOfStrings.push_back(someString);
	attributeTable.push_back(vectorOfStrings);
	vectorOfStrings.clear();
}