def degrees(graph):
  """Returns a list of node degrees in a ProgramGraph.

  Args:
    graph: A ProgramGraph.

  Returns:
    An (unsorted) list of node degrees (in-degree plus out-degree).
  """
  return [len(graph.neighbors(node)) for node in graph.all_nodes()]