请教如何实现图的数据结构C++# JobHunting - 待字闺中
c*z
1 楼
请问graph是不是大概这样用adjacent matrix 这样实现的。多谢了
class graph
{
public:
vector getAllnodes()
vector getadjacentnodes( node* start)
{
//parse the adjacentmatrix and return the adjacent nodes
}
private:
vector arrnodes;
vector> adjacentMatrix;
}
class node
{
bool bvisited;
int nodenumber;
}
void bfs(graph g, node* start, node* end)
{
auto arrNodes = g.getadjacentnodes(start) // 这样的到相领的点?
}
class graph
{
public:
vector
vector
{
//parse the adjacentmatrix and return the adjacent nodes
}
private:
vector
vector
}
class node
{
bool bvisited;
int nodenumber;
}
void bfs(graph g, node* start, node* end)
{
auto arrNodes = g.getadjacentnodes(start) // 这样的到相领的点?
}