Thanks for pointing out this bug (a regression introduced in V3.7.9).
The fix is to change the line
for id0, id1, edge_label in graph_rep['edges']:
to
for id0, id1, edge_label, *loc in graph_rep['edges']:
in BUILT_IN_PROTOTYPE_directed_graph
and BUILT_IN_PROTOTYPE_undirected_graph
. You need to have Moodle admin rights to edit those prototypes, which are in the CR_PROTOTYPES category at the system level in the question bank.
Alternatively you can customise the question or define your own derived question type with the same fix.
I've pushed the fix to github and it will appear in the next version released to the Moodle question type repository.