Write algorithm

User Generated

ivpgbevnfz

Computer Science

Description

There are total four questions in the document "h4c". These question are about how to apply algorithms to graph. For example, to write an algorithm to check if a graph can be represented as an adjacency or incidence matrix. you need to know about what is adjacency matrix and incidence matrix in graph. Also you need to know some programming language. Because some of the question in the document will ask you to write a program to implement the algorithm you wrote. After that you will also need to give me the input and output you used to test your program. 😀

Unformatted Attachment Preview

CSC420: Algorithms & Data Structures Homework #4 (10 Points) Graph Algorithm and Program Fall 2018 Due: Sunday, Nov. 11, 2018 Dr. M. Owrang One way to represent a graph is by its incidence matrix, INC. There is one row for each vertex and one column for each edge. Then INC(i, j) = 1 if edge j is incident to vertex i. An example of a graph and its incidence matrix representation is given below. V1 3 V4 ` 1 4 6 5 V2 2 V3 Edges 1 2 3 4 5 6 Verices ------------------------------------------------------------- 1 1 0 1 0 0 1 2 1 1 0 1 0 0 3 0 1 0 0 1 1 4 0 0 1 1 1 0 Incidence matrix A) Write an algorithm for Breadth-First Search that works on a graph represented by its incidence matrix. B) What are the advantages/disadvantages of using an incidence matrix as opposed to an adjacency matrix in representing a graph? Explain your answer, with example. 2. A directed graph with n vertices is called YUCCA if there is a vertex with indegree 0 and outdegree n-1. For example, the following is a YUCCA because node A has indegree 0 and outdegree n-1. B F A C E D A) Write an algorithm to test whether a graph represented as an adjacency matrix is a YUCCA. Your algorithm must examine only O (n) entries of the adjacency matrix. Justify the correctness and time complexity of your algorithm. B) Write a program to implement your algorithm in Part A. Test your program with different graphs to show that your graph is YUCCA and cases when it is not a YUCCA. Provide your program, input graphs, outputs.
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Okay, here is the file, spell corrected and I hope it helps!remember, I can still help you specially, if you can not load the program... just extend time and tell me!

Incidence Matrix and Adjacent Matrix.

To Solve this problem first we must differentiate well Incidence and Adjacent Matrix.
Incidence Matrix
- With this graph, we can only know if one node is connecting others through their edges.
It clearly says it in the description what incidence matrix is.
We can see in the graph there are Vertices (the circles) and Edges (the lines connecting to other
vertices).
Incidence Matrix shows only the relationship of Vertices and Edges, where there is a 1 if there is
a connection between them and 0 if there is not.

Adjacent Matrix

- With this graph, we can only know if certain nodes are connected with others or not.
The difference is that among Vertices and Edges, this matrix will not show any relationship with
edges, instead of with other Vertices. If there are other Vertices next to it, we will graph a 1 and
if there are other Vertices we place...


Anonymous
Just what I needed. Studypool is a lifesaver!

Studypool
4.7
Indeed
4.5
Sitejabber
4.4

Similar Content

Related Tags