// Numbas version: exam_results_page_options {"name": "JSXGraph: make a spanning tree", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "JSXGraph: make a spanning tree", "tags": [], "metadata": {"description": "

The student must make a spanning tree of the complete graph $K_5$. They can tick boxes to include or exclude edges, or toggle them by clicking on a visual representation of the graph.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

A spanning tree of a graph is a subset of its edges which includes every vertex but has no cycles.

\n

Make a spanning tree of this graph. To include an edge in your spanning tree, tick the corresponding box below, or click on an edge in the diagram to toggle it. Excluded edges are faded out.

\n

{diagram}

", "advice": "", "rulesets": {}, "extensions": ["jsxgraph"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"diagram": {"name": "diagram", "group": "Ungrouped variables", "definition": "jsxgraph(400,400,[-2,2,2,-2],\n // a circle of points\n map(\n [\n 'point',\n [cos(i*2pi/num_points), sin(i*2pi/num_points)], \n [\"id\": \"p{i}\", \"name\": vertex_names[i], \"fixed\": true]\n ],\n i,\n 0..num_points-1\n )+\n // every possible edge between the points\n map(\n [\n 'segment',\n ['p{i}','p{j}'],\n [\"id\":\"l_{i}_{j}\"],\n // when an edge is clicked, toggle its opacity \n // - this is used to represent whether the edge is included\n [\"up\": \"l_{i}_{j}.strokeopacity = 1.2 - l_{i}_{j}.strokeopacity;\"\n ]\n ],\n [i,j],\n combinations(0..num_points-1,2)\n ),\n [\"grid\": false, \"axis\": false]\n)", "description": "", "templateType": "anything", "can_override": false}, "num_points": {"name": "num_points", "group": "Ungrouped variables", "definition": "5", "description": "", "templateType": "anything", "can_override": false}, "vertex_names": {"name": "vertex_names", "group": "Ungrouped variables", "definition": "map(capitalise(letterordinal(i)),i,0..num_points-1)", "description": "", "templateType": "anything", "can_override": false}, "q": {"name": "q", "group": "Ungrouped variables", "definition": "is_spanning_tree([[false,true,true],[false,false,false],[false,false,false]])", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["diagram", "num_points", "vertex_names", "q"], "variable_groups": [], "functions": {"is_spanning_tree": {"parameters": [["adjacency", "list"]], "type": "boolean", "language": "javascript", "definition": "var visited = {};\nvar num_visited = 0;\nvar symm = adjacency.map(function(row,i) { return row.map(function(x,j) { return i0.5, false),\n j,\n 0..num_points-1\n ),\n i,\n 0..num_points-1\n )\n\nmark:\n correctif(is_spanning_tree(studentanswer))", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": "5", "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": false, "shuffleAnswers": false, "displayType": "checkbox", "warningType": "none", "showCellAnswerState": true, "markingMethod": "all-or-nothing", "choices": "vertex_names", "matrix": "repeat([1]+repeat(0,num_points-1),num_points)", "layout": {"type": "strictlowertriangle", "expression": ""}, "answers": "vertex_names"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "http://localhost:8000/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "http://localhost:8000/accounts/profile/1/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}