the application of the main result, in the final section we derive a closed formula for the Wiener polarity index of phenylenes, which are important and extensively studied molecular graphs that contain $4$-cycles. For catacondensed benzenoid graphs similar formula was obtained in [@beh], but it does not coincide with our computations. Therefore, we compute the Wiener polarity index also for these graphs. Moreover, the graphs attaining the extremal values with respect to the Wiener polarity index are characterized.

Formula for calculating the Wiener polarity index
=================================================

In this section we prove the main result of the paper and it enables us to easily compute the Wiener polarity index for a large class of graphs. We start with two definitions.

Let $G$ be a graph and $C$ a $4$-cycle in $G$. An edge $e$ **exits** $C$ if $e$ and $C$ have exactly one common vertex. See Figure \[exit\].

![\[exit\] A cycle $C$ and an edge $e$ such that $e$ exits $C$.](exit.eps)

Obviously, if $G$ does not contain $3$-cycles, then for a given $4$-cycle $C=u_1,u_2,u_3,u_4,u_1$ the number of edges exiting $C$ is exactly $\deg(u_1) + \deg(u_2)+  \deg(u_3)+ \deg(u_4) - 8$.

Let $G$ be a graph without 3-cycles. If $G$ has at least 