in C++
Design a format for storing graphs in files. This will storeyour graph into a file with the following requirements:
- The first line will contain the number of Vertices.
- The second line will have a āUā or a āDā to tell the system ifit is Undirected or Directed.
- The rest of the lines will be here for each of the edges. Eachedge will contain three pieces of information:
- An integer containing the first Vertex
- An integer containing the second Vertex
- An integer containing the weight
You will need to write two functions for your graph, read andwrite.
- bool read(string filename);
- bool write(string filename);
The file must be human readable (use
OR
OR