これにはたくさんの重複があることは知っていますが、どの回答も役に立たないようです。
class Vertex
{
public:
string name; // Vertex name
vector<Vertex *> adj; // Adjacent vertices
int dist; // Cost
Vertex *path; // Previous vertex on shortest path
bool visited;
Vertex( const string & nm ) : name( nm )
{ reset( ); }
void reset( )
{ dist = INFINITY; path = NULL; }
};
void Graph::explore(Vertex *v)
{
//error for v.visited
//error for anything where 'v' is referenced.
v.visited = true;
int total;
for(int i = 0; i < v.adj.size(); i++)
{
cout << v.adj.name << " to ";
if (!v.visited)
{
explore(v.adj[i]);
}
}
}
他の投稿を読んでもエラーの原因を特定できません。(私はc ++が初めてです)。他の誰かが何かを見ることができますか?エラーは他のメソッド内にもあります。