In the paper Dissimilarity in Graph-Based Semi-Supervised Classification, there are few things I could not understand. Given that $x_1, x_2,..., x_n$ are the vector representation of $n$ items, $f : X \rightarrow \mathbb{R}$ is the discriminant function, and $w_{ij}$ are all non-negative,
why is $ \frac{1}{2} \sum_{i, j = 1}^n w_{ij} (f(x_i)- f(x_j))^2$ convex w.r.t to $f$?
Also, why does changing any $w_{ij}$ to negative value make it non-convex?
I read on wikipedia that
"A twice-differentiable function of a single variable is convex if and only if its second derivative is nonnegative on its entire domain"
But I don't understand derivative should be take w.r.t to what?