C Design Format Storing Graphs Files Store Graph File Following Requirements First Line Co Q37135870

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

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.