// Numbas version: exam_results_page_options {"name": "Are these graphs isomorphic?", "extensions": ["permutations", "graph-theory"], "custom_part_types": [{"source": {"pk": 2, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/2/edit"}, "name": "List of numbers", "short_name": "list-of-numbers", "description": "

The answer is a comma-separated list of numbers.

\n

The list is marked correct if each number occurs the same number of times as in the expected answer, and no extra numbers are present.

\n

You can optionally treat the answer as a set, so the number of occurrences doesn't matter, only whether each number is included or not.

", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "join(\n if(settings[\"correctAnswerFractions\"],\n map(let([a,b],rational_approximation(x), string(a/b)),x,settings[\"correctAnswer\"])\n ,\n settings[\"correctAnswer\"]\n ),\n settings[\"separator\"] + \" \"\n)", "hint": {"static": false, "value": "if(settings[\"show_input_hint\"],\n \"Enter a list of numbers separated by {settings['separator']}.\",\n \"\"\n)"}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "bits:\nlet(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)\n\nexpected_numbers:\nlet(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)\n\nvalid_numbers:\nif(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )\n\nis_sorted:\nassert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )\n\nincluded:\nmap(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentThe separate items in the student's answer

", "definition": "let(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)"}, {"name": "expected_numbers", "description": "", "definition": "let(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)"}, {"name": "valid_numbers", "description": "

Is every number in the student's list valid?

", "definition": "if(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )"}, {"name": "is_sorted", "description": "

Are the student's answers in ascending order?

", "definition": "assert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )"}, {"name": "included", "description": "

Is each number in the expected answer present in the student's list the correct number of times?

", "definition": "map(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentHas every number been included the right number of times?

", "definition": "all(included)"}, {"name": "no_extras", "description": "

True if the student's list doesn't contain any numbers that aren't in the expected answer.

", "definition": "if(all(map(x in expected_numbers, x, interpreted_answer)),\n true\n ,\n incorrect(\"Your answer contains \"+extra_numbers[0]+\" but should not.\");\n false\n )"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "if(lower(studentAnswer) in [\"empty\",\"\u2205\"],[],\n map(\n if(settings[\"allowFractions\"],parsenumber_or_fraction(x,notationStyles), parsenumber(x,notationStyles))\n ,x\n ,bits\n )\n)"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=\"\",fail(\"You have not entered an answer\"),false);\napply(valid_numbers);\napply(included);\napply(no_extras);\ncorrectif(all_included and no_extras)"}, {"name": "notationStyles", "description": "", "definition": "[\"en\"]"}, {"name": "isSet", "description": "

Should the answer be considered as a set, so the number of times an element occurs doesn't matter?

", "definition": "settings[\"isSet\"]"}, {"name": "extra_numbers", "description": "

Numbers included in the student's answer that are not in the expected list.

", "definition": "filter(not (x in expected_numbers),x,interpreted_answer)"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The list of numbers that the student should enter. The order does not matter.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "allowFractions", "label": "Allow the student to enter fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "correctAnswerFractions", "label": "Display the correct answers as fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "isSet", "label": "Is the answer a set?", "help_url": "", "hint": "If ticked, the number of times an element occurs doesn't matter, only whether it's included at all.", "input_type": "checkbox", "default_value": false}, {"name": "show_input_hint", "label": "Show the input hint?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": true}, {"name": "separator", "label": "Separator", "help_url": "", "hint": "The substring that should separate items in the student's list", "input_type": "string", "default_value": ",", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}, {"source": {"pk": 197, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/197/edit"}, "name": "Write a permutation in two-line form", "short_name": "write-a-permutation-in-two-line-form", "description": "

The student must write out a permutation (an element of $S_n$) in two-line form: the top line always contains the numbers 1 to $n$, and on the bottom line they must write the numbers that they are mapped to.

", "help_url": "", "input_widget": "matrix", "input_options": {"correctAnswer": "matrix(map(settings[\"correctAnswer\"][i],i,1..settings[\"size\"]))", "hint": {"static": true, "value": ""}, "allowResize": {"static": true, "value": false}, "numRows": {"static": true, "value": 1}, "numColumns": {"static": false, "value": "settings[\"size\"]"}, "parseCells": {"static": true, "value": true}, "allowedNotationStyles": {"static": true, "value": ["plain"]}, "allowFractions": {"static": true, "value": false}, "showBrackets": {"static": true, "value": true}, "rowHeaders": {"static": false, "value": "[]"}, "columnHeaders": {"static": false, "value": "map(string(n),n,1..settings[\"size\"])"}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\napply(valid_permutation);\ncorrectif(student_permutation=settings[\"correctAnswer\"])\n\nstudent_numbers:\nlist(studentAnswer[0])\n\nstudent_permutation:\npermutation(map(x-1,x,student_numbers))\n\nvalid_permutation:\n assert(all(map(isint(x) and x>=1 and x<=settings[\"size\"], x, student_numbers)),\n fail(\"Your answer is not a valid permutation: each entry must be one of the numbers 1 \u2026 {settings['size']}.\")\n );\n assert(len(set(student_numbers))=settings[\"size\"],\n fail(\"Your answer is not a valid permutation: some entries occur more than once.\")\n )\n\ninterpreted_answer:\nstudent_permutation", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "apply(valid_permutation);\ncorrectif(student_permutation=settings[\"correctAnswer\"])"}, {"name": "student_numbers", "description": "

The numbers that the student typed.

", "definition": "list(studentAnswer[0])"}, {"name": "student_permutation", "description": "", "definition": "permutation(map(x-1,x,student_numbers))"}, {"name": "valid_permutation", "description": "", "definition": " assert(all(map(isint(x) and x>=1 and x<=settings[\"size\"], x, student_numbers)),\n fail(\"Your answer is not a valid permutation: each entry must be one of the numbers 1 \u2026 {settings['size']}.\")\n );\n assert(len(set(student_numbers))=settings[\"size\"],\n fail(\"Your answer is not a valid permutation: some entries occur more than once.\")\n )"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "student_permutation"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "size", "label": "Size", "help_url": "", "hint": "", "input_type": "code", "default_value": "", "evaluate": true}], "public_availability": "always", "published": true, "extensions": []}, {"source": {"pk": 1, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/1/edit"}, "name": "Yes/no", "short_name": "yes-no", "description": "

The student is shown two radio choices: \"Yes\" and \"No\". One of them is correct.

", "help_url": "", "input_widget": "radios", "input_options": {"correctAnswer": "if(eval(settings[\"correct_answer_expr\"]), 0, 1)", "hint": {"static": true, "value": ""}, "choices": {"static": true, "value": ["Yes", "No"]}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(studentanswer=correct_answer,\n correct(),\n incorrect()\n)\n\ninterpreted_answer:\nstudentAnswer=0\n\ncorrect_answer:\nif(eval(settings[\"correct_answer_expr\"]),0,1)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=correct_answer,\n correct(),\n incorrect()\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer=0"}, {"name": "correct_answer", "description": "", "definition": "if(eval(settings[\"correct_answer_expr\"]),0,1)"}], "settings": [{"name": "correct_answer_expr", "label": "Is the answer \"Yes\"?", "help_url": "", "hint": "An expression which evaluates to true or false.", "input_type": "mathematical_expression", "default_value": "true", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Are these graphs isomorphic?", "tags": [], "metadata": {"description": "

The student is shown two labelled graphs. They are asked:

\n\n

The number of vertices is always equal, so this is a gimme.

\n

If the edges or degree sequences are different, the student is expected to realise that there cannot be an isomorphism.

\n

If these values are the same, then there will be an isomorphism (else the question is a bit too tricky).

\n

Numbas expects a particular isomorphism, but there may be more than one, all of which would be accepted.

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

Consider the following labelled graphs, and their adjacency matrices:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$\\Gamma_1$$\\Gamma_2$
{draw(g1)}{draw(g2)}
$\\var{adjacency_matrix(g1)}$$\\var{adjacency_matrix(g2)}$
\n

", "advice": "

The vertices are the labelled \"dots\". In each graph there are {n+1} vertices.

\n

The edges are the lines connecting vertices. In $\\Gamma_1$ there are {len(edges(g1))} edges, and in $\\Gamma_2$ there are {len(edges(g2))}.

\n

The degree of a vertex is the number of edges incident to it.

\n

The degree sequence is a list of the degrees of all of the vertices of a graph, usually ordered from smallest to largest. The degree sequence of $\\Gamma_1$ is {join(sort(vertex_degrees(g1)),\", \")}.

\n

Similarly, the degree sequence of $\\Gamma_2$ is {join(sort(vertex_degrees(g2)),\", \")}. This is because, for example, {len(filter(i=2, i, vertex_degrees(g2)))} of the vertices in $\\Gamma_2$ have degree 2, {len(filter(i=3, i, vertex_degrees(g2)))} of the vertices in $\\Gamma_2$ have degree 3, and so on.

\n

Two graphs $\\Gamma_1, \\Gamma_2$ are isomorphic if there is a bijection from the vertex set of $\\Gamma_1$ to the vertex set of $\\Gamma_2$ that maps a pair of vertices joined by an edge to a pair of vertices joined by an edge, and that maps a pair of vertices not joined by an edge to a pair of vertices not joined by an edge. If there is no such bijection then the graphs are not isomorphic.

\n

There cannot be a graph isomorphism between two graphs if they have different numbers of vertices, different numbers of edges, or different degree sequences.

\n

{advice}

", "rulesets": {}, "extensions": ["graph-theory", "permutations"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"g1": {"name": "g1", "group": "Ungrouped variables", "definition": "set_vertex_labels( graph(map(edge(from,to),[from,to],\n [[0,1],[0,2]+[0,n-2],[0,n-1]]+\n flatten(map(map([j,k],k,shuffle(j+1..n-1)[0..random(1,2)]),j,1..n-1))\n)), map(string(x),x,1..n))", "description": "

The graph $\\Gamma_1$.

\n

Vertex 1 will be adjacent to four others.

\n

The remaining vertices will each be adjacent to either one or two later vertices.

\n

In this way, no vertex will be adjacent to more than four others.

", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(6..8)", "description": "

Each graph will contain n vertices.

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

The vertices of graph 2 will be mapped by this permutation to those of graph 1.

", "templateType": "anything", "can_override": false}, "diff_degree": {"name": "diff_degree", "group": "Ungrouped variables", "definition": "let(\n degrees, vertex_degrees(g1),\n d, max(degrees),\n v, indices(degrees,d)[0],\n edges, edges(g1),\n e, random(filter(not (v in ends(e)),e,edges)),\n nedges,map(if(e2=e,edge(v,to(e)),e2),e2,edges),\n graph(nedges)\n)", "description": "

Take g1 and find the vertex $v$ with highest degree. Move an edge connecting two other vertices so that one end is on $v$ instead. This changes the degree sequence, so produces a graph not isomorphic to g1.

", "templateType": "anything", "can_override": false}, "fewer_edges": {"name": "fewer_edges", "group": "Ungrouped variables", "definition": "let(\n edges, edges(g1),\n degrees,vertex_degrees(g1),\n ok_edges,filter(degrees[from(e)]>1 and degrees[to(e)]>1,e,edges),\n e,random(ok_edges),\n graph(filter(e2<>e,e2,edges))\n)", "description": "

Remove an edge from g1 to produce a non-isomorphic graph. Only edges connecting vertices with degree at least 2 are considered, so the graph remains connected.

", "templateType": "anything", "can_override": false}, "g2": {"name": "g2", "group": "Ungrouped variables", "definition": "set_vertex_labels(\n auto_layout(permute_vertices(\n vertex_perm, \n if(is_isomorphic,\n graph(edges(g1)),\n random(diff_degree, fewer_edges)\n )\n ))\n ,\n map(string(x),x,1..n)\n)", "description": "

The graph $\\Gamma_2$. If it should be isomorphic, just take g1, otherwise pick from the non-isomorphic options.

\n

Permute the vertices according to the permutation vertex_perm, and lay the vertices out again.

", "templateType": "anything", "can_override": false}, "advice_none": {"name": "advice_none", "group": "Ungrouped variables", "definition": "\"

Therefore there is no isomorphism between $\\\\Gamma_1$ and $\\\\Gamma_2$.

\"", "description": "

The advice shown if the graphs are not isomorphic.

", "templateType": "long string", "can_override": false}, "advice_isomorphism": {"name": "advice_isomorphism", "group": "Ungrouped variables", "definition": "\"

Since these are all the same for $\\\\Gamma_1$ and $\\\\Gamma_2$, we might be able to find an isomorphism. Indeed, we can map vertex 1 of $\\\\Gamma_1$ to vertex {vertex_perm[1]} of $\\\\Gamma_2$, we can map vertex 2 to vertex {vertex_perm[2]}, vertex 3 to vertex {vertex_perm[3]}, and so on. Therefore a valid isomorphism is

\\n

\\\\[ \\\\var{twoline(vertex_perm)} \\\\]

\\n

(Note: there may be more than one isomorphism.)

\"", "description": "

The advice shown if the graphs are isomorphic.

", "templateType": "long string", "can_override": false}, "advice": {"name": "advice", "group": "Ungrouped variables", "definition": "if(is_isomorphic, advice_isomorphism, advice_none)", "description": "

The final line of the advice, describing the isomorphism if there is one, or stating that there is none.

", "templateType": "anything", "can_override": false}, "is_isomorphic": {"name": "is_isomorphic", "group": "Ungrouped variables", "definition": "random(true,false)", "description": "

Should $\\Gamma_1$ and $\\Gamma_2$ be isomorphic?

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["is_isomorphic", "n", "g1", "diff_degree", "fewer_edges", "g2", "vertex_perm", "advice_none", "advice_isomorphism", "advice"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Compare the properties of $\\Gamma_1$ and $\\Gamma_2$.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Number of verticesNumber of edgesDegree sequence
$\\Gamma_1$[[0]][[2]][[4]]
$\\Gamma_2$[[1]][[3]][[5]]
", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "Vertices in $\\Gamma_1$", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "len(vertices(g1))", "maxValue": "len(vertices(g1))", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Vertices in $\\Gamma_2$", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "len(vertices(g2))", "maxValue": "len(vertices(g2))", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Edges in $\\Gamma_1$", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "len(edges(g1))", "maxValue": "len(edges(g1))", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "Edges in $\\Gamma_2$", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "len(edges(g2))", "maxValue": "len(edges(g2))", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "list-of-numbers", "useCustomName": true, "customName": "Degree sequence of $\\Gamma_1$", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "sort(vertex_degrees(g1))", "allowFractions": false, "correctAnswerFractions": false, "isSet": false, "show_input_hint": false}}, {"type": "list-of-numbers", "useCustomName": true, "customName": "Degree sequence of $\\Gamma_2$", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "sort(vertex_degrees(g2))", "allowFractions": false, "correctAnswerFractions": false, "isSet": false, "show_input_hint": false}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Are the graphs $\\Gamma_1$ and $\\Gamma_2$ isomorphic?

\n

[[0]]

\n

If so, write down an isomorphism $\\varphi : \\Gamma_1 \\to \\Gamma_2$.

\n

If no such isomorphism exists, write 0 in every box below.

\n

[[1]]

", "gaps": [{"type": "yes-no", "useCustomName": true, "customName": "Is there an isomorphism?", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correct_answer_expr": "is_isomorphic"}}, {"type": "write-a-permutation-in-two-line-form", "useCustomName": true, "customName": "Write an isomorphism", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "all_zero:\n all(map(x=0,x,student_numbers))\n\nstudent_permutation_is_isomorphism:\n let(\n a1, adjacency_matrix(g1),\n a2, adjacency_matrix(g2),\n p, student_permutation,\n all(map(\n all(map(a1[y-1][x-1]=a2[p[y]-1][p[x]-1],x,1..n)),\n y,\n 1..n\n ))\n )\n\nmark:\n if(is_isomorphic,\n correctif(student_permutation_is_isomorphism)\n ,\n correctif(all_zero)\n )", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "if(is_isomorphic,\n vertex_perm\n,\n repeat(0,n+1)\n)", "size": "n"}}], "sortAnswers": false}], "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/"}]}