CN104199824A - Method for judging node relation on tree-shaped data - Google Patents

Method for judging node relation on tree-shaped data Download PDF

Info

Publication number
CN104199824A
CN104199824A CN201410345867.0A CN201410345867A CN104199824A CN 104199824 A CN104199824 A CN 104199824A CN 201410345867 A CN201410345867 A CN 201410345867A CN 104199824 A CN104199824 A CN 104199824A
Authority
CN
China
Prior art keywords
node
data
tree
characteristic
attribute data
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.)
Pending
Application number
CN201410345867.0A
Other languages
Chinese (zh)
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.)
WUHAN TRANSN INFORMATION TECHNOLOGY Co Ltd
Original Assignee
WUHAN TRANSN INFORMATION TECHNOLOGY 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 WUHAN TRANSN INFORMATION TECHNOLOGY Co Ltd filed Critical WUHAN TRANSN INFORMATION TECHNOLOGY Co Ltd
Priority to CN201410345867.0A priority Critical patent/CN104199824A/en
Publication of CN104199824A publication Critical patent/CN104199824A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/93Document management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A method for judging a node relation on tree-shaped data comprises the steps that a root node of a data tree is established according to design rules, and the operation of adding and deleting nodes and the like is conducted; a first node and a second node on the data tree are determined; the relation between the first node and the second node is judged according to attribute data and feature data of the two nodes. According to the design rules, each node on the data tree has the attribute data and the feature data; besides the root node, the attribute data of all the nodes correspond to different prime numbers respectively, and the feature data are the product of the attribute data of all precursor nodes of all the nodes. The method for judging the node relation on the tree-shaped data is based on the tree-shaped data meeting the design rules, when the relation between the two nodes in the tree-shaped data is judged, the nodes in the tree do not need to be traversed, the relation between the nodes can be judged directly by calculating the attribute data and the feature data, the efficiency of the judging process is improved, and the complexity of the time of the judging process is constant time.

Description

