How to construct an adj-list/adj-matrix from a txt file in c++

The input file like this (0 12 36.93222330340848) (2 8 785.7766177831124) I want to construct a weighted graph, and implement Dijkstra's Algorithm to find the shortest path from the given vertex to other vertexes. Your help would be appreciated. Sincerely, A new-comer to c++
1
2
3
4
5
6
7
8
9
10
nih::graph g(n);
while(input >> start >> end >> weight){
   g.add_directed_edge(start, end, weight);
}


void nih::graph::add_directed_edge(int start, int end, double weight){
   this->m[start][end] = weight; //adj-matrix
   this->vertex[start].push({end, weight}); //adj-list
}
Thanks for your kindly help
Topic archived. No new replies allowed.