Question: solve with mathlab that's all the question Write a function named CheckRegular IncMat that takes an incidence matrix representation of a graph (M) and checks

solve with mathlab that's all the question Write a function named CheckRegularIncMat that takes an incidence matrix representation of a graph (M) andsolve with mathlab checks if the graph is regular or not. If the graph is

that's all the question

Write a function named CheckRegular IncMat that takes an incidence matrix representation of a graph (M) and checks if the graph is regular or not. If the graph is regular, the function should return its degree (d), otherwise the function should return - 1. Note that loops are counted twice in vertex degree calculations. Examples: Input: Output: d=2 Case 1 M1=[1 1 ; 1 0 1 ; 1 1; 0 0 1 1] d=-1 Case 2 M2 = [1 0 1 0 0%; 1 1 0 0 1 ; 0 1 1 0 0 1; 0 0 0 1 0 1: 0 0 0 1 1 0] d=3 Case 3 M3=[1 1 1 0 0 0; 1 0 0 1 1 0; 0 1 0 1 0 1; 0 0 1 0 1 1] In your code, you MUST use adequate loop(s) and conditional(s), Note that M is defined as input to the function. Do not overwrite values in these variables in your code. Be sure to assign a value to the function output variable (d). > Is output assigned to "d" correct for incidence matrix M1? (Pretest) Is output assigned to "d" correct for incidence matrix M2? Is output assigned to "d" correct for incidence matrix M3? Does the function employs loop(s)? Does the function employs conditional(s)? Function C Reset MATLAB Documentation 1 function deCheckRegular IncMat (M) 2%Enter the commands for your function here. Code to call your function C Reset 1 M1=[1 1 ; 2 1 0 1 ; 3 0 1 0 1; 0 1 1]; 5 6 d-CheckRegular IncMat(M1) Run Function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!