Background technology
Along with web technologies and new data management and the development of memory technology, the data of graph structure become more and more general.Graph structure is the complex relationship between the expressive object clearly.Many application need to be processed the data of graph structure, such as the protein Internet [2] in semantic net [1], the bioinformatics and the social networks in the social science etc.Single or multiple Large Graph data are effectively stored and analyzed to these application requirements.
When the analysis chart data, often need to inquire about figure, different from the inquiry in the relational database, the general graph-based structure of the inquiry of figure.The inquiry relevant with figure can be divided into three classes substantially.The first kind is the inquiry about the path, requires to find out two shortest paths between the summit such as shortest path query [35], and whether accessibility inquiry [5 – 8] requires to judge has the path to link to each other between two summits.Equations of The Second Kind is relevant with the summit, and for example nearest-neighbors summit inquiry [9,10] is searched and immediate neighbours summit, given summit.The 3rd class is subgraph inquiry [11,12], requires to find out the subgraph structure that needs, and for example Subgraph Isomorphism, subgraph match and frequent subgraph excavate, and compare the inquiry on path and summit, and the subgraph inquiry more can be excavated the information of figure.These query manipulations are bases of many application, so these inquiries of fast processing are very important.
Traditionally, subgraph match refers to Subgraph Isomorphism.Given query graph Q and data plot G, Subgraph Isomorphism requires to find out the subgraph that same structure is arranged with Q among the G.The main application of Subgraph Isomorphism aspect database is that frequent subgraph excavates.Under many circumstances, especially WWW develop rapidly now, a lot of application needs to process single large-scale data plot usually, such as linking parsing, social networks and semantic net.For efficiently management and analysis large data figure, develop a kind of new subgraph match problem in original Subgraph Isomorphism problem gradually, this subgraph match problem is inquired about label figure.Label figure refers among the figure that there is a label on each summit or limit, and in social networks, job overall can be used as the label on each user summit.The pattern that query graph Q representative will be inquired about, the summit of query graph is also with label.The subgraph match problem requires the matching result of inquiry to satisfy simultaneously label condition and structural condition: (1) label condition, and the label on summit is identical with the label on coupling summit among the G among the Q; (2) structural condition to the limit among the Q, will have the path to link to each other between the summit of corresponding coupling among the G.Therefore Subgraph Isomorphism requires the strict coupling on limit and limit, and the limit in this subgraph match problem requirement query graph and the route matching in the data plot.
1, the existing algorithm of searching subgraph match is not considered the problem of top-k.In the face of large data figure, the matching result collection of given inquiry is very huge, therefore adopts existing subgraph match algorithm to find out whole couplings, and then obtaining top-k result by ordering can be very consuming time.
2, existing top-k join algorithm can directly be used for finding the solution the subgraph match of top-k, but analysis and the experiment of this algorithm shown that this algorithm does not have better performance, especially for large-scale data plot.Existing top-k Sub-tree Matching algorithm can't be directly used in finds the solution the top-k subgraph match.
[1]B.Berendt,A.Hotho,and?G.Stumme.Towards?semantic?web?mining.The?Semantic?Web―ISWC2002,pages264–278,2002.
[2]J.Van?Helden,A.Naim,R.Mancuso,M.Eldridge,L.Wernisch,D.Gilbert,S.J.Wodak,et?al.Representing?and?analysing?molecular?and?cellular?functionusing?the?computer.Biological?Chemistry,381(9/10):921–936,2000.
[3]E.P.Chan?and?H.Lim.Optimization?and?evaluation?of?shortest?path?queries.The?VLDB?Journal―The?International?Journal?on?Very?Large?Data?Bases,16(3):343369,2007.
[4]N.Jing,Y.W.Huang,and?E.A.Rundensteiner.Hierarchical?encoded?path?views?for?path?query?processing:An?optimal?model?and?its?performance?evaluation.Knowledge?and?Data?Engineering,IEEE?Transactions?on,10(3):409–432,1998.
[5]E.Cohen,E.Halperin,H.Kaplan,and?U.Zwic?k.Reachability?and?distancequeries?via2-hop?labels.In?Proceedings?of?the?thirteenth?annual?ACM-SIAMsymposium?on?Discrete?algorithms,pages937–946.Society?for?Industrial?andApplied?Mathematics,2002.
[6]H.Wang,H.He,J.Yang,P.S.Yu,and?J.X.Yu.Dual?labeling:Answering?graph?reachability?queries?in?constant?time.In?Data?Engineering,2006.
ICDE'06.Proceedings?of?the22nd?International?Conference?on,pages75–75.Ieee,2006.
[7]S.Trisl?and?U.Leser.Fast?and?practical?indexing?and?querying?of?very?largegraphs.In?Proceedings?of?the2007ACM?SIGMOD?international?conferenceon?Management?of?data,pages845–856.ACM,2007.
[8]Y.Chen?and?Y.Chen.An?efficient?algorithm?for?answering?graph?reachabilityqueries.In?Data?Engineering,2008.ICDE?2008.IEEE?24th?InternationalConference?on,pages893–902.IEEE,2008.
[9]D.Papadias,J.Zhang,N.Mamoulis,and?Y.Tao.Query?processing?in?spatialnetwork?databases.In?Proceedings?of?the29th?international?conference?onVery?large?data?bases-Volume29,pages802–813.VLDB?Endowment,2003.
[10]Jiefeng?Cheng,Jeffrey?Xu?Yu,and?Philip?S.Yu.Graph?pattern?matching:A?join/semijoin?approach.In?TKDE,pages1006–1021,Los?Alamitos,CA,USA,2010.IEEE?Computer?Society.
[11]H.Tong,C.Faloutsos,B.Gallagher,and?T.Eliassi-Rad.Fast?best-effortpattern?matching?in?large?attributed?graphs.In?Proceedings?of?the?13thACM?SIGKDD?international?conference?on?Knowledge?discovery?and?data?mining,pages737-746.ACM,2007.
[12]J.Cheng,J.X.Yu,B.Ding,P.S.Yu,and?H.Wang.Fast?graph?pattern?matching.In?Data?Engineering,2008.ICDE2008.IEEE24th?InternationalConference?on,pages913–922.Ieee,2008.
Embodiment
The below describes embodiments of the invention in detail, and the example of described embodiment is shown in the drawings, and wherein identical or similar label represents identical or similar element or the element with identical or similar functions from start to finish.Be exemplary below by the embodiment that is described with reference to the drawings, only be used for explaining the present invention, and can not be interpreted as limitation of the present invention.
In description of the invention, term " interior ", " outward ", " vertically ", " laterally ", " on ", orientation or the position relationship of the indications such as D score, " top ", " end " be based on orientation shown in the drawings or position relationship, only be for convenience of description the present invention rather than require the present invention with specific orientation structure and operation, therefore can not be interpreted as limitation of the present invention.
See also Fig. 1, Figure 1 shows that the module map of subgraph coalignment 10 in an embodiment of the present invention.
In the present embodiment, subgraph match device 10 comprises: spanning tree module 102, matching module 104, judge module 106, collection modules 108, storer 110 and processor 112, wherein, spanning tree module 102, matching module 104, judge module 106 and collection modules 108 are stored in the storer 110, and processor 112 is used for carrying out the functional module that is stored in storer 110.
In the present embodiment, subgraph match device 10 is used for finding out the subgraph that mates with band figure at Large Scale Graphs.
In being implemented mode, Large Scale Graphs is stored in the storer 110 with the form of form, wherein, comprises the weight between starting point label and terminal point label and starting point label and the terminal point label in the form.
In the present embodiment, spanning tree module 102 is used for finding described band map generalization tree according to minimal spanning tree algorithm.
Matching module 104 carries out the spanning tree coupling for bottom-up to data plot, seeks the tree Li(i with the spanning tree coupling 〉=1).
Whether judge module 106 is used for judging the score function value of described tree Li and lacks the limit counts sum more than or equal to preset value.
In the present embodiment, described judge module 106 also is used for judging that can described tree Li expand to band figure when the score function value of described tree Li is counted sum less than preset value with the disappearance limit.
In the present embodiment, in the present embodiment, the tree Li that the spanning tree coupling obtains has identical summit with band figure, but it has lacked the part limit.Therefore Li is extended to band figure, only needs the limit of search disappearance, whether have corresponding path at data plot.If exist, then expression can be expanded, and becoming band figure corresponding match map in data plot after the tree Li expansion is Mi, otherwise, cannot expand.
In the present embodiment, judge module 106 calculates described tree L by score function
QBand figure (the M that expands
Q) weight, score function is as follows:
U wherein, v ∈ M
Q, M
QThat query graph Q is at data plot G
DIn match map; (X; Y)=(λ
-1(u); λ
-1(v)) be limit among the query graph Q; C (X; Y) be and inquiry limit (X; Y) related coefficient, it is specified by the user, is defaulted as 1; Dist (u; V) distance value of the shortest path of expression summit u and v.When the shortest path on two summits distance more hour, it is tightr to think that this two summit connects, so score (M
Q) value less, then think the coupling M
QBetter.
Collection modules 108 is used for when tree Li can expand to band figure described tree Li being expanded to match map, and deposit among the set V, wherein, described collection modules 108 also is used for the match map of described set V is sorted from small to large according to weight, whether described judge module 106 also be used for judges set V coupling number of graphs more than or equal to fixed value, and described preset value is made as when the coupling number of graphs is more than or equal to fixed value in set V the weight of a fixed value match map.
In the present embodiment, described collection modules 108 also is used for when the score function value of described tree Li is counted sum more than or equal to preset value with the disappearance limit the match map output of fixed value before the described set V.
In the present embodiment, described collection modules 106 abandons tree Li when described tree Li can not expand to band figure.
In the present embodiment, described judge module 106 also is used for when described set V mates number of graphs less than fixed value preset value being made as+∞.
In the present embodiment, described matching module 104 comprises: decompose submodule 1040, judge submodule 1042, seek submodule 1044 and output sub-module 1046.
Decomposing submodule 1040 is used for the top-down subtree of only having the limit that is decomposed into of described spanning tree.
Judge whether submodule 1042 is I type subtree after being used for judging the subtree growth.
In the present embodiment, the type of the tree that forms after the subtree growth has two kinds: I type subtree and II type subtree, wherein, I type subtree be leaf node without brother's tree, II type subtree is the tree that leaf node has the brotgher of node.
See also Fig. 2 and Fig. 3, Figure 2 shows that the generative process of I type subtree, Figure 3 shows that the generative process of II type subtree.
In Fig. 2, subtree forms (B is the root node of low one deck subtree, and C can be a leaf node) by the subtree of a root node A and a sub-Node B, and Node B has a limit to point to root node.In the present embodiment, C can be low one deck subtree, can be come by I type or the growth of II type by other subtrees.
In Fig. 3, subtree is by a root node A and a plurality of child node B ... the subtree of C forms (B ... C is the root node of low one deck subtree, B ... C can be a node).Node B ... C has a limit to point to root node.In the present embodiment, B ... C can be low one deck subtree, can be come by I type or the growth of II type by other subtrees.
Please continue to consult Fig. 1, seek the root node of the tree that after the described subtree growth of described data plot searching, forms when submodule 1044 is used for being I type subtree after described subtree growth to the optimal result of leaf node, put into pTable, wherein, described searching submodule 1044 also is used for the data that described pTable dist value (weighted value) is minimum and puts into sTable, and the minimum data of dist value among the deletion pTable, describedly judge that submodule 1042 is used for also judging whether described subtree is that last stalk is set.
Output sub-module 1046 is used for when described subtree is last stalk tree the content of the described sTable matching result (tree Li) as described spanning tree.
In the present embodiment, the optimal result when described searching submodule 1044 also is used for forming after described subtree growth tree is not I type subtree between the brotgher of node of the tree that forms after the described subtree growth of described data plot searching is put into pTable.
In the present embodiment, described decomposition submodule 1040 also is used for when described subtree is not last stalk tree described subtree as leaf node.
See also Fig. 4, Figure 4 shows that and utilize subgraph match device shown in Figure 1 10 to carry out the process flow diagram of the method for subgraph match in an embodiment of the present invention.
In the present embodiment, the method for subgraph match is used for finding out the subgraph that mates with band figure at Large Scale Graphs.
At step S202, spanning tree module 102 finds described band map generalization tree according to minimal spanning tree algorithm.
At step S204, matching module 104 is bottom-up to carry out the spanning tree coupling to data plot, seeks the tree Li(i with the spanning tree coupling 〉=1).
At step S206, judge module 106 judges that whether the score function value of described tree Li and disappearance limit count sum more than or equal to preset value.
In the present embodiment, judge module 106 calculates described tree L by score function
QBand figure (the M that expands
Q) weight, score function is as follows:
U wherein, v ∈ M
Q, M
QThat query graph Q is at data plot G
DIn match map; (X; Y)=(λ
-1(u); λ
-1(v)) be limit among the query graph Q; C (X; Y) be and inquiry limit (X; Y) related coefficient, it is specified by the user, is defaulted as 1; Dist (u; V) distance value of the shortest path of expression summit u and v.When the shortest path on two summits distance more hour, it is tightr to think that this two summit connects, so score (M
Q) value less, then think the coupling M
QBetter.
If the score function value of described tree Li is counted sum more than or equal to preset value with the disappearance limit, then at step S206, collection modules 108 is with the match map output of front fixed value among the described set V.
If the score function value of described tree Li is counted sum less than preset value with the disappearance limit, then at step S208, judge module 106 judges that can described tree Li expand to band figure.
In the present embodiment, the tree Li that the spanning tree coupling obtains has identical summit with band figure, but it has lacked the part limit.Therefore Li is extended to band figure, only needs the limit of search disappearance, whether have corresponding path at data plot.If exist, then expression can be expanded, and becoming band figure corresponding figure in data plot after the tree Li expansion is Mj, otherwise, cannot expand.
If described tree Li can expand to band figure, then at step S212, collection modules 108 expands to match map with described tree Li, and deposits among the set V.
At step S214, collection modules 108 sorts the match map among the described set V from small to large according to weight.
At step S216, judge module 106 judges that whether the coupling number of graphs is more than or equal to fixed value among the described set V.
If the coupling number of graphs is more than or equal to fixed value among the described set V, then at step S218, judge module 106 is made as described preset value the weight of a fixed value match map.
If the coupling number of graphs is less than fixed value among the described set V, then at step S220, judge module 106 is made as preset value+∞.
See also Fig. 5, Fig. 5 is the particular flow sheet of step S204 among Fig. 4.
At step S300, decompose submodule 1040 with the top-down subtree of only having the limit that is decomposed into of described spanning tree.
At step S302, judge that submodule 1042 judges whether subtree is I type subtree.
In the present embodiment, the type of the tree that forms after the subtree growth has two kinds: I type subtree and II type subtree, wherein, I type subtree be leaf node without brother's tree, II type subtree is the tree that leaf node has the brotgher of node.
In the present embodiment, the relation of judging the node of the tree that forms after submodule 1042 is by the subtree growth determines whether subtree is I type subtree.
If the tree that forms after the described subtree growth is I type subtree, then at step S304, seek submodule 1044 and in described data plot, seek the root node of the tree that forms after the described subtree growth to the optimal result of leaf node, put into pTable.In the present embodiment, pTable is used for the intermediate result that memory node connects.
At step S306, seek submodule 1044 data that dist value (weighted value) among the described pTable is minimum and put into sTable, and the minimum data of dist value among the deletion pTable.In the present embodiment, sTable stores the matching result of having found out.
At step S308, judge that submodule 106 judges that whether described subtree is last stalk tree.
If described subtree is for last stalk tree, then at step S310, output sub-module 1046 is with the content of the described sTable matching result (tree Li) as described spanning tree.
If described subtree is not last stalk tree, then at step S312, decompose submodule 1040 with described subtree as leaf node.
In the judged result in step S302, if the tree that forms after the described subtree growth is not I type subtree, represent that then the tree that forms after the subtree growth is II type subtree, at step S314, seek submodule 1044 and in described data plot, seeks optimal result between the brotgher of node of the tree of formation after the described subtree growth, put into pTable.
Subgraph match device 10 in the embodiment of the present invention and the method for subgraph match are by being converted to spanning tree with band figure, bottom-up data plot is carried out spanning tree coupling, seek the tree with the spanning tree coupling, the score function value of decision tree is counted sum with the disappearance limit and whether is decided more than or equal to the weight of a fixed value match map in the set whether tree is matching result, has improved the speed to the data plot match query.
Although the present invention is described with reference to current preferred embodiments; but those skilled in the art will be understood that; above-mentioned preferred embodiments only is used for illustrating the present invention; be not to limit protection scope of the present invention; any within the spirit and principles in the present invention scope; any modification of doing, equivalence replacement, improvement etc. all should be included within the scope of the present invention.