Suppose I have a graph $G$ with vertex set $V$, edge set $E \subseteq {V \choose 2}$, and a weight function $w:E \to \mathbb{R}^{+}$. Is there a nice algorithmic way to decide if there is an assignment of vertices to points in Euclidean space, i.e. a function $f: V(G) \to \mathbb{R}^d$ such that $|f(x)-f(y)| = w( \{x,y \})$ whenever $\{ x, , y\} \in E$, where $|.|$ is the Euclidean norm? There is no harm in insisting that the weight function $d$ respect the triangle inequality.
The question I am most interested in is efficiently deciding whether there exists such a function $f$, for a given graph $G$ and weight function $d$, but it might also be interesting to know how to try to find a map that does the job but with "small distortion". For example, quadratic optimization tells us something...
Cases of special interest: (1) We have a complete graph $G=K_n$, i.e. a finite metric space. (2) The weight function $f$ is constant, i.e. we want to know: is $G$ a unit distance graph in $\mathbb{R}^d$? (Sometimes people want "unit distance graph" to also mean that $f$ is injective, but for my purposes it is fine for vertices to lie on top of each other.) Even the case of $f$ constant and $d=2$ is interesting, as this could be useful for a computational attack on the Hadwiger-Nelson unit coloring problem.
I've noticed that this question is equivalent to asking if a certain real algebraic variety of degree $2$ is nonempty, but I'm not sure if that is a helpful observation, other than it guarantees, for example, that is it algorithmically decidable.