Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

In Computer Science a Graph is represented using an adjacency matrix. Is
matrix is a square matrix whose dimension is the total number of vertices.
The following example shows the graphical representation of a graph with 5 vertices, its matrix
of adjacency, degree of entry and exit of each vertex, that is, the total number of
arrows that enter or leave each vertex (verify in the image) and the loops of the graph, that is
say the vertices that connect with themselves
To program it, use Object Oriented Programming concepts (Classes, objects, attributes, methods), it can be in Java or in Python.
-Declare a constant V with value 5
-Declare a variable called Graph that is a VxV matrix of integers
-Define a MENU procedure with the following text
GRAPHS
1. Create Graph
2.Show Graph
3. Adjacency between pairs
4.Input degree
5.Output degree
6.Loops
0.exit
-Validate MENU so that it receives only valid options (from 0 to 6), otherwise send an error message and repeat the reading
-Make the MENU call in the main program
-Define a CREATE procedure/function to fill an array with random values between 0 and 1. Where 0 represents no
adjacency and 1 indicates that there is.
-Make the CREATE call in the main program, receive as
parameter the Graph matrix created in point 2
-Define a SHOW procedure/function to print an adjacency matrix, in matrix form
-Make the SHOW call in the main program, receive as
parameter the Graph matrix created in point 2
- Define an ADJACENCY procedure/function that receives, apart from the array, two integer values and returns a value of true if there is a 1 in those positions of the array and False otherwise.
-Make the ADYACENCY call in the main program. To do this, ask and validate (between 1 and V) two vertices of the graph. Indicate if these two vertices are adjacent in the graph. That is, if ADYACENCY returns 1, write “Adjacency”, if they are not, say “Not adjacency”. Remember that the user is going to give values between 1 and V and that the matrix has values from 0 to V-1
  -For the Output degree option, use the function/procedure that
add rows and do it with each of the rows. Remember that the user will see vertices between 1 and V and that the matrix has values from 0 to V-1
- The MENU keeps repeating until the user presses 0 (exit)

5
0 1 1 0 0
01000
1010 0
0
000
1
0 0 1 1
0
Input Grade
1-1
2-2
3-3
Output grade
1-2
4-2
5-0
Loops (2,2) (3,3) (4,4)
21
3-2
4-1
5-2
expand button
Transcribed Image Text:5 0 1 1 0 0 01000 1010 0 0 000 1 0 0 1 1 0 Input Grade 1-1 2-2 3-3 Output grade 1-2 4-2 5-0 Loops (2,2) (3,3) (4,4) 21 3-2 4-1 5-2
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education