def path(s, graph, path):
def end(n):<EOL><INDENT>r = n.r * <NUM_LIT><EOL>s._ctx.oval(n.x-r, n.y-r, r*<NUM_LIT:2>, r*<NUM_LIT:2>)<EOL><DEDENT>if path and len(path) > <NUM_LIT:1> and s.stroke:<EOL><INDENT>s._ctx.nofill()<EOL>s._ctx.stroke(<EOL>s.stroke.r,<EOL>s.stroke.g,<EOL>s.stroke.b,<EOL>s.stroke.a<EOL>)<EOL>if s.name != DEFAULT:<EOL><INDENT>s._ctx.strokewidth(s.strokewidth)<EOL><DEDENT>else:<EOL><INDENT>s._ctx.strokewidth(s.strokewidth*<NUM_LIT:2>)<EOL><DEDENT>first = True<EOL>for id in path:<EOL><INDENT>n = graph[id]<EOL>if first:<EOL><INDENT>first = False<EOL>s._ctx.beginpath(n.x, n.y)<EOL>end(n)<EOL><DEDENT>else:<EOL><INDENT>s._ctx.lineto(n.x, n.y)<EOL><DEDENT><DEDENT>s._ctx.endpath()<EOL>end(n)<EOL><DEDENT>
Visualization of a shortest path between two nodes.