Answered step by step
Verified Expert Solution
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:
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 thisStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started