A kind of method of predicate node relation on tree type data
Technical field
The present invention relates to Organization of Data and management association area in computer software, especially relate to the method for predicate node relation on a kind of tree type data.
Background technology
In infosystem, for data being added up, manage, analysis etc.,, usually need data to organize and manage, so that obtain data and analyze.Tree type data is the data structure of a kind of conventional Organization of Data and management, can be referred to as data tree.For example, in order to manage the classification of books, can set up a data tree, the corresponding classification of each node on data tree,, as shown in Figure 1, root node corresponding " book category ", its child node can have " amusement ", " animal ", " social science " etc., and under " animal " this node, can have the child nodes such as " vertebrate ", " invertabrate ", " vertebrate " can also have the child nodes such as " mammal ", " amphibian ", " birds ".When classification is more and more, institute forms width and the degree of depth set will be increasing.Concerning belonging to mammiferous ox, when needs are searched it and whether are also belonged to " animal " or " social science ", just need to judge ox directly under classification " mammal " and the classification that will judge---" animal " or " social science "---whether there is certain relation.Here, Bos is in " mammal " this classification, and " animal " this node is the forerunner of " mammal ", because " animal " has child node " vertebrate ", and " vertebrate " has child node " mammal ", so ox also belongs to " animal " this classification.And " social science " is not the forerunner of " mammal ", so ox does not belong to " social science " this classification.
At present computing machine is on decision data tree during being related between two nodes, the mode that employing travels through data tree realizes, this mode efficiency is lower, the degree of depth of the Time Dependent of judgement this node in data tree, and the time complexity of calculating is logarithmic time or more.The present invention can simplify the process of judgement, and raises the efficiency.
Summary of the invention
The method that the object of this invention is to provide predicate node relation on a kind of tree type data, better to solve the problem that judges node relationships on data tree in prior art.
In some illustrative embodiment, the method of predicate node relation on described tree type data, comprise: first node and Section Point on specified data tree, according to the attribute data of two nodes and characteristic, judge the relation between described first node and Section Point.Wherein, each node on described data tree has corresponding attribute data and characteristic, and the characteristic of the non-root node on described data tree is relevant to the attribute data of its all forerunner's nodes.
Preferably, before first node and Section Point on specified data tree,, also comprise: set up described data tree, its step is as follows: create the root node of tree type data, its attribute data and characteristic are set; Attribute data and the characteristic of each node are set according to design rule.Described design rule is: the attribute data of each node is different prime number, and except root node, the characteristic of any one node is the product of its all forerunner's nodal community data.
Compared with prior art, illustrative embodiment of the present invention comprises following advantage:
(1) relation between two nodes in judgement data tree, does not need the node in data tree to travel through, and uses attribute data and the characteristic of node to carry out simple computation.
(2) time complexity of decision process is the constant time, does not rely on the degree of depth of node in data tree, more succinct, quick, efficient than existing method.
Accompanying drawing explanation
Accompanying drawing described herein is used to provide a further understanding of the present invention, forms the application's a part, and schematic description and description of the present invention is used for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is according to the schematic diagram of the sample data tree of illustrative embodiment of the present invention;
Fig. 2 is the process flow diagram according to illustrative embodiment of the present invention;
Fig. 3 is the decision process according to illustrative embodiment of the present invention;
Fig. 4 is according to the schematic diagram of the data tree of illustrative embodiment of the present invention; ;
Fig. 5 is the data tree root node according to illustrative embodiment of the present invention;
Fig. 6 is the schematic diagram of deleting the data tree before " software " node;
Fig. 7 is the schematic diagram of deleting the data tree after " software " node;
Fig. 8 is the schematic diagram of the data tree before mobile " software " subtree;
Fig. 9 is the schematic diagram of the data tree after mobile " software " subtree;
Figure 10 is according to the schematic diagram of the data tree of illustrative embodiment of the present invention.
Embodiment
In the following detailed description, a large amount of specific detail are proposed, so that provide thorough understanding of the present invention.But, person of skill in the art will appreciate that, even without these specific detail, also can implement the present invention.In other cases, do not describe well-known method, process, assembly and circuit in detail, in order to avoid affect the understanding of the present invention
Illustrative embodiment for a better understanding of the present invention, is briefly described some terms in illustrative embodiment of the present invention below.
Prime number, claims again prime number, refer in being greater than 1 natural number, except 1 and self, the number that cannot be divided exactly by other natural numbers, prime number only has 1 and self two factor.
The main thought that illustrative embodiment in the present invention is set forth is: determinacy and uniqueness while utilizing the product of prime number to carry out Factorization, the structural relation in storage tree between node.Any two nodes in given tree, can judge between these two nodes, whether have forerunner or follow-up relation, the same relation, brotherhood or other relations at constant in the time.
Illustrative embodiment for a better understanding of the present invention, describes some node relationships in illustrative embodiment of the present invention below.
1) forerunner's relation: the father node of node a is the forerunner of node a; The forerunner's of node a father node is also the forerunner of a.
2) follow-up relation: the child node of node a is the follow-up of node a; The follow-up child node of node a is also the follow-up of node a.
3) same relation: node a and node b are same nodes.
4) brotherhood: the father node of the father node of node a and node b is same node.
5) relation the relation other relations: except above 1), 2), 3), 4) providing.
Referring now to Fig. 2, Fig. 2 has provided according to the process flow diagram of the predicate node relation in some illustrative embodiment.
As shown in Figure 2, in some illustrative embodiment, disclose the method for predicate node relation on a kind of tree type data, having comprised:
S11, create the root node of tree type data, create the root node of data tree, attribute data and the characteristic of root node is set;
S12, according to design rule, add the operations such as node, deletion of node,, comprise attribute data and characteristic that interdependent node is set;
First node and Section Point on S13, specified data tree;
S14, according to the attribute data of two nodes and characteristic, judge the relation between described first node and Section Point.
Wherein, described design rule is: each node on data tree has attribute data and characteristic; Except root node, the corresponding different prime number of the attribute data of each node, characteristic is the product of its all forerunner's nodal community data.
Relation in judgement data tree between two nodes, does not need the node in data tree to travel through, and uses attribute data and the characteristic of node to carry out simple computation.The time complexity of decision process is the constant time, does not rely on the degree of depth of node in data tree, more succinct, quick, efficient than existing method.
In some illustrative embodiment, the process for the different prime number of each Node configuration, comprising: from prime generation and administration module, obtaining not used prime number, can be the new prime number producing or the prime number reclaiming after deletion of node in data tree.Wherein, prime generation and administration module are for preserving and produce prime number, and the each prime number using of assurance is unique in data tree.
In some illustrative embodiment, while adding node on described data tree,, also comprise:
On described data tree, specify a node as father node; By prime generation and administration module, be that described interpolation node distributes a prime number as its attribute data, its characteristic is set to the product of all forerunner's nodal community data.
In some illustrative embodiment, during non-root node on deleting described data tree, also comprise:
The father node of all child nodes of deletion of node is set to the father node of described deletion of node, upgrades the characteristic of all descendant nodes of described deletion of node according to described design rule; Prime generation and administration module reclaim the attribute data of described deletion of node.
In some illustrative embodiment, first node and Section Point on specified data tree, according to the attribute data of two nodes and characteristic, judge and comprise the process of relation between described first node and Section Point:
Wherein, a is first node, and b is Section Point, M aand M bbe respectively the characteristic of a and b, P aand P bbe respectively the attribute data of a and b, < prerepresent that the former is the latter's forerunner ,=representing that both are same nodes, < > represents that both are the brotgher of node ,/represent that both are other relations.
Below the simple declaration to above-mentioned formula:
If 1. the characteristic of a is greater than the characteristic of b, and the characteristic of a is 0 to the attribute data delivery result of b, and a is the follow-up of b, and b is the forerunner of a; ;
If 2. the characteristic of a is less than the characteristic of b, and the characteristic of b is 0 to the attribute data delivery result of a, and a is the forerunner of b, and b is the follow-up of a; ;
If 3. the attribute data of a is identical with the attribute data of b, a and b are same nodes;
If 4. the attribute data of a is different with the attribute data of b, and the characteristic of a is identical with the characteristic of b, and a and b are brotherhoods;
5. in other situations, a and b belong to other relations.
In some illustrative embodiment, the order of decision node relation can judge according to the deterministic process shown in Fig. 3.
Also disclose preferred data tree herein, Fig. 4 for example, comprising:
The attribute data of the root node of data tree is 1, and characteristic is 0;
The characteristic of all the other arbitrary nodes is the product of its all forerunner's nodal community data.
In some illustrative embodiment, the system of a kind of management data tree is disclosed, comprising:
Prime generation and administration module, data tree administration module;
The effect of prime generation and administration module comprises:
1), when the node on data tree need to distribute prime number, adopt Euclid's sieve method or trying division method to produce next prime number;
2) node on data tree deleted after, reclaim the prime number that the attribute data of deletion of node adopts;
3) guarantee that each prime number using is unique: by the prime number of recovery is preferentially provided, when there is no the prime number reclaiming, produce new prime number for data tree administration module.
The effect of data tree administration module comprises:
1) create data tree
Create the root node of data tree, the data that set a property and characteristic, Fig. 5 for example, the attribute data of root node is 1, characteristic is 0;
2) add node
The father node that adds node is set, and from prime generation and administration module, obtain recovery or newly assigned prime number be set to add the attribute data of node; Characteristic is set to the product of all forerunner's nodal community data, as shown in Figure 6;
3) deletion of node
The father node of all child nodes of deletion of node is set to the father node of deletion of node, and characteristic is set to the characteristic of deletion of node; Recursively the characteristic of these child nodes and descendant node thereof is set to the attribute data of father node and the product of characteristic; The attribute data of deletion of node is recovered to prime generation and administration module, for example, in the data tree shown in Fig. 6, deletes by " software ", and the father node of all child nodes of " software " is set to " infotech ", regeneration characteristics data,, obtain data tree example as shown in Figure 7.
Wherein, in the situation that deletion of node does not exist child node, directly delete this node, reclaim its attribute data.
4) movable part limb
Specify a non-root node, by take its subtree that is root, move to the father node of another appointment, if the father node of this appointment is root node, the characteristic of the root node of subtree is for being set to 1; Otherwise, be set to the attribute data of father node and the product of characteristic.The characteristic of all the other nodes of subtree is the attribute data of its father node and the product of characteristic, Fig. 8 for example, and the subtree that is " software " by root node moves under " trade classification " node, and regeneration characteristics data obtain data tree as shown in Figure 9 after mobile.
Illustrative embodiment disclosed herein can be applied to various tree type grouped datas, for example kind judging under the document in DRS, industry subordinate relation, functional management mechanism subordinate relation, etc., below with the affiliated kind judging of the document in DRS, be specifically described:
The tree type data of example document management as shown in figure 10, the root node of this data tree is trade classification, and its attribute data is 1, and characteristic is 0; The child node of root node is respectively literature, attribute data 2, characteristic 1; Science and engineering, attribute data 3, characteristic 1; Scientific research, attribute data 5, characteristic 1; The child node of science and engineering is respectively physics, attribute data 7, characteristic 3; Chemistry, attribute data 11, characteristic is 3; The child node of physics is respectively quantum physics, attribute data 13, characteristic 21; General physics, attribute data 17, characteristic 21.
When if whether the one piece of document that needs judgement to belong to quantum physics belongs to science and engineering, the attribute data 13 of amount to obtain muon physics, characteristic 21; The attribute data 3 of science and engineering, characteristic 1; According to following formula, calculate:
The characteristic 21 of quantum physics is greater than the characteristic 1 of science and engineering, and 21%3=0, meets the condition of formula in 1., so belong to the document of quantum physics, also belongs to this classification of science and engineering.
In like manner, when whether the one piece of document that needs judgement to belong to quantum physics belongs to literature, because the characteristic 21 of quantum physics is greater than the characteristic 1 of literature, and 21%2 ≠ 0, do not meet the condition of formula in 1., do not meet the 2. 3. condition in 4. of formula yet, so belong to the document of quantum physics, do not belong to this classification of literature.
By above-mentioned computation process, can determine the relation between the two, effectively raise the efficiency that between document, relation is judged.
The explanation of above embodiment is just for helping to understand method of the present invention and core concept thereof., for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention meanwhile.

Claims (6)

1. a method for predicate node relation on tree type data, is characterized in that, comprising:
First node and Section Point on specified data tree, judge the relation between described first node and Section Point according to the attribute data of two nodes and characteristic;
Wherein, each node on described data tree has corresponding attribute data and characteristic, and the characteristic of the non-root node on described data tree is relevant to the attribute data of its all forerunner's nodes.
2. method according to claim 1, is characterized in that, before first node and Section Point on specified data tree, also comprises: set up described data tree, its step is as follows:
The root node that creates data tree, arranges its attribute data and characteristic;
According to design rule, add and deletion of node, and attribute data and the characteristic of interdependent node are set;
Described design rule is: the attribute data of each node is different prime number, and except root node, the characteristic of any one node is the product of its all forerunner's nodal community data.
3. method according to claim 2, is characterized in that, the attribute data of each node is set to different prime number, comprising:
From prime generation and administration module, obtain not used prime number, described prime number is the new prime number producing or the prime number reclaiming after deletion of node in data tree.
4. method according to claim 2, is characterized in that, while adding node on described data tree, also comprises:
On described data tree, specify a node as father node;
By prime generation and administration module, be that described interpolation node distributes a prime number as its attribute data, its characteristic is set to the product of all forerunner's nodal community data.
5. method according to claim 2, is characterized in that, during any one non-root node on deleting described data tree, also comprises:
The father node of all child nodes of deletion of node is set to the father node of described deletion of node, upgrades the characteristic of all descendant nodes of described deletion of node according to described design rule;
Prime generation and administration module reclaim the attribute data of described deletion of node.
6. method according to claim 2, is characterized in that, first node and Section Point on specified data tree are judged according to the attribute data of two nodes and characteristic and comprised the process of relation between described first node and Section Point:
Wherein, a is first node, and b is Section Point, M aand M bbe respectively the characteristic of a and b, P aand P bbe respectively the attribute data of a and b, < prerepresent that the former is the latter's forerunner ,=representing that both are same nodes, < > represents that both are the brotgher of node ,/represent that both are other relations.
CN201410345867.0A 2014-07-21 2014-07-21 Method for judging node relation on tree-shaped data Pending CN104199824A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410345867.0A CN104199824A (en) 2014-07-21 2014-07-21 Method for judging node relation on tree-shaped data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410345867.0A CN104199824A (en) 2014-07-21 2014-07-21 Method for judging node relation on tree-shaped data

