So Laplacian matrix can be calculated by the following equations according to wiki:
$L=BB^{T}$
where $L$ is the Laplacian matrix and $B$ is the incidence matrix.
However, the incidence matrix for an undirected graph (e.g., see the following picture) is something like this:
$$ \begin{pmatrix} 1 & 1 & 1 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 \\ 0 & 0 & 1 & 1 \\ \end{pmatrix} $$
I can't get the correct Laplacian matrix from this incidence matrix. According to the Laplacian matrix wiki, the incidence matrix for this undirected graph should be:
$$ \begin{pmatrix} 1 & 1 & 1 & 0 \\ -1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 1 \\ 0 & 0 & -1 & -1 \\ \end{pmatrix} $$
My question is, when calculating the Laplacian matrix for undirected graph, should I treat it as directed graph for the incidence matrix.

This is a simple graph. If you need the Laplacian matrix and the method is not important, you can use $L=D-A,$ where $D$ is the degree matrix and $A$ the adjacency matrix. Here
\begin{pmatrix} 3 & -1 & -1 & -1 \\ -1 & 1 & 0 & 0 \\ -1 & 0 & 2 & -1 \\ -1 & 0 & -1 & 2 \\ \end{pmatrix}