I'm looking for a C++ library or a combination of libraries.
the idea is that robots move around and they can only know distance between the closest 3. the problem is to find relative (x,y) location of all of the nodes.
My solution would be to build triangles from distances (is there a library for that) then make a map from those triangles (library?)
If this is a real world application, the graph will never be consistent. I mean, if you start constructing triangles from one end, when you close the loop, it will never match. "Closing the loop" is a hot research topic in robotics. Your problem is somehow simpler than the general case though, you might have luck, just throwing the distances at a non-linear least squares solver. Googling exactly that returned this ceres-solver.
With a general purpose non-linear least squares solver, you need to define your solution vector, and the objective function. In your case, let's say that you have 100 nodes. That means you're looking for 200 values; x and y values for each node. That 200 element long vector is your solution vector. Your objective function is the assignment of those 200 hundred elements, such that the distances of the known pairs in the assignment match your available data as closely as possible. For 100 nodes, 3 known distances each, you have 300 equations you want to minimize the error of. I'm afraid you'll have to figure out the ceres API to apply this solution to your problem, since I have no personal experience with it.
As a side note, going from a noise-free solution, relying on the data to be consistent to one that involves noise will essentially be starting from scratch...