0

这是我的构造函数,我想问一下,这是否等同于 web graph 的整体外观?我只是在制作一个二维数组,其中(我认为)所有的 indecies 都是顶点,一个顶点连接 2 个或多个其他顶点(indecies)。我对么?

Graph:: Graph (int numVertices) {

    this -> numVertices = numVertices;

    //memory alocated for elements of rows.                                 
    adjMatrix = new double*[numVertices];

    //memory allocated for elements of each column
    for(int i =0; i < numVertices; i++)
        adjMatrix[i] = new double[numVertices];
    for(int i =0; i < numVertices; i++)
        for (int j=0; j< numVertices; j++)
            adjMatrix[i][j] = INFINITY;
}
4

0 回答 0