Millions of 3D points: How to find the 10 of them closest to a given point?

Million points is a small number. The most straightforward approach works here (code based on KDTree is slower (for querying only one point)). Brute-force approach (time ~1 second) #!/usr/bin/env python import numpy NDIM = 3 # number of dimensions # read points into array a = numpy.fromfile(‘million_3D_points.txt’, sep=’ ‘) a.shape = a.size / NDIM, NDIM … Read more

Graph auto-layout algorithm

You will find http://graphdrawing.org/ and this tutorial, by Roberto Tamassia, professor at Brown University, quite helpful. I like a lot Force-Directed Techniques (pp. 66-72 in the tutorial) like the Spring Embedder. You assume there is a spring or other force between any two adjacent nodes and let nature (simulation) do the work 🙂

Common main title of a figure panel compiled with par(mfrow)

This should work, but you’ll need to play around with the line argument to get it just right: par(mfrow = c(2, 2)) plot(iris$Petal.Length, iris$Petal.Width) plot(iris$Sepal.Length, iris$Petal.Width) plot(iris$Sepal.Width, iris$Petal.Width) plot(iris$Sepal.Length, iris$Petal.Width) mtext(“My ‘Title’ in a strange place”, side = 3, line = -21, outer = TRUE) mtext stands for “margin text”. side = 3 says to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)