2. Understanddefault_graphtheory_linearalg_svgEasyD1 function process%QUESTION.NUMBER%(QNo) { if ( document.forms.name != "FEEDBACK" ) { QT = QuestionText%QUESTION.NUMBER% QT1 = QuestionText1%QUESTION.NUMBER% SVGG = ""; ET = EquationText%QUESTION.NUMBER% COR = Correct%QUESTION.NUMBER% //alert(SVG_plot%QUESTION.NUMBER%) Nwidth=getFontSize()/16*310 Nheight=getFontSize()/16*80 a1="" Nwidth=getFontSize()/16*30 Nheight=getFontSize()/16*80 ANS= "

SOLUTION
This question is asking to find a spanning tree for the given adjacency matrix. A spanning tree is a subset of a graph that is connected to all vertices and has no cycles. In upper level mathematics, it can be seen how spanning trees are useful for determining shortest paths between two communities, least expensive methods for organizing a business, and much more.

For the four adjacency matrices from which to choose, first look at them to see that they are connecting all vertices and that they have no cycles (This ensures it is a spanning tree.). Second, take each candidate, even if you only have one, to see that all of the edges correspond to edges in the given adjacency matrix. If even one edge is not correct, then that candidate must be removed. If all of the edges correspond to edges in the given adjacency matrix, then you have the correct solution.

"; if(Correct%QUESTION.NUMBER% == "None of these!"){ SHOW="
From looking at these graphs and searching for these properties, you should see that the correct answer is "+COR+". However, a possible correct solution would look like this.

"+SVG_graph%QUESTION.NUMBER%+"
"; }else{ SHOW="
From looking at these graphs and searching for these properties, you should see that the correct answer is "+COR+"
which looks like
"+SVG_graph%QUESTION.NUMBER% + "

"; } for ( var i=5; iNone of these!" ) {document.forms.elements[item+3].value = "Your answer "+document.forms.elements[item].value+ " was correct. A possible answer could be
which looks like
"+SVG_graph%QUESTION.NUMBER% + "
"+document.forms.elements[item].value+"
was correct.
"} } else { if (document.forms.elements[item].value==Distractor1%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
is incorrect. "+ANS+".

"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor2%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
is wrong. "+ANS+".

"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor3%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
was incorrect. "+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor4%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
was wrong. "+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value=="None of these!") {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
is not the right answer. "+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value=="I don't know!") {document.forms.elements[item+3].value= " You did not know!
"+ANS+"
"+SHOW+"
" } } } } } } } } } } document.forms.elements[item+3].value = QT + ET + QT1 + document.forms.elements[item+3].value + SVGG; } Choice%QUESTION.NUMBER% = new Array(4) function question%QUESTION.NUMBER%() { labels = new Array(); n = displayarray(1, 6, 9, 0)-0; pick = Math.round((Math.random()*(n-2))+1); first = Math.round(Math.random()*(n/3)+1); last = Math.round(Math.random()*(n/3) + first + 1); heshe = ""; person = ""; sexflip = Math.round(Math.random()); random = Math.round(Math.random()*100); if(sexflip == 0){ person += malename(random); heshe += "he"; }else{ person += femalename(random); heshe += "she"; } traveltoss = displayarray(1,0,3,1); traveltossword = new Array("ferry","bus","train","plane"); A = getrandommatrix(n, n, 0, 0, 1); mix = displayarray(n,1,n,0); for(i = 1; i <= n-1; i++){ select = (displayarray(1,1,i,0))-0; A[mix[select-1]][mix[i]] = (A[mix[select-1]][mix[i]]-0)+1; } for(i = 1; i <= n; i++){ labels[i]=alphabet(i-1,1); for(j = 1; j <= n; j++){ A[i][j] = Math.max(A[i][j]-0,A[j][i]-0); } } B = getrandommatrix(n, n, 0, 0, 1); for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ B[i][j] = Math.round(Math.random()*Math.sin(Math.PI/4)); } } //DISTRACTOR D1: Edge added to give a cycle. D1 = getrandommatrix(n,n,0,0,1); mix1 = displayarray(n,1,n,0); cycle_length = Math.round(Math.random()*(n-4))+3; for(i = 1; i <= cycle_length-1; i++){ D1[mix1[i-1]][mix1[i]] = (D1[mix1[i-1]][mix1[i]]-0)+1; } D1[mix1][mix1[cycle_length-1]] = (D1[mix1][mix1[cycle_length-1]]-0)+1; for(i = cycle_length-1; i <= n-1; i++){ select1 = (displayarray(1,1,i,0))-0; D1[mix1[select1-1]][mix1[i]] = (D1[mix1[select1-1]][mix1[i]]-0)+1; } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D1[i][j] = Math.max(D1[i][j]-0,D1[j][i]-0); } } for(i = 1; i <= n; i++){ D1[i][i] = (D1[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D1[i][j] > 1){ D1[i][j] = ((D1[i][j]-0)*0)+1; } } } //DISTRACTOR D2: Edge removed from one vertex to destroy spanning tree. D2 = getrandommatrix(n,n,0,0,1); mix2 = new Array(); cointoss = Math.round(Math.random()); if(cointoss == 0){ for(i = 0; i <= n-1; i++){ mix2[i] = mix[i]; } }else{ for(i = 0; i <= n-1; i++){ mix2[i] = mix1[i]; } } //First half of list is scrambled to create semi-new list. changing_point = Math.round(n/2); sublist = new Array(); for(i = 0; i <= changing_point - 1; i++){ sublist[i] = mix2[i]-0; } confusion = displayarray(changing_point,0,changing_point-1,1); for(i = 0; i <= changing_point - 1; i++){ mix2[i] = sublist[confusion[i]-0]; } //___ for(i = 1; i <= n-2; i++){ select2 = (displayarray(1,1,i,0))-0; D2[mix2[select2-1]][mix2[i]] = (D2[mix2[select2-1]][mix2[i]]-0)+1; } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D2[i][j] = Math.max(D2[i][j]-0,D2[j][i]-0); } } for(i = 1; i <= n; i++){ D2[i][i] = (D2[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D2[i][j] > 1){ D2[i][j] = ((D2[i][j]-0)*0)+1; } } } //DISTRACTOR D3: 1 edge in spanning tree is not in graph D3 = getrandommatrix(n,n,0,0,1); pick_a_list = Math.round(Math.random()*2); mix3 = new Array(); if(pick_a_list == 0){ for(i = 0; i <= n-1; i++){ mix3[i] = mix[i]; } }else if(pick_a_list == 1){ for(i = 0; i <= n-1; i++){ mix3[i] = mix1[i]; } }else if(pick_a_list == 2){ for(i = 0; i <= n-1; i++){ mix3[i] = mix2[i]; } } for(i = 1; i <= n-1; i++){ select3 = (displayarray(1,1,i,0))-0; D3[mix3[select3-1]][mix3[i]] = (D3[mix3[select3-1]][mix3[i]]-0)+1; } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D3[i][j] = Math.max(D3[i][j]-0,D3[j][i]-0); } } //Finished below Correct Matrix C. //DISTRACTOR D4: Spanning tree cut into 2 smaller trees, thus no longer spanning the graph. D4 = getrandommatrix(n,n,0,0,1); pick_a_new_list = Math.round(Math.random()*2); mix4 = new Array(); if(pick_a_new_list == 0){ for(i = 0; i <= n-1; i++){ mix4[i] = mix[i]; } }else if(pick_a_new_list == 1){ for(i = 0; i <= n-1; i++){ mix4[i] = mix1[i]; } }else if(pick_a_new_list == 2){ for(i = 0; i <= n-1; i++){ mix4[i] = mix2[i]; } } cut = Math.round(n/2); for(i = 1; i <= cut-2; i++){ select4 = (displayarray(1,1,i,0))-0; D4[mix4[select4-1]][mix4[i]] = (D4[mix4[select4-1]][mix4[i]]-0)+1; } for(i = cut; i <= n-1; i++){ select5 = (displayarray(1,cut,i,0))-0; D4[mix4[select5-1]][mix4[i]] = (D4[mix4[select5-1]][mix4[i]]-0)+1; } calculate = new Array(); for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ if(D4[i][j] > 0){ calculate[i] += 1; } } if(calculate[i] == 0){ new_j = displayarray(2,1,n,0); if(new_j == i){ D4[i][new_j] = ((D4[i][new_j]-0)*0)+1; }else{ D4[i][new_j] = ((D4[i][new_j]-0)*0)+1; } } } for(i = 1; i <= n; i++){ D4[i][i] = (D4[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D4[i][j] > 1){ D4[i][j] = ((D4[i][j]-0)*0)+1; } } } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D4[i][j] = Math.max(D4[i][j]-0,D4[j][i]-0); } } //Combined matrix C. C = getrandommatrix(n,n,0,0,1); for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ C[i][j] = (A[i][j]-0)+(D1[i][j]-0)+(D2[i][j]-0)+(D3[i][j]-0)+(D4[i][j]-0); if(C[i][j] > 1){ C[i][j] = (C[i][j]*0)+1; } } C[i][i] = (C[i][i]*0); } //Remainder of D3. switch_to_x = 0; switch_to_y = 0; switch_from_x = 0; switch_from_y = 0; for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ for(k = 1; k <= n; k++){ if(C[i][j] == 0 && D3[i][j] == 0 && i !== j && D3[i][k] == 1){ switch_to_x = (switch_to_x*0)+i; switch_to_y = (switch_to_y*0)+j; switch_from_x = (switch_from_x*0)+i; switch_from_y = (switch_from_y*0)+k; } } } } D3[switch_from_x][switch_from_y] = (D3[switch_from_x][switch_from_y]-0)*0; D3[switch_to_x][switch_to_y] = ((D3[switch_to_x][switch_to_y]-0)*0)+1; D3[switch_from_y][switch_from_x] = (D3[switch_from_y][switch_from_x]-0)*0; D3[switch_to_y][switch_to_x] = ((D3[switch_to_y][switch_to_x]-0)*0)+1; for(i = 1; i <= n; i++){ D3[i][i] = (D3[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D3[i][j] > 1){ D3[i][j] = ((D3[i][j]-0)*0)+1; } } } //___ toss = Math.round(Math.random()); toss = 0; // if toss = 0, then the matrices below are symmetric for (i = 1; i <= n; i++){ labels[i]=alphabet(i-1,1); for(j = 1; j <= n; j++){ if(toss == 0){ A[i][j] = A[j][i]; D1[i][j] = D1[j][i]; D4[i][j] = D4[j][i]; D2[i][j] = D2[j][i]; D3[i][j] = D3[j][i]; } } } tell_me_a_story = Math.round(Math.random()*3); if(tell_me_a_story == 0){ QuestionText%QUESTION.NUMBER% = "
A large corporate business is divided into "+n+" departments. However, in order to be successful, proper management and cooperation of the departments is required. The graph below shows all of the connections between departments, "+alphabet(0,1)+" to "+alphabet(n-1,1)+".

"; QuestionText1%QUESTION.NUMBER% = "
In business, cooperation is important and thus, departments will rely on each other for adequate service and help when needed. The C.E.O. of the company wants to show this to all employees at an upcoming business meeting by removing connections between companies that are either unnecessary or that create cycles between a subset of the departments, which could allow for disorganization within the company. Doing this could possibly save the company millions.

Which of the adjacency matrices below best represents such a graph?

"; }else if(tell_me_a_story == 1){ QuestionText%QUESTION.NUMBER% = "

" QuestionText1%QUESTION.NUMBER% = "
Which of the adjacency matrices below is a spanning tree for the graph above?

"; }else if(tell_me_a_story == 2){ QuestionText%QUESTION.NUMBER% = "
In a study at "+randomname(university)+", "+n+" university student services are being compared and similarities between pairs of services are noted by creating edges and displaying them in the following graph.

"; QuestionText1%QUESTION.NUMBER% = "
The organizer of this activity wants to show that all services can be connected by a spanning tree. Which, if any, of the following adjacency matrices represents this?

"; }else if(tell_me_a_story == 3){ QuestionText%QUESTION.NUMBER% = "
"+n+" towns located in "+randomname(commonwealth)+" are connected through major roads, represented as edges in the graph below.

"; QuestionText1%QUESTION.NUMBER% = "
Which adjacency matrix below illustrates a possible tree (i.e. no cycles) between all "+n+" towns?

"; } Nwidth1 = getFontSize()/16*(n * 45) ; //Nwidth2 = getFontSize()/16*(n * 35) ; Nheight = getFontSize()/16*(n * 50) ; m1="" m2="" m3="" // n+1,n+1 in displayincidencematrix(A,labels,n+1,n+1) means no highlighting c1 = "" c2 = "

" d1 = "" d2 = "" d3 = "" d4 = "" ratio_along_line = 0; // places arrow on line: if 0 then no arrow is drawn. ratio_along_line1 = 0.2; // ratio_along_line = 0; filled = 1; // = 1 filled arrow else open double_path_colour = "black"; // double_path_colour = getFgColor(); double_path_skinnyness = 10; fx = getFontSize()/16; size1 = fx*400; size2 = fx*400; size3 = fx*(100*fx*fx+420*fx+185); size4 = fx*(100*fx*fx+420*fx+185); svg_start = ''; SVG_graph%QUESTION.NUMBER% = SVG_digraph(A,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph1%QUESTION.NUMBER% = SVG_digraph(D1,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph2%QUESTION.NUMBER% = SVG_digraph(D2,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph3%QUESTION.NUMBER% = SVG_digraph(D3,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph4%QUESTION.NUMBER% = SVG_digraph(D4,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph5%QUESTION.NUMBER% = SVG_digraph(C,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start); Correct%QUESTION.NUMBER% = m1+m2+m3+c1+"
"; EquationText%QUESTION.NUMBER% = SVG_graph5%QUESTION.NUMBER%; Distractor1%QUESTION.NUMBER% = m1+m2+m3+d1+"
"; Distractor2%QUESTION.NUMBER% = m1+m2+m3+d2+"
"; Distractor3%QUESTION.NUMBER% = m1+m2+m3+d3+"
"; Distractor4%QUESTION.NUMBER% = m1+m2+m3+d4+"
"; randomisation = displayarray(3,1,3,0); randomisation2 = displayarray(4,0,3,1); WhichDistractor = new Array(4); WhichDistractor = Distractor1%QUESTION.NUMBER% WhichDistractor = Distractor2%QUESTION.NUMBER% WhichDistractor = Distractor3%QUESTION.NUMBER% WhichDistractor = Distractor4%QUESTION.NUMBER% NOT = Math.ceil(4*Math.random()); xxx = Math.ceil(4*Math.random()); if ( NOT==1 ) { Answer%QUESTION.NUMBER% = Correct%QUESTION.NUMBER% Correct%QUESTION.NUMBER% = "None of these!" Choice%QUESTION.NUMBER%[xxx] = WhichDistractor[randomisation2]; } else { Choice%QUESTION.NUMBER%[xxx] = Correct%QUESTION.NUMBER% } Choice%QUESTION.NUMBER%[xxx+randomisation] = WhichDistractor[randomisation2]; Choice%QUESTION.NUMBER%[xxx+randomisation] = WhichDistractor[randomisation2]; Choice%QUESTION.NUMBER%[xxx+randomisation] = WhichDistractor[randomisation2]; for ( var yyy=xxx; yyy<=xxx+3; yyy++ ) { if ( yyy>4 ) { Choice%QUESTION.NUMBER%[yyy-4] = Choice%QUESTION.NUMBER%[yyy] } } if ( NOT==1 ) { Choice%QUESTION.NUMBER% = Correct%QUESTION.NUMBER% Choice%QUESTION.NUMBER% = "I don't know!" } else { Choice%QUESTION.NUMBER% = "None of these!" Choice%QUESTION.NUMBER% = "I don't know!" } radio = "" for ( i=1; i<7; i++ ) { if ( i==1 ) {document.write(QuestionText%QUESTION.NUMBER% + EquationText%QUESTION.NUMBER%+QuestionText1%QUESTION.NUMBER%+"

" + radio + Choice%QUESTION.NUMBER%[i] + "
")} else {document.write(radio + Choice%QUESTION.NUMBER%[i] + "
")} } document.write('') document.write('') } if ( document.forms.name == "FEEDBACK" ) {} else {question%QUESTION.NUMBER%()} ]]> "0" INCLUDES NOCASE "was correct"Your answer is correct.]]> "0" INCLUDES NOCASE "is incorrect"Your answer is incorrect.
Your selected adjacency matrix has a cycle in it, which is not appropriate for this situation.]]>
"0" INCLUDES NOCASE "is wrong"One of the vertices in this adjacency matrix is not connected to any of the other vertices. This does not fit with the scenario for this question.]]> "0" INCLUDES NOCASE "was incorrect"This may seem appropriate, but look at the edges in your adjacency matrix and the edges in the given adjacency matrix... you will see that they do not all coincide with each other.]]> "0" INCLUDES NOCASE "was wrong"Although each vertex is connected to another vertex, your adjacency matrix is not connected, which is important for the scenario in this question..]]> "0" INCLUDES NOCASE "is not the right answer"Your answer None of these was wrong.
Work through the theory above, retry the question at an appropriate time, and if you are still struggling then seek assisstance from a teacher or tutor.]]>
"0" INCLUDES NOCASE "did not know"You answered Did Not Know.
Work through the theory above, retry the question at an appropriate time, and if you are still struggling then seek assisstance from a teacher or tutor.]]>
OTHERYou didn't select any of the options!
Work through the theory above, retry the question at an appropriate time, and if you are still struggling then seek assisstance from a teacher or tutor.]]>
if (document.forms.name == "FEEDBACK") { Count = document.forms.elements.length document.write(document.forms.elements[Count-1].value) var titleofpopup = "Related material"; var help = wheretolook("%QUESTION.TAGS%","%QUESTION.TOPIC%"); document.write("

"+""+"
") } ]]>
default_graphtheory_linearalg_svg2. UnderstandEasyD1 function process%QUESTION.NUMBER%(QNo) { if ( document.forms.name != "FEEDBACK" ) { QT = QuestionText%QUESTION.NUMBER% QT1 = QuestionText1%QUESTION.NUMBER% SVGG = "Graphically this adjacency matrix looks like
"+SVG_graph5%QUESTION.NUMBER% + "

" ET = EquationText%QUESTION.NUMBER% COR = Correct%QUESTION.NUMBER% //alert(SVG_plot%QUESTION.NUMBER%) Nwidth=getFontSize()/16*310 Nheight=getFontSize()/16*80 a1="" Nwidth=getFontSize()/16*30 Nheight=getFontSize()/16*80 ANS= "

SOLUTION
This question is asking to find a spanning tree for the given adjacency matrix. A spanning tree is a subset of a graph that is connected to all vertices and has no cycles. In upper level mathematics, it can be seen how spanning trees are useful for determining shortest paths between two communities, least expensive methods for organizing a business, and much more.

For the four adjacency matrices from which to choose, first look at them to see that they are connecting all vertices and that they have no cycles (This ensures it is a spanning tree.). Second, take each candidate, even if you only have one, to see that all of the edges correspond to edges in the given adjacency matrix. If even one edge is not correct, then that candidate must be removed. If all of the edges correspond to edges in the given adjacency matrix, then you have the correct solution.

"; if(Correct%QUESTION.NUMBER% == "None of these!"){ SHOW="
From looking at these graphs and searching for these properties, you should see that the correct answer is "+COR+". However, a possible correct solution would look like this.

"+SVG_graph%QUESTION.NUMBER%+"
"; }else{ SHOW="
From looking at these graphs and searching for these properties, you should see that the correct answer is "+COR+"
"; } for ( var i=5; iNone of these!" ) {document.forms.elements[item+3].value = "Your answer "+document.forms.elements[item].value+ " was correct. A possible answer could be
"+document.forms.elements[item].value+"
was correct.
"} } else { if (document.forms.elements[item].value==Distractor1%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
is incorrect. "+ANS+".

"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor2%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
is wrong. "+ANS+".

"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor3%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
was incorrect. "+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor4%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
was wrong. "+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value=="None of these!") {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
is not the right answer. "+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value=="I don't know!") {document.forms.elements[item+3].value= " You did not know!
"+ANS+"
"+SHOW+"
" } } } } } } } } } } document.forms.elements[item+3].value = QT + ET + QT1 + SVGG + document.forms.elements[item+3].value } Choice%QUESTION.NUMBER% = new Array(4) function question%QUESTION.NUMBER%() { labels = new Array(); n = displayarray(1, 6, 9, 0)-0; pick = Math.round((Math.random()*(n-2))+1); first = Math.round(Math.random()*(n/3)+1); last = Math.round(Math.random()*(n/3) + first + 1); heshe = ""; person = ""; sexflip = Math.round(Math.random()); random = Math.round(Math.random()*100); if(sexflip == 0){ person += malename(random); heshe += "he"; }else{ person += femalename(random); heshe += "she"; } traveltoss = displayarray(1,0,3,1); traveltossword = new Array("ferry","bus","train","plane"); A = getrandommatrix(n, n, 0, 0, 1); mix = displayarray(n,1,n,0); for(i = 1; i <= n-1; i++){ select = (displayarray(1,1,i,0))-0; A[mix[select-1]][mix[i]] = (A[mix[select-1]][mix[i]]-0)+1; } for(i = 1; i <= n; i++){ labels[i]=alphabet(i-1,1); for(j = 1; j <= n; j++){ A[i][j] = Math.max(A[i][j]-0,A[j][i]-0); } } B = getrandommatrix(n, n, 0, 0, 1); for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ B[i][j] = Math.round(Math.random()*Math.sin(Math.PI/4)); } } //DISTRACTOR D1: Edge added to give a cycle. D1 = getrandommatrix(n,n,0,0,1); mix1 = displayarray(n,1,n,0); cycle_length = Math.round(Math.random()*(n-4))+3; for(i = 1; i <= cycle_length-1; i++){ D1[mix1[i-1]][mix1[i]] = (D1[mix1[i-1]][mix1[i]]-0)+1; } D1[mix1][mix1[cycle_length-1]] = (D1[mix1][mix1[cycle_length-1]]-0)+1; for(i = cycle_length-1; i <= n-1; i++){ select1 = (displayarray(1,1,i,0))-0; D1[mix1[select1-1]][mix1[i]] = (D1[mix1[select1-1]][mix1[i]]-0)+1; } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D1[i][j] = Math.max(D1[i][j]-0,D1[j][i]-0); } } for(i = 1; i <= n; i++){ D1[i][i] = (D1[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D1[i][j] > 1){ D1[i][j] = ((D1[i][j]-0)*0)+1; } } } //DISTRACTOR D2: Edge removed from one vertex to destroy spanning tree. D2 = getrandommatrix(n,n,0,0,1); mix2 = new Array(); cointoss = Math.round(Math.random()); if(cointoss == 0){ for(i = 0; i <= n-1; i++){ mix2[i] = mix[i]; } }else{ for(i = 0; i <= n-1; i++){ mix2[i] = mix1[i]; } } //First half of list is scrambled to create semi-new list. changing_point = Math.round(n/2); sublist = new Array(); for(i = 0; i <= changing_point - 1; i++){ sublist[i] = mix2[i]-0; } confusion = displayarray(changing_point,0,changing_point-1,1); for(i = 0; i <= changing_point - 1; i++){ mix2[i] = sublist[confusion[i]-0]; } //___ for(i = 1; i <= n-2; i++){ select2 = (displayarray(1,1,i,0))-0; D2[mix2[select2-1]][mix2[i]] = (D2[mix2[select2-1]][mix2[i]]-0)+1; } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D2[i][j] = Math.max(D2[i][j]-0,D2[j][i]-0); } } for(i = 1; i <= n; i++){ D2[i][i] = (D2[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D2[i][j] > 1){ D2[i][j] = ((D2[i][j]-0)*0)+1; } } } //DISTRACTOR D3: 1 edge in spanning tree is not in graph D3 = getrandommatrix(n,n,0,0,1); pick_a_list = Math.round(Math.random()*2); mix3 = new Array(); if(pick_a_list == 0){ for(i = 0; i <= n-1; i++){ mix3[i] = mix[i]; } }else if(pick_a_list == 1){ for(i = 0; i <= n-1; i++){ mix3[i] = mix1[i]; } }else if(pick_a_list == 2){ for(i = 0; i <= n-1; i++){ mix3[i] = mix2[i]; } } for(i = 1; i <= n-1; i++){ select3 = (displayarray(1,1,i,0))-0; D3[mix3[select3-1]][mix3[i]] = (D3[mix3[select3-1]][mix3[i]]-0)+1; } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D3[i][j] = Math.max(D3[i][j]-0,D3[j][i]-0); } } //Finished below Correct Matrix C. //DISTRACTOR D4: Spanning tree cut into 2 smaller trees, thus no longer spanning the graph. D4 = getrandommatrix(n,n,0,0,1); pick_a_new_list = Math.round(Math.random()*2); mix4 = new Array(); if(pick_a_new_list == 0){ for(i = 0; i <= n-1; i++){ mix4[i] = mix[i]; } }else if(pick_a_new_list == 1){ for(i = 0; i <= n-1; i++){ mix4[i] = mix1[i]; } }else if(pick_a_new_list == 2){ for(i = 0; i <= n-1; i++){ mix4[i] = mix2[i]; } } cut = Math.round(n/2); for(i = 1; i <= cut-2; i++){ select4 = (displayarray(1,1,i,0))-0; D4[mix4[select4-1]][mix4[i]] = (D4[mix4[select4-1]][mix4[i]]-0)+1; } for(i = cut; i <= n-1; i++){ select5 = (displayarray(1,cut,i,0))-0; D4[mix4[select5-1]][mix4[i]] = (D4[mix4[select5-1]][mix4[i]]-0)+1; } calculate = new Array(); for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ if(D4[i][j] > 0){ calculate[i] += 1; } } if(calculate[i] == 0){ new_j = displayarray(2,1,n,0); if(new_j == i){ D4[i][new_j] = ((D4[i][new_j]-0)*0)+1; }else{ D4[i][new_j] = ((D4[i][new_j]-0)*0)+1; } } } for(i = 1; i <= n; i++){ D4[i][i] = (D4[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D4[i][j] > 1){ D4[i][j] = ((D4[i][j]-0)*0)+1; } } } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D4[i][j] = Math.max(D4[i][j]-0,D4[j][i]-0); } } //Combined matrix C. C = getrandommatrix(n,n,0,0,1); for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ C[i][j] = (A[i][j]-0)+(D1[i][j]-0)+(D2[i][j]-0)+(D3[i][j]-0)+(D4[i][j]-0); if(C[i][j] > 1){ C[i][j] = (C[i][j]*0)+1; } } C[i][i] = (C[i][i]*0); } //Remainder of D3. switch_to_x = 0; switch_to_y = 0; switch_from_x = 0; switch_from_y = 0; for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ for(k = 1; k <= n; k++){ if(C[i][j] == 0 && D3[i][j] == 0 && i !== j && D3[i][k] == 1){ switch_to_x = (switch_to_x*0)+i; switch_to_y = (switch_to_y*0)+j; switch_from_x = (switch_from_x*0)+i; switch_from_y = (switch_from_y*0)+k; } } } } D3[switch_from_x][switch_from_y] = (D3[switch_from_x][switch_from_y]-0)*0; D3[switch_to_x][switch_to_y] = ((D3[switch_to_x][switch_to_y]-0)*0)+1; D3[switch_from_y][switch_from_x] = (D3[switch_from_y][switch_from_x]-0)*0; D3[switch_to_y][switch_to_x] = ((D3[switch_to_y][switch_to_x]-0)*0)+1; for(i = 1; i <= n; i++){ D3[i][i] = (D3[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D3[i][j] > 1){ D3[i][j] = ((D3[i][j]-0)*0)+1; } } } //___ toss = Math.round(Math.random()); toss = 0; // if toss = 0, then the matrices below are symmetric for (i = 1; i <= n; i++){ labels[i]=alphabet(i-1,1); for(j = 1; j <= n; j++){ if(toss == 0){ A[i][j] = A[j][i]; D1[i][j] = D1[j][i]; D4[i][j] = D4[j][i]; D2[i][j] = D2[j][i]; D3[i][j] = D3[j][i]; } } } tell_me_a_story = Math.round(Math.random()*3); if(tell_me_a_story == 0){ QuestionText%QUESTION.NUMBER% = "
A large corporate business is divided into "+n+" departments. However, in order to be successful, proper management and cooperation of the departments is required. The adjacency matrix below shows all of the connections between departments, "+alphabet(0,1)+" to "+alphabet(n-1,1)+".

"; QuestionText1%QUESTION.NUMBER% = "
In business, cooperation is important and thus, departments will rely on each other for adequate service and help when needed. The C.E.O. of the company wants to show this to all employees at an upcoming business meeting by removing connections between companies that are either unnecessary or that create cycles between a subset of the departments, which could allow for disorganization within the company. Doing this could possibly save the company millions.

Which of the adjacency matrices below best represents such a graph?

"; }else if(tell_me_a_story == 1){ QuestionText%QUESTION.NUMBER% = "

" QuestionText1%QUESTION.NUMBER% = "
Which of the adjacency matrices below is a spanning tree for the adjacency matrix above?

"; }else if(tell_me_a_story == 2){ QuestionText%QUESTION.NUMBER% = "
In a study at "+randomname(university)+", "+n+" university student services are being compared and similarities between pairs of services are noted by creating edges and displaying them in the following adjacency matrix.

"; QuestionText1%QUESTION.NUMBER% = "
The organizer of this activity wants to show that all services can be connected by a spanning tree. Which, if any, of the following adjacency matrices represents this?

"; }else if(tell_me_a_story == 3){ QuestionText%QUESTION.NUMBER% = "
"+n+" towns located in "+randomname(commonwealth)+" are connected through major roads, represented as edges in the adjacency matrix below.

"; QuestionText1%QUESTION.NUMBER% = "
Which adjacency matrix below illustrates a possible tree (i.e. no cycles) between all "+n+" towns?

"; } Nwidth1 = getFontSize()/16*(n * 45) ; //Nwidth2 = getFontSize()/16*(n * 35) ; Nheight = getFontSize()/16*(n * 50) ; m1="" m2="" m3="" // n+1,n+1 in displayincidencematrix(A,labels,n+1,n+1) means no highlighting c1 = "" c2 = "

" d1 = "" d2 = "" d3 = "" d4 = "" ratio_along_line = 0; // places arrow on line: if 0 then no arrow is drawn. ratio_along_line1 = 0.2; // ratio_along_line = 0; filled = 1; // = 1 filled arrow else open double_path_colour = "black"; // double_path_colour = getFgColor(); double_path_skinnyness = 10; fx = getFontSize()/16; size1 = fx*400; size2 = fx*400; size3 = fx*(100*fx*fx+420*fx+185); size4 = fx*(100*fx*fx+420*fx+185); svg_start = ''; SVG_graph%QUESTION.NUMBER% = SVG_digraph(A,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "

"; SVG_graph1%QUESTION.NUMBER% = SVG_digraph(D1,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph2%QUESTION.NUMBER% = SVG_digraph(D2,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph3%QUESTION.NUMBER% = SVG_digraph(D3,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph4%QUESTION.NUMBER% = SVG_digraph(D4,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph5%QUESTION.NUMBER% = SVG_digraph(C,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start); Correct%QUESTION.NUMBER% = m1+m2+m3+c1+"
"; EquationText%QUESTION.NUMBER% = m1+m2+m3+c2; Distractor1%QUESTION.NUMBER% = m1+m2+m3+d1+"
"; Distractor2%QUESTION.NUMBER% = m1+m2+m3+d2+"
"; Distractor3%QUESTION.NUMBER% = m1+m2+m3+d3+"
"; Distractor4%QUESTION.NUMBER% = m1+m2+m3+d4+"
"; randomisation = displayarray(3,1,3,0); randomisation2 = displayarray(4,0,3,1); WhichDistractor = new Array(4); WhichDistractor = Distractor1%QUESTION.NUMBER% WhichDistractor = Distractor2%QUESTION.NUMBER% WhichDistractor = Distractor3%QUESTION.NUMBER% WhichDistractor = Distractor4%QUESTION.NUMBER% NOT = Math.ceil(4*Math.random()); xxx = Math.ceil(4*Math.random()); if ( NOT==1 ) { Answer%QUESTION.NUMBER% = Correct%QUESTION.NUMBER% Correct%QUESTION.NUMBER% = "None of these!" Choice%QUESTION.NUMBER%[xxx] = WhichDistractor[randomisation2]; } else { Choice%QUESTION.NUMBER%[xxx] = Correct%QUESTION.NUMBER% } Choice%QUESTION.NUMBER%[xxx+randomisation] = WhichDistractor[randomisation2]; Choice%QUESTION.NUMBER%[xxx+randomisation] = WhichDistractor[randomisation2]; Choice%QUESTION.NUMBER%[xxx+randomisation] = WhichDistractor[randomisation2]; for ( var yyy=xxx; yyy<=xxx+3; yyy++ ) { if ( yyy>4 ) { Choice%QUESTION.NUMBER%[yyy-4] = Choice%QUESTION.NUMBER%[yyy] } } if ( NOT==1 ) { Choice%QUESTION.NUMBER% = Correct%QUESTION.NUMBER% Choice%QUESTION.NUMBER% = "I don't know!" } else { Choice%QUESTION.NUMBER% = "None of these!" Choice%QUESTION.NUMBER% = "I don't know!" } radio = "" for ( i=1; i<7; i++ ) { if ( i==1 ) {document.write(QuestionText%QUESTION.NUMBER% + EquationText%QUESTION.NUMBER%+QuestionText1%QUESTION.NUMBER%+"

" + radio + Choice%QUESTION.NUMBER%[i] + "
")} else {document.write(radio + Choice%QUESTION.NUMBER%[i] + "
")} } document.write('') document.write('') } if ( document.forms.name == "FEEDBACK" ) {} else {question%QUESTION.NUMBER%()} ]]> "0" INCLUDES NOCASE "was correct"Your answer is correct.]]> "0" INCLUDES NOCASE "is incorrect"Your answer is incorrect.
Your selected adjacency matrix has a cycle in it, which is not appropriate for this situation.]]>
"0" INCLUDES NOCASE "is wrong"One of the vertices in this adjacency matrix is not connected to any of the other vertices. This does not fit with the scenario for this question.]]> "0" INCLUDES NOCASE "was incorrect"This may seem appropriate, but look at the edges in your adjacency matrix and the edges in the given adjacency matrix... you will see that they do not all coincide with each other.]]> "0" INCLUDES NOCASE "was wrong"Although each vertex is connected to another vertex, your adjacency matrix is not connected, which is important for the scenario in this question..]]> "0" INCLUDES NOCASE "is not the right answer"Your answer None of these was wrong.
Work through the theory above, retry the question at an appropriate time, and if you are still struggling then seek assisstance from a teacher or tutor.]]>
"0" INCLUDES NOCASE "did not know"You answered Did Not Know.
Work through the theory above, retry the question at an appropriate time, and if you are still struggling then seek assisstance from a teacher or tutor.]]>
OTHERYou didn't select any of the options!
Work through the theory above, retry the question at an appropriate time, and if you are still struggling then seek assisstance from a teacher or tutor.]]>
if (document.forms.name == "FEEDBACK") { Count = document.forms.elements.length document.write(document.forms.elements[Count-1].value) var titleofpopup = "Related material"; var help = wheretolook("%QUESTION.TAGS%","%QUESTION.TOPIC%"); document.write("

"+""+"
") } ]]>
default_graphtheory_linearalg_svg2. UnderstandEasyD1 function process%QUESTION.NUMBER%(QNo) { if ( document.forms.name != "FEEDBACK" ) { QT = QuestionText%QUESTION.NUMBER% QT1 = QuestionText1%QUESTION.NUMBER% SVGG = SVG_graph%QUESTION.NUMBER% + "

" ET = EquationText%QUESTION.NUMBER% COR = Correct%QUESTION.NUMBER% //alert(SVG_plot%QUESTION.NUMBER%) Nwidth=getFontSize()/16*310 Nheight=getFontSize()/16*80 a1="" Nwidth=getFontSize()/16*30 Nheight=getFontSize()/16*80 ANS= "

SOLUTION
This question is asking to find a spanning tree for the given graph. A spanning tree is a subset of a graph that is connected to all vertices and has no cycles.

For the four graphs from which to choose, first look at them to see that they are connecting all vertices and that they have no cycles. (This ensures it is a spanning tree.) Second, take each candidate, even if you only have one, to see that all of the edges correspond to edges in the given graph. If even one edge is not correct, then that candidate must be removed. If all of the edges correspond to edges in the given graph, then you have the correct solution.

"; if(Correct%QUESTION.NUMBER% == "None of these!"){ SHOW="
From looking at these graphs and searching for these properties, you should see that the correct answer is "+COR+". However, a possible correct solution would look like this.

"+SVG_graph%QUESTION.NUMBER%+"
"; }else{ SHOW="
From looking at these graphs and searching for these properties, you should see that the correct answer is "+COR+"
"; } for ( var i=5; iNone of these!" ) {document.forms.elements[item+3].value = "Your answer "+document.forms.elements[item].value+ " was correct. A possible answer could be
"+document.forms.elements[item].value+"
was correct.
"} } else { if (document.forms.elements[item].value==Distractor1%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
is incorrect. "+ANS+".

"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor2%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
is wrong. "+ANS+".

"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor3%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
was incorrect. "+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor4%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
was wrong. "+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value=="None of these!") {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
is not the right answer. "+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value=="I don't know!") {document.forms.elements[item+3].value= " You did not know!
"+ANS+"
"+SHOW+"
" } } } } } } } } } } document.forms.elements[item+3].value = QT + ET + QT1 + SVGG + document.forms.elements[item+3].value } Choice%QUESTION.NUMBER% = new Array(4) function question%QUESTION.NUMBER%() { labels = new Array(); n = displayarray(1, 6, 9, 0)-0; pick = Math.round((Math.random()*(n-2))+1); first = Math.round(Math.random()*(n/3)+1); last = Math.round(Math.random()*(n/3) + first + 1); heshe = ""; person = ""; sexflip = Math.round(Math.random()); random = Math.round(Math.random()*100); if(sexflip == 0){ person += malename(random); heshe += "he"; }else{ person += femalename(random); heshe += "she"; } traveltoss = displayarray(1,0,3,1); traveltossword = new Array("ferry","bus","train","plane"); A = getrandommatrix(n, n, 0, 0, 1); mix = displayarray(n,1,n,0); for(i = 1; i <= n-1; i++){ select = (displayarray(1,1,i,0))-0; A[mix[select-1]][mix[i]] = (A[mix[select-1]][mix[i]]-0)+1; } for(i = 1; i <= n; i++){ labels[i]=alphabet(i-1,1); for(j = 1; j <= n; j++){ A[i][j] = Math.max(A[i][j]-0,A[j][i]-0); } } B = getrandommatrix(n, n, 0, 0, 1); for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ B[i][j] = Math.round(Math.random()*Math.sin(Math.PI/4)); } } //DISTRACTOR D1: Edge added to give a cycle. D1 = getrandommatrix(n,n,0,0,1); mix1 = displayarray(n,1,n,0); cycle_length = Math.round(Math.random()*(n-4))+3; for(i = 1; i <= cycle_length-1; i++){ D1[mix1[i-1]][mix1[i]] = (D1[mix1[i-1]][mix1[i]]-0)+1; } D1[mix1][mix1[cycle_length-1]] = (D1[mix1][mix1[cycle_length-1]]-0)+1; for(i = cycle_length-1; i <= n-1; i++){ select1 = (displayarray(1,1,i,0))-0; D1[mix1[select1-1]][mix1[i]] = (D1[mix1[select1-1]][mix1[i]]-0)+1; } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D1[i][j] = Math.max(D1[i][j]-0,D1[j][i]-0); } } for(i = 1; i <= n; i++){ D1[i][i] = (D1[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D1[i][j] > 1){ D1[i][j] = ((D1[i][j]-0)*0)+1; } } } //DISTRACTOR D2: Edge removed from one vertex to destroy spanning tree. D2 = getrandommatrix(n,n,0,0,1); mix2 = new Array(); cointoss = Math.round(Math.random()); if(cointoss == 0){ for(i = 0; i <= n-1; i++){ mix2[i] = mix[i]; } }else{ for(i = 0; i <= n-1; i++){ mix2[i] = mix1[i]; } } //First half of list is scrambled to create semi-new list. changing_point = Math.round(n/2); sublist = new Array(); for(i = 0; i <= changing_point - 1; i++){ sublist[i] = mix2[i]-0; } confusion = displayarray(changing_point,0,changing_point-1,1); for(i = 0; i <= changing_point - 1; i++){ mix2[i] = sublist[confusion[i]-0]; } //___ for(i = 1; i <= n-2; i++){ select2 = (displayarray(1,1,i,0))-0; D2[mix2[select2-1]][mix2[i]] = (D2[mix2[select2-1]][mix2[i]]-0)+1; } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D2[i][j] = Math.max(D2[i][j]-0,D2[j][i]-0); } } for(i = 1; i <= n; i++){ D2[i][i] = (D2[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D2[i][j] > 1){ D2[i][j] = ((D2[i][j]-0)*0)+1; } } } //DISTRACTOR D3: 1 edge in spanning tree is not in graph D3 = getrandommatrix(n,n,0,0,1); pick_a_list = Math.round(Math.random()*2); mix3 = new Array(); if(pick_a_list == 0){ for(i = 0; i <= n-1; i++){ mix3[i] = mix[i]; } }else if(pick_a_list == 1){ for(i = 0; i <= n-1; i++){ mix3[i] = mix1[i]; } }else if(pick_a_list == 2){ for(i = 0; i <= n-1; i++){ mix3[i] = mix2[i]; } } for(i = 1; i <= n-1; i++){ select3 = (displayarray(1,1,i,0))-0; D3[mix3[select3-1]][mix3[i]] = (D3[mix3[select3-1]][mix3[i]]-0)+1; } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D3[i][j] = Math.max(D3[i][j]-0,D3[j][i]-0); } } //Finished below Correct Matrix C. //DISTRACTOR D4: Spanning tree cut into 2 smaller trees, thus no longer spanning the graph. D4 = getrandommatrix(n,n,0,0,1); pick_a_new_list = Math.round(Math.random()*2); mix4 = new Array(); if(pick_a_new_list == 0){ for(i = 0; i <= n-1; i++){ mix4[i] = mix[i]; } }else if(pick_a_new_list == 1){ for(i = 0; i <= n-1; i++){ mix4[i] = mix1[i]; } }else if(pick_a_new_list == 2){ for(i = 0; i <= n-1; i++){ mix4[i] = mix2[i]; } } cut = Math.round(n/2); for(i = 1; i <= cut-2; i++){ select4 = (displayarray(1,1,i,0))-0; D4[mix4[select4-1]][mix4[i]] = (D4[mix4[select4-1]][mix4[i]]-0)+1; } for(i = cut; i <= n-1; i++){ select5 = (displayarray(1,cut,i,0))-0; D4[mix4[select5-1]][mix4[i]] = (D4[mix4[select5-1]][mix4[i]]-0)+1; } calculate = new Array(); for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ if(D4[i][j] > 0){ calculate[i] += 1; } } if(calculate[i] == 0){ new_j = displayarray(2,1,n,0); if(new_j == i){ D4[i][new_j] = ((D4[i][new_j]-0)*0)+1; }else{ D4[i][new_j] = ((D4[i][new_j]-0)*0)+1; } } } for(i = 1; i <= n; i++){ D4[i][i] = (D4[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D4[i][j] > 1){ D4[i][j] = ((D4[i][j]-0)*0)+1; } } } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D4[i][j] = Math.max(D4[i][j]-0,D4[j][i]-0); } } //Combined matrix C. C = getrandommatrix(n,n,0,0,1); for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ C[i][j] = (A[i][j]-0)+(D1[i][j]-0)+(D2[i][j]-0)+(D3[i][j]-0)+(D4[i][j]-0); if(C[i][j] > 1){ C[i][j] = (C[i][j]*0)+1; } } C[i][i] = (C[i][i]*0); } //Remainder of D3. switch_to_x = 0; switch_to_y = 0; switch_from_x = 0; switch_from_y = 0; for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ for(k = 1; k <= n; k++){ if(C[i][j] == 0 && D3[i][j] == 0 && i !== j && D3[i][k] == 1){ switch_to_x = (switch_to_x*0)+i; switch_to_y = (switch_to_y*0)+j; switch_from_x = (switch_from_x*0)+i; switch_from_y = (switch_from_y*0)+k; } } } } D3[switch_from_x][switch_from_y] = (D3[switch_from_x][switch_from_y]-0)*0; D3[switch_to_x][switch_to_y] = ((D3[switch_to_x][switch_to_y]-0)*0)+1; D3[switch_from_y][switch_from_x] = (D3[switch_from_y][switch_from_x]-0)*0; D3[switch_to_y][switch_to_x] = ((D3[switch_to_y][switch_to_x]-0)*0)+1; for(i = 1; i <= n; i++){ D3[i][i] = (D3[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D3[i][j] > 1){ D3[i][j] = ((D3[i][j]-0)*0)+1; } } } //___ toss = Math.round(Math.random()); toss = 0; // if toss = 0, then the matrices below are symmetric for (i = 1; i <= n; i++){ labels[i]=alphabet(i-1,1); for(j = 1; j <= n; j++){ if(toss == 0){ A[i][j] = A[j][i]; D1[i][j] = D1[j][i]; D4[i][j] = D4[j][i]; D2[i][j] = D2[j][i]; D3[i][j] = D3[j][i]; } } } tell_me_a_story = Math.round(Math.random()*3); if(tell_me_a_story == 0){ QuestionText%QUESTION.NUMBER% = "
A large corporate business is divided into "+n+" departments. However, in order to be successful, proper management and cooperation of the departments is required. The adjacency matrix below shows all of the connections between departments, "+alphabet(0,1)+" to "+alphabet(n-1,1)+".

"; QuestionText1%QUESTION.NUMBER% = "
In business, cooperation is important and thus, departments will rely on each other for adequate service and help when needed. The C.E.O. of the company wants to show this to all employees at an upcoming business meeting by removing connections between companies that are either unnecessary or that create cycles between a subset of the departments, which could allow for disorganization within the company. Doing this could possibly save the company millions.

Which of the graphs below best represents such an adjacency matrix?

"; }else if(tell_me_a_story == 1){ QuestionText%QUESTION.NUMBER% = "

" QuestionText1%QUESTION.NUMBER% = "
Which of the graphs below is a spanning tree for the adjacency matrix above?

"; }else if(tell_me_a_story == 2){ QuestionText%QUESTION.NUMBER% = "
In a study at "+randomname(university)+", "+n+" university student services are being compared and similarities between pairs of services are noted by creating edges and displaying them in the following adjacency matrix.

"; QuestionText1%QUESTION.NUMBER% = "
The organizer of this activity wants to show that all services can be connected by a spanning tree. Which, if any, of the following graphs represents this?

"; }else if(tell_me_a_story == 3){ QuestionText%QUESTION.NUMBER% = "
"+n+" towns located in "+randomname(commonwealth)+" are connected through major roads, represented as edges in the adjacency matrix below.

"; QuestionText1%QUESTION.NUMBER% = "
Which graphs below illustrates a possible tree (i.e. no cycles) between all "+n+" towns?

"; } Nwidth1 = getFontSize()/16*(n * 45) ; //Nwidth2 = getFontSize()/16*(n * 35) ; Nheight = getFontSize()/16*(n * 50) ; m1="" m2="" m3="" // n+1,n+1 in displayincidencematrix(A,labels,n+1,n+1) means no highlighting c1 = "" c2 = "

" d1 = "" d2 = "" d3 = "" d4 = "" ratio_along_line = 0; // places arrow on line: if 0 then no arrow is drawn. ratio_along_line1 = 0.2; // ratio_along_line = 0; filled = 1; // = 1 filled arrow else open double_path_colour = "black"; // double_path_colour = getFgColor(); double_path_skinnyness = 10; fx = getFontSize()/16; size1 = fx*400; size2 = fx*400; size3 = fx*(100*fx*fx+420*fx+185); size4 = fx*(100*fx*fx+420*fx+185); svg_start = ''; SVG_graph%QUESTION.NUMBER% = SVG_digraph(A,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "

"; SVG_graph1%QUESTION.NUMBER% = SVG_digraph(D1,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph2%QUESTION.NUMBER% = SVG_digraph(D2,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph3%QUESTION.NUMBER% = SVG_digraph(D3,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph4%QUESTION.NUMBER% = SVG_digraph(D4,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start)+ "
"; SVG_graph5%QUESTION.NUMBER% = SVG_digraph(C,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start); Correct%QUESTION.NUMBER% = SVG_graph%QUESTION.NUMBER%; EquationText%QUESTION.NUMBER% = m1+m2+m3+c2; Distractor1%QUESTION.NUMBER% = SVG_graph1%QUESTION.NUMBER%; Distractor2%QUESTION.NUMBER% = SVG_graph2%QUESTION.NUMBER%; Distractor3%QUESTION.NUMBER% = SVG_graph3%QUESTION.NUMBER%; Distractor4%QUESTION.NUMBER% = SVG_graph4%QUESTION.NUMBER%; randomisation = displayarray(3,1,3,0); randomisation2 = displayarray(4,0,3,1); WhichDistractor = new Array(4); WhichDistractor = Distractor1%QUESTION.NUMBER% WhichDistractor = Distractor2%QUESTION.NUMBER% WhichDistractor = Distractor3%QUESTION.NUMBER% WhichDistractor = Distractor4%QUESTION.NUMBER% NOT = Math.ceil(4*Math.random()); xxx = Math.ceil(4*Math.random()); if ( NOT==1 ) { Answer%QUESTION.NUMBER% = Correct%QUESTION.NUMBER% Correct%QUESTION.NUMBER% = "None of these!" Choice%QUESTION.NUMBER%[xxx] = WhichDistractor[randomisation2]; } else { Choice%QUESTION.NUMBER%[xxx] = Correct%QUESTION.NUMBER% } Choice%QUESTION.NUMBER%[xxx+randomisation] = WhichDistractor[randomisation2]; Choice%QUESTION.NUMBER%[xxx+randomisation] = WhichDistractor[randomisation2]; Choice%QUESTION.NUMBER%[xxx+randomisation] = WhichDistractor[randomisation2]; for ( var yyy=xxx; yyy<=xxx+3; yyy++ ) { if ( yyy>4 ) { Choice%QUESTION.NUMBER%[yyy-4] = Choice%QUESTION.NUMBER%[yyy] } } if ( NOT==1 ) { Choice%QUESTION.NUMBER% = Correct%QUESTION.NUMBER% Choice%QUESTION.NUMBER% = "I don't know!" } else { Choice%QUESTION.NUMBER% = "None of these!" Choice%QUESTION.NUMBER% = "I don't know!" } radio = "" for ( i=1; i<7; i++ ) { if ( i==1 ) {document.write(QuestionText%QUESTION.NUMBER% + EquationText%QUESTION.NUMBER%+QuestionText1%QUESTION.NUMBER%+"

" + radio + Choice%QUESTION.NUMBER%[i] + "
")} else {document.write(radio + Choice%QUESTION.NUMBER%[i] + "
")} } document.write('') document.write('') } if ( document.forms.name == "FEEDBACK" ) {} else {question%QUESTION.NUMBER%()} ]]> "0" INCLUDES NOCASE "was correct"Your answer is correct.]]> "0" INCLUDES NOCASE "is incorrect"Your answer is incorrect.
Your selected graph has a cycle in it, which is not appropriate for this situation.]]>
"0" INCLUDES NOCASE "is wrong"One of the vertices in this graph is not connected to any of the other vertices. This does not fit with the scenario for this question.]]> "0" INCLUDES NOCASE "was incorrect"This may seem appropriate, but look at the edges in your graph and the edges in the given graph... you will see that they do not all coincide with each other.]]> "0" INCLUDES NOCASE "was wrong"Although each vertex is connected to another vertex, your graph is not connected, which is important for the scenario in this question..]]> "0" INCLUDES NOCASE "is not the right answer"Your answer None of these was wrong.
Work through the theory above, retry the question at an appropriate time, and if you are still struggling then seek assisstance from a teacher or tutor.]]>
"0" INCLUDES NOCASE "did not know"You answered Did Not Know.
Work through the theory above, retry the question at an appropriate time, and if you are still struggling then seek assisstance from a teacher or tutor.]]>
OTHERYou didn't select any of the options!
Work through the theory above, retry the question at an appropriate time, and if you are still struggling then seek assisstance from a teacher or tutor.]]>
if (document.forms.name == "FEEDBACK") { Count = document.forms.elements.length document.write(document.forms.elements[Count-1].value) var titleofpopup = "Related material"; var help = wheretolook("%QUESTION.TAGS%","%QUESTION.TOPIC%"); document.write("

"+""+"
") } ]]>
default_graphtheory_linearalg_svg2. UnderstandEasyD1 function process%QUESTION.NUMBER%(QNo) { if ( document.forms.name != "FEEDBACK" ) { QT = QuestionText%QUESTION.NUMBER% QT1 = QuestionText1%QUESTION.NUMBER% SVGG = SVG_graph%QUESTION.NUMBER% + "

" ET = EquationText%QUESTION.NUMBER% COR = Correct%QUESTION.NUMBER% //alert(SVG_plot%QUESTION.NUMBER%) Nwidth=getFontSize()/16*310 Nheight=getFontSize()/16*80 a1="" Nwidth=getFontSize()/16*30 Nheight=getFontSize()/16*80 ANS= "

SOLUTION
This question is asking to find a spanning tree for the given graph. A spanning tree is a subset of a graph that is connected to all vertices and has no cycles. In upper level mathematics, it can be seen how spanning trees are useful for determining shortest paths between two communities, least expensive methods for organizing a business, and much more.

For the four graphs from which to choose, first look at them to see that they are connecting all vertices and that they have no cycles (This ensures it is a spanning tree.). Second, take each candidate, even if you only have one, to see that all of the edges correspond to edges in the given graph. If even one edge is not correct, then that candidate must be removed. If all of the edges correspond to edges in the given graph, then you have the correct solution.

"; if(Correct%QUESTION.NUMBER% == "None of these!"){ SHOW="
From looking at these graphs and searching for these properties, you should see that the correct answer is "+COR+". However, a possible correct solution would look like this.

"+SVG_graph%QUESTION.NUMBER%+"
"; }else{ SHOW="
From looking at these graphs and searching for these properties, you should see that the correct answer is
"+COR+"
"; } for ( var i=5; iNone of these!" ) {document.forms.elements[item+3].value = "Your answer "+document.forms.elements[item].value+ " was correct. A possible answer could be
"+document.forms.elements[item].value+"
was correct.
"} } else { if (document.forms.elements[item].value==Distractor1%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
is incorrect. "+ANS+".

"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor2%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
is wrong. "+ANS+".

"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor3%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
was incorrect. "+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value==Distractor4%QUESTION.NUMBER%) {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
was wrong. "+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value=="None of these!") {document.forms.elements[item+3].value= " Your answer,
"+document.forms.elements[item].value+"
is not the right answer. "+ANS+"
"+SHOW+"
" } else { if (document.forms.elements[item].value=="I don't know!") {document.forms.elements[item+3].value= " You did not know!
"+ANS+"
"+SHOW+"
" } } } } } } } } } } document.forms.elements[item+3].value = QT + QT1 + SVGG + document.forms.elements[item+3].value } Choice%QUESTION.NUMBER% = new Array(4) function question%QUESTION.NUMBER%() { labels = new Array(); n = displayarray(1, 6, 9, 0)-0; pick = Math.round((Math.random()*(n-2))+1); first = Math.round(Math.random()*(n/3)+1); last = Math.round(Math.random()*(n/3) + first + 1); heshe = ""; person = ""; sexflip = Math.round(Math.random()); random = Math.round(Math.random()*100); if(sexflip == 0){ person += malename(random); heshe += "he"; }else{ person += femalename(random); heshe += "she"; } traveltoss = displayarray(1,0,3,1); traveltossword = new Array("ferry","bus","train","plane"); A = getrandommatrix(n, n, 0, 0, 1); mix = displayarray(n,1,n,0); for(i = 1; i <= n-1; i++){ select = (displayarray(1,1,i,0))-0; A[mix[select-1]][mix[i]] = (A[mix[select-1]][mix[i]]-0)+1; } for(i = 1; i <= n; i++){ labels[i]=alphabet(i-1,1); for(j = 1; j <= n; j++){ A[i][j] = Math.max(A[i][j]-0,A[j][i]-0); } } B = getrandommatrix(n, n, 0, 0, 1); for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ B[i][j] = Math.round(Math.random()*Math.sin(Math.PI/4)); } } //DISTRACTOR D1: Edge added to give a cycle. D1 = getrandommatrix(n,n,0,0,1); mix1 = displayarray(n,1,n,0); cycle_length = Math.round(Math.random()*(n-4))+3; for(i = 1; i <= cycle_length-1; i++){ D1[mix1[i-1]][mix1[i]] = (D1[mix1[i-1]][mix1[i]]-0)+1; } D1[mix1][mix1[cycle_length-1]] = (D1[mix1][mix1[cycle_length-1]]-0)+1; for(i = cycle_length-1; i <= n-1; i++){ select1 = (displayarray(1,1,i,0))-0; D1[mix1[select1-1]][mix1[i]] = (D1[mix1[select1-1]][mix1[i]]-0)+1; } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D1[i][j] = Math.max(D1[i][j]-0,D1[j][i]-0); } } for(i = 1; i <= n; i++){ D1[i][i] = (D1[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D1[i][j] > 1){ D1[i][j] = ((D1[i][j]-0)*0)+1; } } } //DISTRACTOR D2: Edge removed from one vertex to destroy spanning tree. D2 = getrandommatrix(n,n,0,0,1); mix2 = new Array(); cointoss = Math.round(Math.random()); if(cointoss == 0){ for(i = 0; i <= n-1; i++){ mix2[i] = mix[i]; } }else{ for(i = 0; i <= n-1; i++){ mix2[i] = mix1[i]; } } //First half of list is scrambled to create semi-new list. changing_point = Math.round(n/2); sublist = new Array(); for(i = 0; i <= changing_point - 1; i++){ sublist[i] = mix2[i]-0; } confusion = displayarray(changing_point,0,changing_point-1,1); for(i = 0; i <= changing_point - 1; i++){ mix2[i] = sublist[confusion[i]-0]; } //___ for(i = 1; i <= n-2; i++){ select2 = (displayarray(1,1,i,0))-0; D2[mix2[select2-1]][mix2[i]] = (D2[mix2[select2-1]][mix2[i]]-0)+1; } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D2[i][j] = Math.max(D2[i][j]-0,D2[j][i]-0); } } for(i = 1; i <= n; i++){ D2[i][i] = (D2[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D2[i][j] > 1){ D2[i][j] = ((D2[i][j]-0)*0)+1; } } } //DISTRACTOR D3: 1 edge in spanning tree is not in graph D3 = getrandommatrix(n,n,0,0,1); pick_a_list = Math.round(Math.random()*2); mix3 = new Array(); if(pick_a_list == 0){ for(i = 0; i <= n-1; i++){ mix3[i] = mix[i]; } }else if(pick_a_list == 1){ for(i = 0; i <= n-1; i++){ mix3[i] = mix1[i]; } }else if(pick_a_list == 2){ for(i = 0; i <= n-1; i++){ mix3[i] = mix2[i]; } } for(i = 1; i <= n-1; i++){ select3 = (displayarray(1,1,i,0))-0; D3[mix3[select3-1]][mix3[i]] = (D3[mix3[select3-1]][mix3[i]]-0)+1; } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D3[i][j] = Math.max(D3[i][j]-0,D3[j][i]-0); } } //Finished below Correct Matrix C. //DISTRACTOR D4: Spanning tree cut into 2 smaller trees, thus no longer spanning the graph. D4 = getrandommatrix(n,n,0,0,1); pick_a_new_list = Math.round(Math.random()*2); mix4 = new Array(); if(pick_a_new_list == 0){ for(i = 0; i <= n-1; i++){ mix4[i] = mix[i]; } }else if(pick_a_new_list == 1){ for(i = 0; i <= n-1; i++){ mix4[i] = mix1[i]; } }else if(pick_a_new_list == 2){ for(i = 0; i <= n-1; i++){ mix4[i] = mix2[i]; } } cut = Math.round(n/2); for(i = 1; i <= cut-2; i++){ select4 = (displayarray(1,1,i,0))-0; D4[mix4[select4-1]][mix4[i]] = (D4[mix4[select4-1]][mix4[i]]-0)+1; } for(i = cut; i <= n-1; i++){ select5 = (displayarray(1,cut,i,0))-0; D4[mix4[select5-1]][mix4[i]] = (D4[mix4[select5-1]][mix4[i]]-0)+1; } calculate = new Array(); for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ if(D4[i][j] > 0){ calculate[i] += 1; } } if(calculate[i] == 0){ new_j = displayarray(2,1,n,0); if(new_j == i){ D4[i][new_j] = ((D4[i][new_j]-0)*0)+1; }else{ D4[i][new_j] = ((D4[i][new_j]-0)*0)+1; } } } for(i = 1; i <= n; i++){ D4[i][i] = (D4[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D4[i][j] > 1){ D4[i][j] = ((D4[i][j]-0)*0)+1; } } } for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ D4[i][j] = Math.max(D4[i][j]-0,D4[j][i]-0); } } //Combined matrix C. C = getrandommatrix(n,n,0,0,1); for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ C[i][j] = (A[i][j]-0)+(D1[i][j]-0)+(D2[i][j]-0)+(D3[i][j]-0)+(D4[i][j]-0); if(C[i][j] > 1){ C[i][j] = (C[i][j]*0)+1; } } C[i][i] = (C[i][i]*0); } //Remainder of D3. switch_to_x = 0; switch_to_y = 0; switch_from_x = 0; switch_from_y = 0; for(i = 1; i <= n; i++){ for(j = 1; j <= n; j++){ for(k = 1; k <= n; k++){ if(C[i][j] == 0 && D3[i][j] == 0 && i !== j && D3[i][k] == 1){ switch_to_x = (switch_to_x*0)+i; switch_to_y = (switch_to_y*0)+j; switch_from_x = (switch_from_x*0)+i; switch_from_y = (switch_from_y*0)+k; } } } } D3[switch_from_x][switch_from_y] = (D3[switch_from_x][switch_from_y]-0)*0; D3[switch_to_x][switch_to_y] = ((D3[switch_to_x][switch_to_y]-0)*0)+1; D3[switch_from_y][switch_from_x] = (D3[switch_from_y][switch_from_x]-0)*0; D3[switch_to_y][switch_to_x] = ((D3[switch_to_y][switch_to_x]-0)*0)+1; for(i = 1; i <= n; i++){ D3[i][i] = (D3[i][i]-0)*0; for(j = 1; j <= n; j++){ if(D3[i][j] > 1){ D3[i][j] = ((D3[i][j]-0)*0)+1; } } } //___ toss = Math.round(Math.random()); toss = 0; // if toss = 0, then the matrices below are symmetric for (i = 1; i <= n; i++){ labels[i]=alphabet(i-1,1); for(j = 1; j <= n; j++){ if(toss == 0){ A[i][j] = A[j][i]; D1[i][j] = D1[j][i]; D4[i][j] = D4[j][i]; D2[i][j] = D2[j][i]; D3[i][j] = D3[j][i]; } } } tell_me_a_story = Math.round(Math.random()*3); if(tell_me_a_story == 0){ QuestionText%QUESTION.NUMBER% = "
A large corporate business is divided into "+n+" departments. However, in order to be successful, proper management and cooperation of the departments is required. The graph below shows all of the connections between departments, "+alphabet(0,1)+" to "+alphabet(n-1,1)+".

"; QuestionText1%QUESTION.NUMBER% = "
In business, cooperation is important and thus, departments will rely on each other for adequate service and help when needed. The C.E.O. of the company wants to show this to all employees at an upcoming business meeting by removing connections between companies that are either unnecessary or that create cycles between a subset of the departments, which could allow for disorganization within the company. Doing this could possibly save the company millions.

Which of the following best represents such a graph?

"; }else if(tell_me_a_story == 1){ QuestionText%QUESTION.NUMBER% = "

" QuestionText1%QUESTION.NUMBER% = "
Which of the following is a spanning tree for the graph above?

"; }else if(tell_me_a_story == 2){ QuestionText%QUESTION.NUMBER% = "
In a study at "+randomname(university)+", "+n+" university student services are being compared and similarities between pairs of services are noted by creating edges and displaying them in the following graph.

"; QuestionText1%QUESTION.NUMBER% = "
The organizer of this activity wants to show that all services can be connected by a spanning tree. Which, if any, of the following represents this?

"; }else if(tell_me_a_story == 3){ QuestionText%QUESTION.NUMBER% = "
"+n+" towns located in "+randomname(commonwealth)+" are connected through major roads, represented as edges in the graph below.

"; QuestionText1%QUESTION.NUMBER% = "
Which of the following illustrates a possible tree (i.e. no cycles) between all "+n+" towns?

"; } Nwidth1 = getFontSize()/16*(n * 45) ; //Nwidth2 = getFontSize()/16*(n * 35) ; Nheight = getFontSize()/16*(n * 50) ; m1="" m2="" m3="" // n+1,n+1 in displayincidencematrix(A,labels,n+1,n+1) means no highlighting c1 = "" c2 = "

" d1 = "" d2 = "" d3 = "" d4 = "" ratio_along_line = 0; // places arrow on line: if 0 then no arrow is drawn. ratio_along_line1 = 0.2; // ratio_along_line = 0; filled = 1; // = 1 filled arrow else open double_path_colour = "black"; // double_path_colour = getFgColor(); double_path_skinnyness = 10; fx = getFontSize()/16; size1 = fx*400; size2 = fx*400; size3 = fx*(100*fx*fx+420*fx+185); size4 = fx*(100*fx*fx+420*fx+185); svg_start = ''; SVG_graph%QUESTION.NUMBER% = SVG_digraph(A,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start); SVG_graph1%QUESTION.NUMBER% = SVG_digraph(D1,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start); SVG_graph2%QUESTION.NUMBER% = SVG_digraph(D2,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start); SVG_graph3%QUESTION.NUMBER% = SVG_digraph(D3,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start); SVG_graph4%QUESTION.NUMBER% = SVG_digraph(D4,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start); SVG_graph5%QUESTION.NUMBER% = SVG_digraph(C,ratio_along_line,filled,double_path_colour,double_path_skinnyness,svg_start); Correct%QUESTION.NUMBER% = SVG_graph%QUESTION.NUMBER%+"

"; EquationText%QUESTION.NUMBER% = SVG_graph5%QUESTION.NUMBER%; Distractor1%QUESTION.NUMBER% = SVG_graph1%QUESTION.NUMBER%+ "
"; Distractor2%QUESTION.NUMBER% = SVG_graph2%QUESTION.NUMBER%+ "
"; Distractor3%QUESTION.NUMBER% = SVG_graph3%QUESTION.NUMBER%+ "
"; Distractor4%QUESTION.NUMBER% = SVG_graph4%QUESTION.NUMBER%+ "
"; randomisation = displayarray(3,1,3,0); randomisation2 = displayarray(4,0,3,1); WhichDistractor = new Array(4); WhichDistractor = Distractor1%QUESTION.NUMBER% WhichDistractor = Distractor2%QUESTION.NUMBER% WhichDistractor = Distractor3%QUESTION.NUMBER% WhichDistractor = Distractor4%QUESTION.NUMBER% NOT = Math.ceil(4*Math.random()); xxx = Math.ceil(4*Math.random()); if ( NOT==1 ) { Answer%QUESTION.NUMBER% = Correct%QUESTION.NUMBER% Correct%QUESTION.NUMBER% = "None of these!" Choice%QUESTION.NUMBER%[xxx] = WhichDistractor[randomisation2]; } else { Choice%QUESTION.NUMBER%[xxx] = Correct%QUESTION.NUMBER% } Choice%QUESTION.NUMBER%[xxx+randomisation] = WhichDistractor[randomisation2]; Choice%QUESTION.NUMBER%[xxx+randomisation] = WhichDistractor[randomisation2]; Choice%QUESTION.NUMBER%[xxx+randomisation] = WhichDistractor[randomisation2]; for ( var yyy=xxx; yyy<=xxx+3; yyy++ ) { if ( yyy>4 ) { Choice%QUESTION.NUMBER%[yyy-4] = Choice%QUESTION.NUMBER%[yyy] } } if ( NOT==1 ) { Choice%QUESTION.NUMBER% = Correct%QUESTION.NUMBER% Choice%QUESTION.NUMBER% = "I don't know!" } else { Choice%QUESTION.NUMBER% = "None of these!" Choice%QUESTION.NUMBER% = "I don't know!" } radio = "" for ( i=1; i<7; i++ ) { if ( i==1 ) {document.write(QuestionText%QUESTION.NUMBER% + EquationText%QUESTION.NUMBER%+QuestionText1%QUESTION.NUMBER%+"

" + radio + Choice%QUESTION.NUMBER%[i] + "
")} else {document.write(radio + Choice%QUESTION.NUMBER%[i] + "
")} } document.write('') document.write('') } if ( document.forms.name == "FEEDBACK" ) {} else {question%QUESTION.NUMBER%()} ]]> "0" INCLUDES NOCASE "was correct"Your answer is correct.]]> "0" INCLUDES NOCASE "is incorrect"Your answer is incorrect.
Your selected graph has a cycle in it, which is not appropriate for this situation.]]>
"0" INCLUDES NOCASE "is wrong"One of the vertices in this graph is not connected to any of the other vertices. This does not fit with the scenario for this question.]]> "0" INCLUDES NOCASE "was incorrect"This may seem appropriate, but look at the edges in your graph and the edges in the given graph... you will see that they do not all coincide with each other.]]> "0" INCLUDES NOCASE "was wrong"Although each vertex is connected to another vertex, your graph is not connected, which is important for the scenario in this question..]]> "0" INCLUDES NOCASE "is not the right answer"Your answer None of these was wrong.
Work through the theory above, retry the question at an appropriate time, and if you are still struggling then seek assisstance from a teacher or tutor.]]>
"0" INCLUDES NOCASE "did not know"You answered Did Not Know.
Work through the theory above, retry the question at an appropriate time, and if you are still struggling then seek assisstance from a teacher or tutor.]]>
OTHERYou didn't select any of the options!
Work through the theory above, retry the question at an appropriate time, and if you are still struggling then seek assisstance from a teacher or tutor.]]>
if (document.forms.name == "FEEDBACK") { Count = document.forms.elements.length document.write(document.forms.elements[Count-1].value) var titleofpopup = "Related material"; var help = wheretolook("%QUESTION.TAGS%","%QUESTION.TOPIC%"); document.write("

"+""+"
") } ]]>