我有一个5811顶点的图形;只在运行时知道,因此可能是任何但通常小于6000.初始化顶点需要35毫秒的大量时间 . 我想知道是否有人建议如何提高顶点分配速度?我已经浏览了一些其他线程,但似乎没有明确的解决方案 .

编辑:由于每个顶点中存在的变量数量,需要35毫秒

//find amount of vertices required
//...   

//35ms
//initialize vertices
for (int i = 0; i < max + 1; i++)   boost::add_vertex(i, g);

//10ms
//fill up adjacency list and accumulate vertex information
for (int row = 0; row < label.rows; row++)  
    for (int col = 0; col < label.cols; col++)
    {
         //process data
    }