Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in C++ Instructions Reuse the graph implemented in assignment 2 and extend it for all directional, un-directional, and weighted graphs. Modify the structures used in

image text in transcribed

in C++

Instructions Reuse the graph implemented in assignment 2 and extend it for all directional, un-directional, and weighted graphs. Modify the structures used in assignment 2 as per your requirements. You are to implement the following features 1. The program should ask user for an input file containing the description of a graph. For example: The input text file should have a following form. 1,3 1,4 2,4 3,4 4,1 5,2 . . . This text file represents a graph G = (VE) Set of vertices V ={1,2,3,4,5) Set of edges{(1, 3),(1,4),(2,4),(3,4),(4,1),(5,2)}, 2. Implement a function "is_undirected" Input: a graph object (G1) Output: true if undirected, false if not. Description: Check if the graph object is undirected, this is true if all directed edges have a complementary directed edge with the same weight in the opposite direction. 3. Implement a function "is_isomorphic" Input: G1, a graph object; G2, a graph object. Output: true if G1 and G2 are isomorphic, false if not. Description: Check if the graph objects are isomorphic, meaning all vertices, edges, and weights are identical. For example: Two graphs G1 and G2 are said to be isomorphic if i. Their number of components (vertices and edges) are same. ii. Their edge connectivity is retained. 4. Implement a function "is_connected" Input: G, a graph object; V1, a vertex label in G; V2, a vertex label in G. Output: true if there is a path from v1 to v2 in g, false if not. Description: Determine if there is any path between vertex v1 and vertex v2 in graph g. If v1 or v2 are not in g then throw an error. 5. Implement a function "Find_path" Input: G, graph object; V1, a vertex label in G; V2, a vertex label in G. Output: names of vertices that make up the path, in sequence. Description: Find a path from vertex v1 to vertex v2 using the edges of graph g

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

0619064625, 978-0619064624

More Books

Students also viewed these Databases questions

Question

7. What decisions would you make as the city manager?

Answered: 1 week ago