Random graphs are a vast research area of graph theory, but I just need something
simple for a few visualizations. I want to make graphs that represent a rail network between cities, such that neighbouring cities
are somewhat connected, and there aren't any long edges that jump halfway across the graph.

Points

The cities or nodes of the graph are randomly generated 2D points in [0,1]. But placing the cities purely at random results in
clusters which make it difficult to distinguish individual nodes.

type Point struct {
X, Y float64
}
type Edge struct {
U, V Point
}

I can prevent this by finding the closest existing node before adding another, and rejecting the new point if it would be too close. This is
an O(n²) algorithm which is fine for my small n (but there are interesting possible optimizations).
There's a danger this loop won't terminate, so I added a hard limit.