Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THIS IS GNU OCTAVE QUESTION: 1. Write a function that takes an incidence matrix representation of a graph as a matrix and returns its adjacency

THIS IS GNU OCTAVE QUESTION:

image text in transcribed

1. Write a function that takes an incidence matrix representation of a graph as a matrix and returns its adjacency list representation as a cell array. Hints: Be careful. The graph may have loops and parallel edges. Write your code so that it will be able to handle them as well. The ordering of neighbors of a node in the corresponding adjacency list is not important. They can be written in any order. For example, adjacency list of node 1 could be written as (4,5,2,5) or (5,5,4,2), etc. in the example below. So you can create these lists in any order that you wish. Example: Input matrix: 1 0 0 0 1 0 0 1 0 1 0 0 001 0 0 0 0 000 1 1 0 010 0 0 0 0 0 1 110 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 1 0 0 1 Output: {[2,4,5,5),[1,2,3,4),(2,4),(1,3,5,2),(4,5,1,1],[]} ALSO TEST YOUR FUNCTION WITH THE "Input matrix" (the result should be the "Output" above as described) and for each test, take a screenshot of your OCTAVE, MATLAB or OCTAVE ONLINE screen and include it in your answer. NO SCREENSHOT = 0 marks for this

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

How would you describe your typical day at work?

Answered: 1 week ago