CN107609175A - Dom tree generation method and relevant device - Google Patents

Dom tree generation method and relevant device Download PDF

Info

Publication number
CN107609175A
CN107609175A CN201710905138.XA CN201710905138A CN107609175A CN 107609175 A CN107609175 A CN 107609175A CN 201710905138 A CN201710905138 A CN 201710905138A CN 107609175 A CN107609175 A CN 107609175A
Authority
CN
China
Prior art keywords
svg
graph
node
nodes
traversal order
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710905138.XA
Other languages
Chinese (zh)
Other versions
CN107609175B (en
Inventor
吴斐然
怀宝兴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201710905138.XA priority Critical patent/CN107609175B/en
Publication of CN107609175A publication Critical patent/CN107609175A/en
Application granted granted Critical
Publication of CN107609175B publication Critical patent/CN107609175B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiments of the invention provide a kind of document object model tree generation method and relevant device.Methods described includes:Determine the traversal order of scalable vector graphicses SVG nodes, wherein, element in the corresponding graph of a relation drawn in browser page of the SVG nodes, the element includes node of graph and connected side, and the traversal order for spending SVG nodes corresponding to smaller node of graph is more forward than the traversal order for spending SVG nodes corresponding to bigger node of graph;SVG subtrees are generated according to the traversal order of the SVG nodes, wherein, the traversal order of the SVG subtrees is consistent with the traversal order of the SVG nodes, and the SVG subtrees are the subtree in the DOM Document Object Model dom tree.The above method can generate the dom tree that the less browser page for having graph of a relation according to drawing of average cost that triggering is reset generates.

Description

Dom tree generation method and relevant device
Technical field
The present invention relates to field of data structures, more particularly to a kind of dom tree generation method and relevant device.
Background technology
Graph of a relation is generally used for representing the relation between multiple entities, for example, social network relationships figure, World Wide Web relation Figure etc., is not specifically limited herein.Common graph of a relation includes node link figure and adjacency matrix figure etc., in order to state letter Just, hereinafter illustrated by taking node link figure as an example.As shown in figure 1, node link figure is by node of graph 110 and side 120 are formed.Node of graph 110 is used to represent corresponding entity, the relation that side 120 is used between presentation-entity.For example, node link When figure is applied to the relation of description social networks, node of graph can be used to indicate that user (for example, Tom and Alisa), and side can be used Relation (for example, representing that Tom and Alisa is acquaintance) between user is represented.Node link figure is because of its directly perceived, succinct spy Point, the physical quantities that are particularly suitable for use in are numerous, also, the scene that the relation between entity is complicated.It is but quick with internet Development, the development of social networks and World Wide Web exponentially increases, the scale of graph of a relation generally in thousand node/edge ranks, Ten thousand node/edge ranks even can be reached, i.e. the quantity on node of graph and side can be thousands of in graph of a relation or number is with ten thousand Meter.For the ease of analyzing graph of a relation, user can generally draw relation on browser page, in order to each analysis Side participates in being analyzed.
But those skilled in the art has found under studying for a long period of time, how there is the browser page of graph of a relation for drafting The less dom tree of average cost that face generation triggering is reset is a problem being not yet resolved.
The content of the invention
The embodiment of the present invention provides a kind of dom tree generation method and relevant device, can generate being averaged for triggering rearrangement The less dom tree of cost.
First aspect, there is provided a kind of document object model tree generation method, including:
The traversal order of scalable vector graphicses SVG nodes is determined, wherein, the SVG nodes are corresponding in browser page Element in the graph of a relation of drafting, the element include node of graph and connected side, and it is corresponding to spend smaller node of graph SVG nodes traversal order it is more forward than the traversal order for spending SVG nodes corresponding to bigger node of graph;
SVG subtrees are generated according to the traversal order of the SVG nodes, wherein, the traversal order of the SVG subtrees and described The traversal order of SVG nodes is consistent, and the SVG subtrees are the subtree in the DOM Document Object Model dom tree.
With reference in a first aspect, in some possible embodiments, the SVG subtrees carry removes institute in the dom tree State outside SVG subtrees on the node of traversal order most rearward.
With reference in a first aspect, in some possible embodiments, time on the side being connected with spending smaller node of graph The traversal order for going through side of the order than being connected with spending bigger node of graph is forward.
With reference in a first aspect, in some possible embodiments, the traversal order of SVG nodes corresponding to the node of graph Traversal order than SVG nodes corresponding to coupled side is forward.
With reference in a first aspect, in some possible embodiments, the SVG subtrees also include SVG root nodes, wherein,
SVG nodes carry corresponding to the node of graph is corresponding with the side that the node of graph is connected on the SVG root nodes SVG nodes carry corresponding to the node of graph on SVG nodes;Or SVG nodes carry corresponding to the node of graph is in institute State on SVG root nodes, the corresponding SVG nodes in side being connected with the node of graph also carry on the SVG root nodes.
Second aspect, there is provided a kind of dom tree generating means, including:Determining module and generation module,
The determining module is used for the traversal order for determining scalable vector graphicses SVG nodes, wherein, the SVG nodes Element in the corresponding graph of a relation drawn in browser page, the element include node of graph and connected side, spend ratio Traversal order of the traversal order of SVG nodes corresponding to less node of graph than spending SVG nodes corresponding to bigger node of graph It is forward;
The generation module is used to generate SVG subtrees according to the traversal order of the SVG nodes, wherein, the SVG subtrees Traversal order with the traversal order of the SVG nodes be consistent, the SVG subtrees are the DOM Document Object Model dom tree In subtree.
With reference in a first aspect, in some possible embodiments, the SVG subtrees carry removes institute in the dom tree State outside SVG subtrees on the node of traversal order most rearward.
With reference in a first aspect, in some possible embodiments, time on the side being connected with spending smaller node of graph The traversal order for going through side of the order than being connected with spending bigger node of graph is forward.
With reference in a first aspect, in some possible embodiments, the traversal order of SVG nodes corresponding to the node of graph Traversal order than SVG nodes corresponding to coupled side is forward.
With reference in a first aspect, in some possible embodiments, the SVG subtrees also include SVG root nodes, wherein, On the SVG root nodes, SVG corresponding with the side that the node of graph is connected is saved SVG nodes carry corresponding to the node of graph Point carry is corresponding to the node of graph on SVG nodes;Or SVG nodes carry corresponding to the node of graph is in the SVG roots On node, the corresponding SVG nodes in side that are connected with the node of graph also carry on the SVG root nodes.
The third aspect, there is provided a kind of terminal device, including:The processing coupled including memory and with the memory Device, wherein:The memory is used for store program codes, and the processor is used to perform the program generation stored in the memory Code so that terminal device performs any one of first aspect methods described.
Fourth aspect, there is provided a kind of computer-readable recording medium, the computer-readable recording medium storage have meter Calculation machine program, realized when the computer program is performed by terminal device such as any one of first aspect methods described.
In such scheme, it is determined that SVG nodes traversal order when, SVG nodes corresponding to smaller node of graph will be spent Traversal order it is more forward than the traversal order for spending SVG nodes corresponding to bigger node of graph, can ensure that generation triggering is reset The less dom tree of average cost.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, it is required in being described below to embodiment to use Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are some embodiments of the present invention, general for this area For logical technical staff, on the premise of not paying creative work, other accompanying drawings can also be obtained according to these accompanying drawings.
Fig. 1 is a kind of structural representation of node link figure disclosed in prior art;
Fig. 2A to 2D illustrates the complete procedure that user in the prior art draws graph of a relation;
Fig. 3 is a kind of structural representation of dom tree in the embodiment of the present application;
Fig. 4 is a kind of structural representation of graph of a relation in the embodiment of the present application;
Fig. 5 A to 5D are the schematic diagrames of the graph of a relation shown in some modifications Fig. 4 that the embodiment of the present application provides;
Fig. 6 is the structural representation that the embodiment of the present application provides another graph of a relation;
Fig. 7 A to 7B are the different dom trees of two kinds of traversal orders of the graph of a relation generation according to Fig. 6;
Fig. 8 is a kind of schematic flow sheet for document object model tree generation method that the embodiment of the present application provides;
Fig. 9 A to 9B are the structural representations of the SVG subtrees for two kinds of generations that the embodiment of the present application provides;
Figure 10 is a kind of structural representation for terminal device that the embodiment of the present application provides;
Figure 11 is a kind of structural representation for dom tree generating means that the embodiment of the present application provides.
Embodiment
In the online relational network analysis system of Browser/Server Mode (B/S) structure, user can by based on The visual post process of browser is realized draws graph of a relation on browser page.
Visual post process can provide the drawing ability interacted between user and browser page.That is, user can lead to The graphic user interface of normal browser page receives the drafting instruction of user, and is instructed according to the drafting of user in browser page On draw out graph of a relation.Visual post process includes but is not limited to:D3.js, Raphael.js etc..It is it should be understood that above-mentioned visual The citing for changing kit is merely possible to a kind of citing, should not form specific restriction.
Browser page be used for show hypertext (text, image and video etc.) content, and provide user with it is super literary The interface of interaction between this.Browser can only have a browser page for being used to draw graph of a relation, it is possibility to have Duo Gefen The browser page of different graphs of a relation Yong Yu not drawn.When browser has multiple browser pages, system can pass through Different page-tags switches to different browser pages.Common browser page typically includes, but not limited to:Hypertext Markup language (hyper text markup language, HTML) page.It is appreciated that above-mentioned html page is only to browse A kind of common page in the device page, in actual applications, browser page can also be other pages, not do herein specific Limit.
The mode that user draws graph of a relation using above-mentioned visual post process on browser page (page) can have Many kinds, for example, vector can markup language (vector markup language, VML) mode, scalable vector graphicses (scalable vector graphics, SVG) mode, canvas modes, webgl modes etc..The drafting of above-mentioned relation figure Mode is only used for illustrating, and should not be construed as specifically limiting.Wherein, SVG modes are the passes of visual post process generally use It is figure drafting mode.
When drawing graph of a relation using SVG draftings mode, interacted between user and computer and draw the process of graph of a relation It is as follows:Node of graph is placed on browser page by user, then, is added according to the relation between node of graph between node of graph Side.For example, SVG is used to draw the complete procedure that mode draws graph of a relation as Fig. 2A to 2D illustrates user.Fig. 2A sets for user The schematic diagram of part node of graph is put.Fig. 2 B are the schematic diagram that user is provided with whole node of graph.Fig. 2 C are connected to for user The schematic diagram on the side of part node of graph.Fig. 2 D are the schematic diagram on the side that user is connected to whole node of graph.It is appreciated that such as Fig. 2A Process to the drafting graph of a relation of 2D displayings is only a kind of example, should not form specific restriction.
If drawing graph of a relation using SVG modes on browser page, the element of browser page includes page member Element and SVG elements.Wherein, page elements are the elements for forming browser page, and SVG elements are the elements of constituent relation figure. Page elements typically include, but not limited to:Page head (head), title (title), default link (base), link (link), Metadata (meta), text (text), h1, div and main body (body).SVG elements typically include, but not limited to:Node of graph And side (line) (ellipse).It is appreciated that the example of above-mentioned page elements and SVG elements is merely possible to a kind of example, Specific restriction should not be formed.
System is according to the element of browser page, DOM Document Object Model (Document Object corresponding to generation Model, DOM) tree.The element of browser page includes page elements and SVG elements, correspondingly, the dom tree of system generation Node includes page node and SVG nodes.Wherein, page node corresponds to the section generated for the page elements of browser page Point, SVG nodes are the node of the corresponding generation of SVG elements for the graph of a relation being plotted on browser page.
More specifically, the page elements of browser page and the page node of dom tree, and, the SVG members of browser page Element is as follows with the corresponding relation of the SVG nodes of dom tree:Page head in page elements correspondingly generates the head sections in page node Point, the title in page elements correspondingly generate the title nodes in page node, and the default link in page elements is corresponding to be generated Link nodes in page node, the metadata in page elements correspondingly generate the meta nodes in page node, the like, Main body in page elements correspondingly generates the body nodes in page node.Node of graph in SVG elements correspondingly generates SVG nodes In ellipse nodes, the side in SVG elements correspondingly generates the line nodes in SVG nodes.As an example, generation Dom tree can be dom tree as shown in Figure 3.In the dom tree shown in Fig. 3, page node includes:Head nodes, body sections Point, title nodes, text nodes, h1 nodes and div nodes;SVG nodes include:Ellipse nodes 210 and line sections Point 220.It is appreciated that the dom tree shown in Fig. 3 is merely possible to a kind of example, and non-specific restriction.
It should be noted that used when system travels through dom tree traversal mode difference when, time of the node in dom tree Order is gone through to differ.In the embodiment of the present application, the mode of system traversal dom tree travels through (preorder for preamble Traversal) mode, i.e. under system uses up to, mode from left to right travels through dom tree.Certainly, system travels through dom tree Mode can also be inorder traversal mode (inorder traversal), postorder traversal (postorder traversal) mode Etc., it is not especially limited herein.In order to state conveniently, in the case where being not specifically stated, hereafter to travel through dom tree Mode is to be illustrated exemplified by preamble travels through.
The node of graph of graph of a relation in browser page is modified, and (including the additions and deletions of node of graph and position become It is dynamic) when, dom tree can be triggered and enter rearrangement (Reflow).Wherein, the cost and the degree and figure of node of graph that dom tree triggering is reset The traversal order of node is relevant.
The cost that node of graph triggering in graph of a relation is reset is related to the degree of node of graph.It can be appreciated that the degree of node of graph is got over Greatly, the quantity on the side being connected with node of graph is more, and the degree of node of graph is smaller, and the quantity on the side being connected with node of graph is fewer.Figure section Point be triggered rearrangement when, the side that is connected with node of graph can also be triggered rearrangement.So the degree of node of graph is bigger, then node of graph touches The cost that hair is reset is bigger, and the degree of node of graph is smaller, then the cost that node of graph triggering is reset is smaller.Illustrate to scheme with reference to Fig. 4 Relation between the cost that the degree of node and triggering are reset.
As shown in figure 4, Fig. 4 shows the structural representation of the graph of a relation of a specific embodiment.In this embodiment, close It is that figure is made up of node of graph A~G and side a~h.Node of graph A passes through side e connection figures by side a connections node of graph C, node of graph C Node D, node of graph D are connected by side f connections node of graph E, node of graph E by side b connections node of graph A, node of graph A by side c Node of graph F, node of graph A are connected by side d connections node of graph B, node of graph B by side g connections node of graph H, node of graph B by side h Map interlinking node G.That is, node of graph A degree is 4, and node of graph B degree is 3, and node of graph C degree is 2, and node of graph D degree is 2, figure section Point E degree is 2, and node of graph F degree is 1, and node of graph G degree is 1, and node of graph H degree is 1.It is appreciated that above-mentioned graph of a relation Be merely possible to a specific example, in other examples, the quantity of the node of graph of graph of a relation can be it is more or Less, the position of node of graph can also be different that the quantity on side can also be more or less, and the position on side can also be not With, it is not especially limited herein.
As shown in Figure 5A, corresponding to the node of graph A in Fig. 4, in response to pulling mobile instruction to the right, node of graph A is to the right It is mobile, also, the side a to d being connected with node of graph A also followed by node of graph A and move right (as shown in dotted portion in Fig. 5 A). That is, when node of graph A is changed, SVG nodes corresponding to node of graph A are triggered rearrangement, the side a being connected with node of graph A It can be also triggered rearrangement to SVG nodes corresponding to d.Therefore, the cost that node of graph A triggerings are reset is to cause 5 SVG node weights Row.
As shown in Figure 5 B, corresponding to the node of graph B in Fig. 4, in response to pulling mobile instruction, node of graph B to the upper left corner Moved to the upper left corner, also, side d, g and the h being connected with node of graph B also followed by node of graph B and move (such as Fig. 5 B to the upper left corner Shown in middle dotted portion).That is, when node of graph B is changed, SVG nodes corresponding to node of graph B are triggered rearrangement, with SVG nodes corresponding to side d, g and h of node of graph B connections can also be triggered rearrangement.Therefore, the cost that node of graph B triggerings are reset To cause 4 SVG nodes to be reset.
As shown in Figure 5 C, corresponding to the node of graph C in Fig. 4, in response to pulling mobile instruction upwards, node of graph C is upward It is mobile, also, the side a and e being connected with node of graph C also followed by node of graph C and move up (such as dotted portion institute in Fig. 5 C Show).That is, when node of graph C is changed, SVG nodes corresponding to node of graph C are triggered rearrangement, are connected with node of graph C SVG nodes corresponding to side a and e can also be triggered rearrangement.Therefore, the cost that node of graph C triggerings are reset is to cause 3 SVG sections Point is reset.It is appreciated that node of graph D and node of graph E situation and node of graph C situation are similar, do not say still further herein It is bright.
As shown in Figure 5 D, corresponding to the node of graph F in Fig. 4, in response to pulling mobile instruction to the right, node of graph F is to the right It is mobile, also, the side c being connected with node of graph F also followed by node of graph F and move right (as shown in dotted portion in Fig. 5 D). That is when node of graph F is changed, SVG nodes corresponding to node of graph F are triggered rearrangement, c pairs of side being connected with node of graph F The SVG nodes answered can also be triggered rearrangement.Therefore, the cost that node of graph F triggerings are reset is to cause 2 SVG nodes to be reset.Can be with Understand, node of graph H and node of graph G situation and node of graph F situation are similar, do not illustrate still further herein.
The cost that node of graph triggering in graph of a relation is reset is related to the traversal order of node of graph.It can be appreciated that traversal is suitable The preceding node of sequence be triggered rearrangement when, the posterior node of traversal order can equally be triggered rearrangement, and on the contrary, traversal order exists Node afterwards be triggered rearrangement when, the preceding node of traversal order will not be triggered rearrangement, so, the traversal order of node of graph is got over Forward, then the cost that node of graph triggering is reset is bigger, and more rearward, then node of graph triggers the cost reset to the traversal order of node of graph It is smaller.Illustrate the relation between the traversal order of node of graph and the cost that triggering is reset with reference to Fig. 6.
As shown in fig. 6, graph of a relation includes 3 node of graph and two sides.Wherein.Node of graph A passes through side a connection node of graph B, node of graph A pass through side b connection node of graph C.Node of graph A degree is 2, and node of graph B degree is 1, and node of graph C degree is 1.Can be with Understand that above-mentioned graph of a relation is merely possible to a specific example, in other examples, the number of the node of graph of graph of a relation Amount can be more or less, and the position of node of graph can also be different, and the quantity on side can also be more or less, side Position can also be different, be not especially limited herein.Graph of a relation according to Fig. 6, it can generate as shown in Figure 7 A Dom tree, dom tree as shown in Figure 7 B can also be generated.
By taking the dom tree shown in Fig. 7 A as an example, when the ellipse A nodes for triggering the left side in figure are reset, ellipse A sections Point, Line a nodes, Line b nodes, ellipse B nodes and ellipse C nodes can trigger rearrangement.When triggering is schemed When middle ellipse B nodes are reset, ellipse B nodes, ellipse C nodes can also trigger rearrangement.When triggering in figure When ellipse C nodes are reset, the rearrangement of ellipse C nodes can be only triggered.In this embodiment, the left side is triggered The cost that ellipse A nodes are reset is to cause 5 nodes to enter rearrangement, triggers the generation that the ellipse B nodes of centre are reset Valency is to cause 2 nodes to enter rearrangement, and the cost for triggering the ellipse C nodes rearrangement on the right is to cause 1 node to carry out weight Row.That is, the traversal order of node of graph is more forward, then node of graph triggering reset cost it is bigger, the traversal order of node of graph rearward, The cost that then node of graph triggering is reset is smaller.
By taking the dom tree shown in Fig. 7 B as an example, when the ellipse C nodes for triggering the left side in figure are reset, ellipse C sections Point, ellipse B nodes, ellipse A nodes, Line a nodes and Line b nodes can trigger rearrangement.When triggering is schemed When middle ellipse B nodes are reset, ellipse B nodes, ellipse A nodes, Line a nodes and Line b can also be touched Hair is reset.When triggering ellipse A nodes rearrangement in figure, ellipse A nodes, Line a nodes and Line b can also be touched Hair is reset.In this embodiment, the cost for triggering the ellipse C nodes rearrangement on the left side is to cause 5 nodes to enter rearrangement, The cost that ellipse B nodes among triggering are reset is to cause 4 nodes to enter rearrangement, triggers the ellipse A sections on the right The cost that point is reset is to cause 3 nodes to enter rearrangement.That is, the traversal order of node of graph is more forward, then node of graph triggering is reset Cost it is bigger, the traversal order of node of graph more rearward, then node of graph triggering reset cost it is smaller.
It is not difficult to find out by Fig. 7 A and Fig. 7 B, even if the quantity of node of graph and degree all same, still, when node of graph During traversal order difference, the average cost that dom tree triggering is reset differs.
By taking the traversal order shown in the dom tree in Fig. 7 A as an example, the cost that triggering ellipse A nodes are reset is to cause 5 Individual node enters rearrangement, and the cost that triggering ellipse B nodes are reset is to cause 2 nodes to enter rearrangement, triggering ellipse C Node reset cost be to cause 1 node to enter rearrangement, so, ellipse A nodes, ellipse B nodes and The average cost that the triggering of ellipse C nodes is reset is (5+2+1)/3=8/5.
By taking the traversal order shown in the dom tree in Fig. 7 B as an example, the cost that triggering ellipse C nodes are reset is to cause 5 Individual node enters rearrangement, and the cost that triggering ellipse B nodes are reset is to cause 4 nodes to enter rearrangement, triggering ellipse A Node reset cost be to cause 3 nodes to enter rearrangement, so, ellipse A nodes, ellipse B nodes and The average cost that the triggering of ellipse C nodes is reset is (5+4+3)/3=4.
But do not ensure that the dom tree that the browser page for having graph of a relation according to drawing generates triggers in the prior art The less mechanism of average cost of rearrangement, those skilled in the art do not know how that the average generation that triggering is reset could be generated yet The dom tree that the less browser page for having graph of a relation according to drawing of valency generates.
In order to solve the above problems, this application provides a kind of document object model tree generation method and relevant device, The dom tree for the average cost minimum that triggering is reset can be generated, improves the efficiency that webpage renders.It will carry out respectively in detail below Introduce.
As shown in figure 8, the embodiment of the present application provides a kind of document object model tree generation method.The embodiment of the present application Dom tree generation method comprises the following steps:
301:The traversal order of SVG nodes is determined, wherein, the traversal for spending SVG nodes corresponding to smaller node of graph is suitable Sequence, than the traversal order for spending SVG nodes corresponding to bigger node of graph is forward.
302:SVG subtrees are generated according to the traversal order of the SVG nodes, the SVG subtrees are the document object mould Subtree in type dom tree.
In the embodiment of the present application, system is according to the traversal order for spending SVG nodes corresponding to smaller node of graph, than, The forward principle of the traversal order of SVG nodes corresponding to bigger node of graph is spent, determines the mode of the traversal order of SVG nodes Including at least following several:
In the first possible embodiment, system is corresponding according to the smaller node of graph of degree and connected side SVG nodes traversal order, than the traversal for spending SVG nodes corresponding to bigger node of graph and connected side is suitable The forward principle of sequence, determine the traversal order of SVG nodes.By taking the graph of a relation shown in Fig. 4 as an example, SVG corresponding to node of graph F, H, G The traversal order of node is most forward, the traversal order of SVG nodes corresponding to node of graph E and side b secondly, node of graph C and side e The traversal order of corresponding SVG nodes third, the traversal order of SVG nodes corresponding to node of graph B and side g, h third, The traversal order of SVG nodes is last corresponding to node of graph A and side a, b, c, d.
On the basis of the first possible embodiment, system can be combined with the corresponding SVG nodes of node of graph Traversal order, than, the forward principle of the traversal order of SVG nodes corresponding to coupled side, determine the traversal of SVG nodes Sequentially.On this basis, system can be combined with the traversal order that following several principles determine SVG nodes corresponding with side, tool Body includes:
Alternatively, system can be combined with the traversal order of SVG nodes corresponding to the preceding side of lexicographic order, than dictionary The forward principle of the traversal order of SVG nodes, the traversal order for determining SVG nodes are corresponding to sequentially posterior side: HGFEDfCeBghAabcd。
Alternatively, system can be combined with the traversal order of SVG nodes corresponding to the preceding side of lexicographic order, than dictionary The principle of the traversal order of SVG nodes rearward, the traversal order for determining SVG nodes are corresponding to sequentially posterior side: HGFEDfCeBhgAdcba。
On the basis of the first possible embodiment, system can be combined with the corresponding SVG nodes of node of graph Traversal order, than, the principle of the traversal order of SVG nodes rearward corresponding to coupled side, determine the traversal of SVG nodes Sequentially.On this basis, system can be combined with the traversal order that following several principles determine SVG nodes corresponding with side, tool Body includes:
Alternatively, system can be combined with the traversal order of SVG nodes corresponding to the preceding side of lexicographic order, than dictionary The forward principle of the traversal order of SVG nodes, the traversal order for determining SVG nodes are corresponding to sequentially posterior side: HGFEfDeCghBabcdA。
Alternatively, system can be combined with the traversal order of SVG nodes corresponding to the preceding side of lexicographic order, than dictionary The principle of the traversal order of SVG nodes rearward, the traversal order for determining SVG nodes are corresponding to sequentially posterior side: HGFEfDeChgBdcbaA。
In second of possible embodiment, system according to node of graph traversal order, than the traversal order on side is forward Principle, determine the traversal orders of SVG nodes.By taking the graph of a relation shown in Fig. 4 as an example, node of graph HGFEDCBA traversal order, Than side dbcahfeg traversal order is forward.
On the basis of second of possible embodiment, system can be combined with being connected with spending smaller node of graph The traversal order on the side connect, the principle more forward than the traversal order on, the side being connected with spending bigger node of graph, determines SVG The traversal order of node.
Alternatively, system can be combined with the traversal order of SVG nodes corresponding to the preceding side of lexicographic order, than dictionary The forward principle of the traversal order of SVG nodes, the traversal order for determining SVG nodes are corresponding to sequentially posterior side: HGFEDCBAefghabcd。
Alternatively, system can be combined with the traversal order of SVG nodes corresponding to the preceding side of lexicographic order, than dictionary The principle of the traversal order of SVG nodes rearward, the traversal order for determining SVG nodes are corresponding to sequentially posterior side: HGFEDCBAfehgdcba。
On the basis of second of possible embodiment, system can be combined with being connected with spending smaller node of graph The traversal order on the side connect, than the traversal order principle rearward on, the side being connected with spending bigger node of graph, determine SVG The traversal order of node.
Alternatively, system can be combined with the traversal order of SVG nodes corresponding to the preceding side of lexicographic order, than dictionary The forward principle of the traversal order of SVG nodes, the traversal order for determining SVG nodes are corresponding to sequentially posterior side: HGFEDCBAabcdghef。
Alternatively, system can be combined with the traversal order of SVG nodes corresponding to the preceding side of lexicographic order, than dictionary The principle of the traversal order of SVG nodes rearward, the traversal order for determining SVG nodes are corresponding to sequentially posterior side: HGFEDCBAdcbahgfe。
In the third possible embodiment, system according to node of graph traversal order, than the traversal order on side is forward Principle, determine the traversal orders of SVG nodes.By taking the graph of a relation shown in Fig. 4 as an example, node of graph HGFEDCBA traversal order, Than side dbcahfeg traversal order is rearward.
On the basis of the third possible embodiment, system can be combined with being connected with spending smaller node of graph The traversal order on the side connect, the principle more forward than the traversal order on, the side being connected with spending bigger node of graph, determines SVG The traversal order of node.
Alternatively, system can be combined with the traversal order of SVG nodes corresponding to the preceding side of lexicographic order, than dictionary The forward principle of the traversal order of SVG nodes, the traversal order for determining SVG nodes are corresponding to sequentially posterior side: efghabcdHGFEDCBA。
Alternatively, system can be combined with the traversal order of SVG nodes corresponding to the preceding side of lexicographic order, than dictionary The principle of the traversal order of SVG nodes rearward, the traversal order for determining SVG nodes are corresponding to sequentially posterior side: fehgdcbaHGFEDCBA。
On the basis of the third possible embodiment, system can be combined with being connected with spending smaller node of graph The traversal order on the side connect, than the traversal order principle rearward on, the side being connected with spending bigger node of graph, determine SVG The traversal order of node.
Alternatively, system can be combined with the traversal order of SVG nodes corresponding to the preceding side of lexicographic order, than dictionary The forward principle of the traversal order of SVG nodes, the traversal order for determining SVG nodes are corresponding to sequentially posterior side: abcdghefHGFEDCBA。
Alternatively, system can be combined with the traversal order of SVG nodes corresponding to the preceding side of lexicographic order, than dictionary The principle of the traversal order of SVG nodes rearward, the traversal order for determining SVG nodes are corresponding to sequentially posterior side: dcbahgfeHGFEDCBA。
In the embodiment of the present application, the SVG subtrees of generation comprise at least following several possible embodiments.
In the first possible embodiment, the SVG subtrees also include SVG root nodes, wherein, the node of graph pair The SVG nodes carry answered is on the SVG root nodes, and SVG nodes carry corresponding with the side that the node of graph is connected is described Corresponding to node of graph on SVG nodes.Using the traversal order of SVG nodes as:Exemplified by HGFEDfCeBghAabcd, SVG of generation Tree can be as shown in Figure 9 A.
In second of possible embodiment, the SVG subtrees also include SVG root nodes, wherein, the node of graph pair The SVG nodes carry answered on the SVG root nodes, the corresponding SVG nodes in side that are connected with the node of graph also carry in institute State on SVG root nodes.Using the traversal order of SVG nodes as:Exemplified by HGFEDfCeBghAabcd, the SVG subtrees of generation can be as Shown in Fig. 9 B.It can be appreciated that second of possible embodiment only includes two layers of node, be advantageous to SVG subtrees realize it is flat Change structure, so as to improve the search efficiency of SVG nodes, also, the structure of the SVG subtrees generated is more simple.
It should be noted that the SVG subtrees of generation can be with carry on the arbitrary node in dom tree.But by In the probability that the page node triggering that the probability that the triggering of SVG subtrees is reset is far longer than in dom tree is reset, so, it may be considered that By SVG subtrees carry in the dom tree in addition to the SVG subtrees on the node of traversal order most rearward.
Be described below the present embodiments relate to terminal device a kind of implementation.The terminal equipment configuration browses Device and visual post process.The browser can have one or more browser page.User can be by described Visual post process can draw graph of a relation on one or more browser page.Visual post process is in browser page (page) mode for drawing graph of a relation on can have many kinds, for example, VML modes, SVG modes, canvas modes, webgl side Formula etc..Common visualization tool includes:D3.js, Raphael.js etc..
Figure 10 is a kind of structured flowchart of implementation of terminal device 400.As shown in Figure 10, terminal 400 may include:Base Microarray strip 410, memory 415 (one or more computer-readable recording mediums), peripheral system 417.These parts can be one Communicated on individual or multiple communication bus 414.
Peripheral system 417 is mainly used in realizing the interactive function between terminal 410 and user/external environment condition, mainly includes The input/output unit of terminal 400.In the specific implementation, peripheral system 417 may include:Touch screen controller 418, camera control Device 419, Audio Controller 420 and sensor management module 421.Wherein, each controller can be set with each self-corresponding periphery It is standby that (such as touch-screen 423, camera 424, voicefrequency circuit 425 and sensor 426 couple.
Baseband chip 410 can integrate including:One or more processors 411, clock module 412 and power management module 413.The clock module 412 being integrated in baseband chip 410 is mainly used in producing data transfer and SECO for processor 411 Required clock.The power management module 413 being integrated in baseband chip 410 is mainly used in as processor 411, radio-frequency module 416 and peripheral system stable, pinpoint accuracy voltage is provided.
Memory 415 couples with processor 411, for storing various software programs and/or multigroup instruction.Specific implementation In, memory 415 may include the memory of high random access, and may also comprise nonvolatile memory, such as one or Multiple disk storage equipments, flash memory device or other non-volatile solid-state memory devices.Memory 415 can store an operating system (following abbreviation systems), such as the embedded OS such as ANDROID, IOS, WINDOWS, or LINUX.Memory 415 is also Network communication program can be stored, the network communication program can be used for and one or more optional equipments, one or more terminals Equipment, one or more network equipments are communicated.Memory 415 can also store user interface program, the user interface journey Sequence can be shown the content image of application program is true to nature by patterned operation interface, and passes through menu, dialogue The input control such as frame and button receives control operation of the user to application program.
Memory 415 can also store one or more application programs, in addition, being also stored with visual post process.Such as figure Shown in 10, these application programs may include:Browser (such as Safari, Google Chrome) etc..Figure 10 is terminal device A kind of structured flowchart of 400 implementation.As shown in Figure 10, terminal 400 may include:Baseband chip 410, memory 415 (one Individual or multiple computer-readable recording mediums), peripheral system 417.These parts can lead on one or more communication bus 414 Letter.
Memory 415 couples with processor 411, for storing various software programs and/or multigroup instruction.Specific implementation In, memory 115 may include the memory of high random access, and may also comprise nonvolatile memory, such as one or Multiple disk storage equipments, flash memory device or other non-volatile solid-state memory devices.Memory 415 can store an operating system (following abbreviation systems), such as the embedded OS such as ANDROID, IOS, WINDOWS, or LINUX.Memory 415 is also Network communication program can be stored, the network communication program can be used for and one or more optional equipments, one or more terminals Equipment, one or more network equipments are communicated.Memory 415 can also store user interface program, the user interface journey Sequence can be shown the content image of application program is true to nature by patterned operation interface, and passes through menu, dialogue The input control such as frame and button receives control operation of the user to application program.
Memory 415 can also store one or more application programs.As shown in Figure 10, these application programs may include: Social networking application program (such as Facebook), image management application (such as photograph album), map class application program (such as Google Map), browser (such as Safari, Google Chrome) etc..
It should be appreciated that terminal 400 is only an example provided in an embodiment of the present invention, also, terminal 400 can have than showing The more or less parts of part gone out, two or more parts can be combined, or there can be the different configurations of part real It is existing.
Browser determines the traversal order of scalable vector graphicses SVG nodes, wherein, the SVG nodes are corresponding to be browsed Element in the graph of a relation that the device page is drawn, the element include node of graph and connected side, spend smaller figure section The traversal order of SVG nodes corresponding to point is more forward than the traversal order for spending SVG nodes corresponding to bigger node of graph;
Browser generates SVG subtrees according to the traversal order of the SVG nodes, wherein, the traversal order of the SVG subtrees Traversal order with the SVG nodes is consistent, and the SVG subtrees are the subtree in the DOM Document Object Model dom tree.
Alternatively, traversal order is most rearward in addition to the SVG subtrees in the dom tree for the SVG subtrees carry On one node.
Alternatively, the traversal order on the side being connected with spending smaller node of graph with spending bigger node of graph than being connected The traversal order on the side connect is forward.
Alternatively, the traversal order of SVG nodes corresponding to the node of graph is than SVG nodes corresponding to coupled side Traversal order is forward.
Alternatively, the SVG subtrees also include SVG root nodes, wherein, SVG nodes carry exists corresponding to the node of graph On the SVG root nodes, SVG nodes carry corresponding with the side that the node of graph is connected saves in SVG corresponding to the node of graph Point on;Or SVG nodes carry corresponding to the node of graph is on the SVG root nodes, the side pair that is connected with the node of graph The SVG nodes answered also carry on the SVG root nodes.
Figure 11 shows a kind of dom tree generating means provided in an embodiment of the present invention.As shown in figure 11, the dom tree life Include into device 500:Determining module 510 and generation module 520.
The determining module 510 is used for the traversal order for determining scalable vector graphicses SVG nodes, wherein, the SVG sections Element in the corresponding graph of a relation drawn in browser page of point, the element include node of graph and connected side, spent The traversal order of SVG nodes corresponding to smaller node of graph is more suitable than the traversal for spending SVG nodes corresponding to bigger node of graph Sequence is forward.
The generation module 520 is used to generate SVG subtrees according to the traversal order of the SVG nodes, wherein, the SVG The traversal order of subtree is consistent with the traversal order of the SVG nodes, and the SVG subtrees are the DOM Document Object Model Subtree in dom tree.
It is to be appreciated that in Figure 11 embodiments NM content and each functional unit specific implementation, refer to Fig. 8 Shown embodiment, is repeated no more here.
In several embodiments provided herein, it should be understood that disclosed system, terminal and method, can be with Realize by another way.For example, device embodiment described above is only schematical, for example, the unit Division, only a kind of division of logic function, can there is other dividing mode, such as multiple units or component when actually realizing Another system can be combined or be desirably integrated into, or some features can be ignored, or do not perform.In addition, shown or beg for The mutual coupling of opinion or direct-coupling or communication connection can be the INDIRECT COUPLINGs by some interfaces, device or unit Or communication connection or electricity, the connection of mechanical or other forms.
The unit illustrated as separating component can be or may not be physically separate, show as unit The part shown can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple On NE.Some or all of unit therein can be selected to realize scheme of the embodiment of the present invention according to the actual needs Purpose.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, can also It is that unit is individually physically present or two or more units are integrated in a unit.It is above-mentioned integrated Unit can both be realized in the form of hardware, can also be realized in the form of SFU software functional unit.
If the integrated unit is realized in the form of SFU software functional unit and is used as independent production marketing or use When, it can be stored in a computer read/write memory medium.Based on such understanding, technical scheme is substantially The part to be contributed in other words to prior art, or all or part of the technical scheme can be in the form of software product Embody, the computer software product is stored in a storage medium, including some instructions are causing a computer Equipment (can be personal computer, server, or network equipment etc.) performs the complete of each embodiment methods described of the present invention Portion or part steps.And foregoing storage medium includes:USB flash disk, mobile hard disk, read-only storage (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD etc. are various can store journey The medium of sequence code.
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any Those familiar with the art the invention discloses technical scope in, various equivalent modifications can be readily occurred in or replaced Change, these modifications or substitutions should be all included within the scope of the present invention.Therefore, protection scope of the present invention should be with right It is required that protection domain be defined.

Claims (12)

  1. A kind of 1. document object model tree generation method, it is characterised in that including:
    The traversal order of scalable vector graphicses SVG nodes is determined, wherein, the SVG nodes are corresponding to be drawn in browser page Graph of a relation in element, the element includes node of graph and connected side, spends SVG corresponding to smaller node of graph The traversal order of node is more forward than the traversal order for spending SVG nodes corresponding to bigger node of graph;
    SVG subtrees are generated according to the traversal order of the SVG nodes, wherein, the traversal order of the SVG subtrees and the SVG The traversal order of node is consistent, and the SVG subtrees are the subtree in the DOM Document Object Model dom tree.
  2. 2. according to the method for claim 1, it is characterised in that the SVG subtrees carry is in the dom tree except described Outside SVG subtrees on the node of traversal order most rearward.
  3. 3. method according to claim 1 or 2, it is characterised in that
    With spend that smaller node of graph is connected while traversal order than with spend that bigger node of graph is connected while time Go through front.
  4. 4. method according to claim 1 or 2, it is characterised in that the traversal order of SVG nodes corresponding to the node of graph Traversal order than SVG nodes corresponding to coupled side is forward.
  5. 5. according to the method for claim 4, it is characterised in that the SVG subtrees also include SVG root nodes, wherein,
    SVG nodes carry corresponding to the node of graph is corresponding with the side that the node of graph is connected on the SVG root nodes SVG nodes carry is corresponding to the node of graph on SVG nodes;Or
    SVG nodes carry corresponding to the node of graph is corresponding with the side that the node of graph is connected on the SVG root nodes SVG nodes also carry on the SVG root nodes.
  6. A kind of 6. dom tree generating means, it is characterised in that including:Determining module and generation module,
    The determining module is used for the traversal order for determining scalable vector graphicses SVG nodes, wherein, the SVG nodes are corresponding Element in the graph of a relation that browser page is drawn, the element include node of graph and connected side, and degree is smaller Node of graph corresponding to SVG nodes traversal order it is more forward than the traversal order for spending SVG nodes corresponding to bigger node of graph;
    The generation module is used to generate SVG subtrees according to the traversal order of the SVG nodes, wherein, time of the SVG subtrees It is consistent that order, which is gone through, with the traversal order of the SVG nodes, and the SVG subtrees are in the DOM Document Object Model dom tree Subtree.
  7. 7. device according to claim 6, it is characterised in that the SVG subtrees carry is in the dom tree except described Outside SVG subtrees on the node of traversal order most rearward.
  8. 8. the device according to claim 6 or 7, it is characterised in that
    With spend that smaller node of graph is connected while traversal order than with spend that bigger node of graph is connected while time Go through front.
  9. 9. the device according to claim 6 or 7, it is characterised in that the traversal order of SVG nodes corresponding to the node of graph Traversal order than SVG nodes corresponding to coupled side is forward.
  10. 10. device according to claim 9, it is characterised in that the SVG subtrees also include SVG root nodes, wherein,
    SVG nodes carry corresponding to the node of graph is corresponding with the side that the node of graph is connected on the SVG root nodes SVG nodes carry is corresponding to the node of graph on SVG nodes;Or
    SVG nodes carry corresponding to the node of graph is corresponding with the side that the node of graph is connected on the SVG root nodes SVG nodes also carry on the SVG root nodes.
  11. A kind of 11. terminal device, it is characterised in that including:The processor coupled including memory and with the memory, its In:The memory is used for store program codes, and the processor is used to perform the program code stored in the memory, made Obtain terminal device perform claim and require 1-5 any claim methods describeds.
  12. 12. a kind of computer-readable recording medium, the computer-readable recording medium storage has computer program, and its feature exists In realization such as any one of claim 1 to 5 methods described when the computer program is performed by terminal device.
CN201710905138.XA 2017-09-28 2017-09-28 DOM tree generation method and related equipment Active CN107609175B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710905138.XA CN107609175B (en) 2017-09-28 2017-09-28 DOM tree generation method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710905138.XA CN107609175B (en) 2017-09-28 2017-09-28 DOM tree generation method and related equipment

Publications (2)

Publication Number Publication Date
CN107609175A true CN107609175A (en) 2018-01-19
CN107609175B CN107609175B (en) 2021-01-29

Family

ID=61059381

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710905138.XA Active CN107609175B (en) 2017-09-28 2017-09-28 DOM tree generation method and related equipment

Country Status (1)

Country Link
CN (1) CN107609175B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108416615A (en) * 2018-02-02 2018-08-17 北京邮电大学 A kind of resource allocation methods based on tree
CN110442820A (en) * 2019-07-24 2019-11-12 上海易点时空网络有限公司 Picture synthetic method and device for webpage
CN112734876A (en) * 2021-01-08 2021-04-30 卓望数码技术(深圳)有限公司 Graph drawing method, graph drawing device, electronic equipment and storage medium
CN114419197A (en) * 2021-12-15 2022-04-29 北京力控元通科技有限公司 SVG-based function definition system, method and computer equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1862535A (en) * 2006-02-23 2006-11-15 珠海金山软件股份有限公司 Optimized SVG demonstration projection method
CN101751383A (en) * 2009-12-30 2010-06-23 北京天融信科技有限公司 Method for describing network topology by using SVG
CN102508968A (en) * 2011-11-09 2012-06-20 河海大学常州校区 Function analysis method for mature product
CN102662974A (en) * 2012-03-12 2012-09-12 浙江大学 A network graph index method based on adjacent node trees
US8413046B1 (en) * 2011-10-12 2013-04-02 Google Inc. System and method for optimizing rich web applications

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1862535A (en) * 2006-02-23 2006-11-15 珠海金山软件股份有限公司 Optimized SVG demonstration projection method
CN101751383A (en) * 2009-12-30 2010-06-23 北京天融信科技有限公司 Method for describing network topology by using SVG
US8413046B1 (en) * 2011-10-12 2013-04-02 Google Inc. System and method for optimizing rich web applications
CN102508968A (en) * 2011-11-09 2012-06-20 河海大学常州校区 Function analysis method for mature product
CN102662974A (en) * 2012-03-12 2012-09-12 浙江大学 A network graph index method based on adjacent node trees

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108416615A (en) * 2018-02-02 2018-08-17 北京邮电大学 A kind of resource allocation methods based on tree
CN108416615B (en) * 2018-02-02 2021-11-05 北京邮电大学 Resource allocation method based on tree
CN110442820A (en) * 2019-07-24 2019-11-12 上海易点时空网络有限公司 Picture synthetic method and device for webpage
CN112734876A (en) * 2021-01-08 2021-04-30 卓望数码技术(深圳)有限公司 Graph drawing method, graph drawing device, electronic equipment and storage medium
CN114419197A (en) * 2021-12-15 2022-04-29 北京力控元通科技有限公司 SVG-based function definition system, method and computer equipment
CN114419197B (en) * 2021-12-15 2023-03-24 北京力控元通科技有限公司 SVG-based function definition system, method and computer equipment

Also Published As

Publication number Publication date
CN107609175B (en) 2021-01-29

Similar Documents

Publication Publication Date Title
CN107609175A (en) Dom tree generation method and relevant device
US9164667B2 (en) Word cloud rotatable through N dimensions via user interface
KR101299670B1 (en) System, method and computer readable recording medium for converting a web page dynamically
EP3262497B1 (en) Contextual zoom
US11194884B2 (en) Method for facilitating identification of navigation regions in a web page based on document object model analysis
US20080028302A1 (en) Method and apparatus for incrementally updating a web page
CN104823158B (en) Method and system for simplified knowledge engineering
CN110489116A (en) A kind of rendering method of the page, device and computer storage medium
CN104932889A (en) Page visual generation method and device
US9250763B2 (en) Design-triggered event handler addition
US20170199852A1 (en) Populating Visual Designs with Web Content
US20190026385A1 (en) Overlay canvas for computer program applications
US20140215306A1 (en) In-Context Editing of Output Presentations via Automatic Pattern Detection
CN106886398A (en) The extracting method and equipment of a kind of CSS
JP2020017277A (en) Web reporting design system for programming event operation, based on graphic interface
US9772986B2 (en) Transforming HTML forms into mobile native forms
CN116238125A (en) Product quality monitoring method and system for injection molding production of injector
US9594737B2 (en) Natural language-aided hypertext document authoring
WO2021257182A1 (en) Automated structured textual content categorization accuracy with neural networks
CN112527288B (en) Visual system prototype design method, system and storage medium capable of generating codes
CN111723177B (en) Modeling method and device of information extraction model and electronic equipment
CN114968235A (en) Page form generation method and device, computer equipment and storage medium
CN107766117A (en) A kind of method and device of showing interface
CN110837596B (en) Intelligent recommendation method and device, computer equipment and storage medium
CN104049956A (en) Input state transition processing method and input state transition processing system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220209

Address after: 550025 Huawei cloud data center, jiaoxinggong Road, Qianzhong Avenue, Gui'an New District, Guiyang City, Guizhou Province

Patentee after: Huawei Cloud Computing Technology Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.

TR01 Transfer of patent right