We consider the following problem: given a labelled directedgraphG anda regularexpressionR, find all pairs of nodesconnectedby a simplepathsuchthattheconcatenationof thelabelsalongthepathsatisfiesR.Theproblem is motivated by the observationthat many recursive queriescan be expressedin this form, and by the implementationof a querylanguage,G+,basedon thisobservation. We showthat theproblemis in generalintractable, but presentan algorithmthanruns in polynomialtime in the sizeof the graphwhentheregularexpressionandthe graph are free of conflicts. We also presenta classof languageswhoseexpressionscan alwaysbe evaluatedin time polynomialin the sizeof both the databaseand the expression,and characterizesyntacticallythe expressions for suchlanguages.
Alberto O. Mendelzon, Peter T. Wood