@mashkurm, that's an interesting problem. For the purposes of solving this problem, I'll assume you can both get to the pattern-lock screen and identify that you are on it.
The points on the pattern are not individually addressable, so we have no easy way of obtaining their exact locations. We can, however, calculate where they should be. First, let's get the element by resource-id. On a Nexus 5 with Android M, this resource-id is com.android.systemui:id/lockPatternView
I haven't tested this on other devices, so you'll need to check that resource-id on whatever devices you test.
Once you have that element, you can obtain the size. On my device, its location/size is: [84,737][996,1649], or a 912x912 square. The center column and row would then be at 456. The outer columns and rows appear to be 2/3's of the distance between the center point and the edge, so you could calculate what those are as well, e.g. the upper left corner is (152,152) from the upper left corner, or (236, 1148) on my display).
Now that you've obtained the location of all the points, it's relatively simple to construct an algorithm to swipe from point to point, although you should be careful not to lift the swiping finger.
Best of luck, and please let us know how it goes