Hi,
Depends what you mean by “a graph”.
The code sample below (from the tutorial) show you how to access the first elements:
print(loss.grad_fn)  # MSELoss
print(loss.grad_fn.next_functions[0][0])  # Linear
print(loss.grad_fn.next_functions[0][0].next_functions[0][0])  # ReLU

Basically grad_fn from a Variable gives you the Function that generated this Variable.
From a Function, you should use .next_functions to see which functions were before this one in the graph.