Question: #Creating Incidence matrix mat = [ ] r 1 = [ 1 , 1 , 1 , 0 , 0 ] r 2 = [
#Creating Incidence matrix matrrrrmatappendrmatappendrmatappendrmatappendrprintIncidence Matrix"for i in mat: printi#Functiondef funm: #list to hold current edge temp #list to hold all edges edges #looping through the matrix column for i in rangelenm: #current edge is empty now temp #looping through the matrix row for j in rangelenm: #In each column we have s and initial is #starting node and last node is ending node if mji: #incrementing by because index start from temp.appendj #adding current edge to edges edges.appendtemp #returning list of edges return edgese funmatprint
Edge Node listing representation"for i in e: printi
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
