Write a program to create a weighted graph. The user inputs how many vertices, how many edges, the starting and ending vertices, and weight of each edge, then print the adjacency matrix. For example, if the user wants to create such a graph, 1 3 The running process looks like this: >Enter the Number of Vertices: 4 Enter the Number of Edges: 4 Enter The Graph Egdes 1 24 1 3 1 1 43 245 The adjacency matrix for given graph is: 1 2 3 4 10 4 1 3 24 005 31 000 43500 Please note: in un-weighted graph, if the adjacency matrix is A, A[i][j]-1 means node i is connected to node j. A[i][j]-0 means node i is not connected to node j. In weighted graph, if the adjacency matrix is A, A[i][i]-k means node i is connected to node j and the weight of the edge
Write a program to create a weighted graph. The user inputs how many vertices, how many edges, the starting and ending vertices, and weight of each edge, then print the adjacency matrix. For example, if the user wants to create such a graph, 1 3 The running process looks like this: >Enter the Number of Vertices: 4 Enter the Number of Edges: 4 Enter The Graph Egdes 1 24 1 3 1 1 43 245 The adjacency matrix for given graph is: 1 2 3 4 10 4 1 3 24 005 31 000 43500 Please note: in un-weighted graph, if the adjacency matrix is A, A[i][j]-1 means node i is connected to node j. A[i][j]-0 means node i is not connected to node j. In weighted graph, if the adjacency matrix is A, A[i][i]-k means node i is connected to node j and the weight of the edge
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 23PE
Related questions
Question
100%
This is in java.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 4 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning