16. A non-transitory computer-readable storage medium containing a computer-readable code that when read by a computer causes the computer to perform a method for multi-query optimization, the method comprising: identifying an input query set comprising a plurality of input queries over a given data set, each query comprising a graph pattern comprising at least one subject node, predicate edge and object node triple; and clustering the plurality of input queries though incremental pair-wise merging based on structural similarities between graph patterns and query search cost optimization realized by a given merged graph pattern to generate an optimized query set comprising at least one query cluster by using linegraphs, wherein clustering the plurality of inputs further comprises: identifying a plurality of candidate merger inputs, each candidate merger input comprising an input query or an existing query cluster resulting from a previous pair-wise merging, a merger input graph pattern and a set of predicate edges contained in the merger input graph pattern; and selecting a pair of merger inputs from the plurality of candidate merger inputs having a maximum overlap in the sets of predicate edges associated with the selected pair of merger inputs; and each linegraph comprises: linegraph nodes, each linegraph node corresponding to a given predicate edge in the input queries; linegraph edges between pairs of linegraph nodes that are associated with predicate edges sharing a common subject node or object node in the input queries; and a label associated with each linegraph edge and indicating a type of join between subject nodes and object nodes.
17. The non-transitory computer-readable medium of claim 16 , wherein clustering the plurality of inputs further comprises generating a linegraph for each merger input in the selected pair of merger inputs by: creating a linegraph node for each predicate edge in the set of predicate edges associated with the merger input; identifying pairs of linegraph nodes where for each identified pair of linegraph nodes the subject node or object node contained in the merger input graph pattern and connected by a first predicate in that identified pair of linegraph nodes and the subject node or object node contained in the merger input graph pattern and connected by a second predicate in that identified pair of linegraph nodes comprise a common variable; and creating linegraph edges between each identified pair of linegraph nodes.