Publications (1)

Publication Number Publication Date
CN104199824A true CN104199824A (en) 2014-12-10

Family

ID=52085117

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410345867.0A Pending CN104199824A (en) 2014-07-21 2014-07-21 Method for judging node relation on tree-shaped data

Country Status (1)

Country Link
CN (1) CN104199824A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107291588A (en) * 2016-04-13 2017-10-24 北京北方华创微电子装备有限公司 A kind of method and apparatus of generation XML daily records
CN110690997A (en) * 2019-10-10 2020-01-14 深圳前海微众银行股份有限公司 Node formatting method, device, equipment and readable storage medium
CN110704420A (en) * 2018-06-22 2020-01-17 北京世纪好未来教育科技有限公司 Method and device for realizing tree structure

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030069765A1 (en) * 2001-03-23 2003-04-10 Restaurant Services, Inc. System, method and computer program product for a bulletin board feature in a supply chain management framework
US20090119272A1 (en) * 2005-11-17 2009-05-07 Nishanth Sastry System and computer program product for nested categorization using factorization
CN101866410A (en) * 2010-04-30 2010-10-20 湖南大学 Methods for embedding watermarks in Java software and extracting watermarks from Java software

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030069765A1 (en) * 2001-03-23 2003-04-10 Restaurant Services, Inc. System, method and computer program product for a bulletin board feature in a supply chain management framework
US20090119272A1 (en) * 2005-11-17 2009-05-07 Nishanth Sastry System and computer program product for nested categorization using factorization
CN101866410A (en) * 2010-04-30 2010-10-20 湖南大学 Methods for embedding watermarks in Java software and extracting watermarks from Java software

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
吴艳 等: "基干DOM的XML文档素数编码算法", 《信息系统工程》 *
武文英 等: "基于PSB编码的小枝模式匹配算法", 《武汉理工大学学报》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107291588A (en) * 2016-04-13 2017-10-24 北京北方华创微电子装备有限公司 A kind of method and apparatus of generation XML daily records
CN107291588B (en) * 2016-04-13 2020-07-17 北京北方华创微电子装备有限公司 Method and device for generating XM L log
CN110704420A (en) * 2018-06-22 2020-01-17 北京世纪好未来教育科技有限公司 Method and device for realizing tree structure
CN110690997A (en) * 2019-10-10 2020-01-14 深圳前海微众银行股份有限公司 Node formatting method, device, equipment and readable storage medium

