A source coding problem over a noiseless broadcast channel where the source is pre-informed about the contents of the cache of all receivers, is an index coding problem. Furthermore, if each message is requested by one receiver, then we call this an index coding problem with a unicast message setting. This problem can be represented by a directed graph. In this paper, we first define a structure (we call generalized interlinked cycles (GIC)) in directed graphs. A GIC consists of cycles which are interlinked in some manner (i.e., not disjoint), and it turns out that the GIC is a generalization of cliques and cycles. We then propose a simple scalar linear encoding scheme with linear time encoding complexity. This scheme exploits GICs in the digraph. We prove that our scheme is optimal for a class of digraphs with message packets of any length. Moreover, we show that our scheme can outperform existing techniques, e.g., partial clique cover, local chromatic number, composite-coding, and interlinked cycle cover.