I am wanting to read a file of the following: Where lines starting with c stand for comments, p stands for graph information (no of nodes, no of edges) and e stands for edges.
c //Comments
c //Comments
c //Comments
p edge 50 654
e 4 1
e 5 3
e 5 4
e 6 2
e 6 3
... // 654 edges
My idea of how this would work is:
- read line by line until the first index of a line
== 'p'; - initialize my matrix to size of nodes, which would be 50 here.
- read
amount_of_edges-number of lines, saving them into my data structure (which would be 654 lines in the example).
I know how I could do this simply in Python, however I just don't know where to get started with c++.