// Numbas version: exam_results_page_options {"name": "Graphs: Write the adjacency matrix of this graph", "extensions": ["graph-theory-v1"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Graphs: Write the adjacency matrix of this graph", "tags": [], "metadata": {"description": "

The student is shown one graph, and asked to type the adjacency matrix

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

You will be shown three graphs below, each with vertices labelled from $1$ to $\\var{n+1}$.

\n

Consider the following graph:

\n

{max_width(30,graph)}

\n

Write down the adjacency matrix of this graph.

\n

The $i$th row or column of your matrix should correspond to the vertex labelled $i$.

", "advice": "

The adjacency matrix $M$ of a graph $G$ has $ij$th entry $1$ whenever there is an edge from vertex $i$ to vertex $j$.

\n

The $ij$th entry is $0$ otherwise.

", "rulesets": {}, "extensions": ["graph-theory-v1"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"graph": {"name": "graph", "group": "Ungrouped variables", "definition": "draw_graph_from_adjacency(mat, map(string(i), i, 1..n+1))", "description": "

Graphs built fron the adjacency matrices

", "templateType": "anything", "can_override": false}, "mat": {"name": "mat", "group": "Ungrouped variables", "definition": "matrix(reorder( \n [reorder(a[0], vertex_perm)] +\n map(\n reorder(map(a[i][j-i], i, 0..j-1) + a[j], vertex_perm), j, 1..n\n ), vertex_perm\n ))", "description": "

The qth matrix takes entries from a[q] as its upper triangle, then duplicates this for the bottom triangle to make a symmetric matrix.

", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "7", "description": "

Each graph will contain n+1 vertices.

\n

n should be at least 4. My view is that it looks good when n is around 7 to 8.

", "templateType": "anything", "can_override": false}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "map([0] + repeat(random(0,0,0,1,1), n-j), j, 0..n-1)\n+ [[0]]\n", "description": "

The top-right triangle of the adjacency matrices. The bottom-left triangle will be the transpose of this, so that the matrices are symmetrical.

\n

The first rows are all distinct, so no two adjacency matrices are the same.

\n

Change the number of 0s and 1s to get a more/less dense matrix.

", "templateType": "anything", "can_override": false}, "vertex_perm": {"name": "vertex_perm", "group": "Ungrouped variables", "definition": "shuffle(0..n)", "description": "

The labels of vertices will be permuted. This is so it isn't obvious that the first row of the adjacency matrices are different.

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["n", "a", "vertex_perm", "graph", "mat"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "matrix", "useCustomName": false, "customName": "", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "correctAnswer": "{mat}", "correctAnswerFractions": false, "numRows": "{n+1}", "numColumns": "{n+1}", "allowResize": false, "tolerance": 0, "markPerCell": true, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Sam Mutter", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/9360/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Sam Mutter", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/9360/"}]}