function add_edge(graph, u, v, weight=1, directed=false):

   graph[u].append((v, weight))
   if not directed:
      graph[v].append((u, weight)) # undirected: add both directions
 # directed: a road that only goes one way
 # weighted: the edge carries a cost, e.g. distance or time
