# Context-free path querying with all-path semantics using matrices with sets of intermediate vertices

**Journal**: Scientific and Technical Journal of Information Technologies, Mechanics and Optics (Vol.21, No. 4)

**Publication Date**: 2021-08-24

**Authors** : Azimov R.Sh. Grigorev S.V.;

**Page** : 499-505

**Keywords** : path querying; linear algebra; context-free grammars; matrix multiplication; graph databases; GraphBLAS;

### Abstract

The study considers the problem of context-free path querying with all-path query semantics. This problem consists in finding all paths of the graph, the labels on the edges of which form words from the language generated by the input context-free grammar. There are two approaches to evaluate context-free path queries using linear algebra operations: matrix multiplication-based and the Kronecker product-based. But until now, there is no algorithm using the matrix multiplication capable of handling context-free path queries with the most complex all-path query semantics, in which the all paths that match the query must be provided. The paper proposes the algorithm for context-free path query evaluation using the matrix multiplication, which is capable of processing queries with the all-path query semantics. In the adjacency matrix of the input graph for each pair of vertices, we store additional information about the paths found between these vertices in the form of a set of possible intermediate vertices. At the first stage, a set of matrices is constructed that store such information about all paths that satisfy the input query. At the second stage, all queried paths are restored from the constructed set of matrices. The proposed algorithm was implemented in C++ and a comparison was made with other most efficient algorithms for evaluating context-free path queries, namely with the matrix-based algorithm that allows us to find only one such path, and with the Kronecker product-based algorithm that allows us to find all such paths in the graph. The results of the experimental study showed that the proposed algorithm is significantly more efficient in restoring the queried paths, but in some cases it consumes a significantly larger amount of memory than the algorithm based on the Kronecker product. The described algorithm can be applied in static code analysis, bioinformatics, network analysis, as well as in graph databases, when it is required to find all possible dependencies in the data presented in the form of a labeled graph.

Other Latest Articles

- A study of the stability of information and telecommunication networks under conditions of stochastic percolation of nodes
- A factor model for detection and recognition of human face contours and elements
- Evaluation of the applicability of asynchronous programming methods to the data consistency problem in a microservices environment
- Nature-inspired metaheuristic scheduling algorithms in cloud: a systematic review
- Features of the morphology of micro- and nanoporous copper and silver films synthesized by substitution reaction for photocatalytic application

Last modified: 2021-08-24 16:47:40