Similar Documents

Publication Publication Date Title
Anchalia et al. MapReduce design of K-means clustering algorithm
Zerhari et al. Big data clustering: Algorithms and challenges
Akiba et al. Linear-time enumeration of maximal k-edge-connected subgraphs in large networks by random contraction
WO2014107988A1 (en) Method and system for discovering and analyzing micro-blog user group structure
WO2021082100A1 (en) Method and apparatus for aligning entities of knowledge graph, device, and storage medium
CN111159184B (en) Metadata tracing method and device and server
Kumar et al. Utility-driven graph summarization
CN107807932B (en) Hierarchical data management method and system based on path enumeration
CN107832440B (en) Data mining method, device, server and computer readable storage medium
CN103150163A (en) Map/Reduce mode-based parallel relating method
CN103678550A (en) Mass data real-time query method based on dynamic index structure
Wu et al. Efficient personalized influential community search in large networks
Nguyen et al. An efficient algorithm for mining frequent weighted itemsets using interval word segments
CN104199824A (en) Method for judging node relation on tree-shaped data
CN109697206A (en) A kind of distributive function dependence method for digging
CN113704248B (en) Block chain query optimization method based on external index
Kawase et al. Stochastic solutions for dense subgraph discovery in multilayer networks
CN104123357B (en) A kind of method and apparatus of inquiry bayonet
Gavruskin et al. Dynamic algorithms for monotonic interval scheduling problem
WO2012161672A1 (en) System and method for configuration policy extraction
CN106055690B (en) A kind of quick-searching based on attributes match and acquisition data characteristics method
KR101067819B1 (en) Method and apparatus for document clustering using ontology
CN115982177A (en) Data collection method, device, equipment and medium based on tree dimensionality
US9542457B1 (en) Methods for displaying object history information
CN104778259A (en) High-efficiency data analyzing and processing method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 430070 East Lake Hubei Development Zone, Optics Valley Software Park, a phase of the west, South Lake Road South, Optics Valley Software Park, No. 2, No. 5, layer 205, six

Applicant after: Language network (Wuhan) Information Technology Co., Ltd.

Address before: 430073 East Lake Hubei Development Zone, Optics Valley Software Park, a phase of the west, South Lake Road South, Optics Valley Software Park, No. 2, No. 5, layer 205, six

Applicant before: Wuhan Transn Information Technology Co., Ltd.

CB02 Change of applicant information
RJ01 Rejection of invention patent application after publication

Application publication date: 20141210

RJ01 Rejection of invention patent application after publication