Could you write down on paper what the gradient and second order gradient be for this case?  (with a small x and less edges)
Does that match what you expect?
Note that the function passes gradcheck. So the finite difference agrees with pytorch that the gradient should be 0 here:
import torch

# coordinates
x = torch.tensor( [[0.0,0.0,0.0],
[1.0,0.0,0.0],
[0.0,1.0,0.0],
[0.0,0.0,1.0],
[1.0,1.0,1.0]], dtype=torch.double, requires_grad=True)

def fn(x):
    # Graphs edge connectivity
    edges = torch.tensor(
    [[0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4],
    [1, 2, 3, 0, 2, 3, 4, 0, 1, 3, 4, 0, 1, 2, 4, 1, 2, 3]])

    # Compute weight
    row, col = edges
    dist_sq = torch.sum((x[col] - x[row]).pow(2), dim=1)
    weight = dist_sq.pow(-1)

    # Compute 1st order derivative: This will have some non-null outputs
    ones = torch.ones_like(weight)
    qx = torch.autograd.grad(weight, x, grad_outputs=ones, create_graph=True)[0]
    return qx

torch.autograd.gradcheck(fn, x) # Ensure that grad(fn(x), x) is correct.