What is the smallest number of times that you need to lift the pencil to draw a graph? he problem : Is it possible to draw a given graph without lifting pencil from the paper, however I want to know the least number of pencil lifting when the graph is not Eulerian, is there a math formula for that?


regarding second image, it's not eulerian , and the least number of pen lifting is 1 , however how to know using math formula .  
 A: For any connected graph, the formula is
$$
   \max\left\{0, \frac{\text{(# of odd vertices)}}{2}-1\right\}.
$$
I'm including the $\max\{0, -\}$ to take Eulerian graphs into account, which have $0$ odd vertices and can be drawn without lifting the pencil at all.
To see that the formula works in the other cases, start with any connected but non-Eulerian graph, split up the odd vertices into pairs, and for all but one of the pairs, add a new edge between them.
(This may create a multigraph if the vertices were already adjacent, but that's fine.) 
The new graph is, in your terminology, semi-Eulerian: it is connected with only two odd vertices, and therefore it has an Eulerian path. The new graph can be drawn without lifting the pencil even once, by following that path.
Following the same path, but skipping the edges we added, gives a way to draw the old graph. Every time we get to one of the edges we added (which don't exist in the original graph), we lift our pencil at one of the endpoints of the fake edge, and put it back down at the other endpoint. If there are $k$ odd vertices, there are $\frac k2$ pairs, so there are $\frac k2-1$ fake edges, and so we lift the pencil $\frac k2 - 1$ times.
We can't do better. Whenever the pencil passes through a vertex normally, it traces two of the edges out of the vertex - so if the vertex is odd, this won't take care of all of its edges. Therefore any odd vertex has to be the start of the path, the end of the path, a place where we lifted the pencil, or a place where we put the pencil back down. If we lift the pencil $\ell$ times, we can only deal with $2\ell+2$ odd vertices.

If the graph is not connected, then we can use the formula above over each connected component, add up the results, and finally add $$(\text{# of connected components})-1,$$ since of course we will have to lift the pencil to go from one connected component to the next.
