CN111597185A - Real-time state number rapid statistical method based on tree structure resource distribution - Google Patents

Real-time state number rapid statistical method based on tree structure resource distribution Download PDF

Info

Publication number
CN111597185A
CN111597185A CN202010252100.9A CN202010252100A CN111597185A CN 111597185 A CN111597185 A CN 111597185A CN 202010252100 A CN202010252100 A CN 202010252100A CN 111597185 A CN111597185 A CN 111597185A
Authority
CN
China
Prior art keywords
node
tree
resource
statistics
nodes
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
CN202010252100.9A
Other languages
Chinese (zh)
Other versions
CN111597185B (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.)
Shenzhen Infineon Information Co ltd
Original Assignee
Shenzhen Infinova Intelligent 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 Shenzhen Infinova Intelligent Technology Co Ltd filed Critical Shenzhen Infinova Intelligent Technology Co Ltd
Priority to CN202010252100.9A priority Critical patent/CN111597185B/en
Publication of CN111597185A publication Critical patent/CN111597185A/en
Application granted granted Critical
Publication of CN111597185B publication Critical patent/CN111597185B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2462Approximate or statistical queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/285Clustering or classification
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to the field of service systems, and particularly discloses a real-time state number rapid statistical method based on tree-structured resource distribution, which comprises the steps of constructing an organization tree or an area tree of an n-branch tree structure in a service system or a video monitoring system, and storing and displaying the distribution of resource data; hanging various resource data on each node of the n-branch tree as leaf nodes of the tree; when initializing the tree, counting the states of all leaf node resources under each non-leaf node of each layer from the deepest non-leaf node of the tree to the bottom up according to the layers, and storing a counting set under the nodes; when the state of a certain node resource changes, the shortest path is searched upwards to the root node, the nodes under the path are counted again, and the counting set under the nodes is updated. Therefore, the purpose of fast and real-time statistics of the states of the resources distributed in the tree is achieved.

Description

Real-time state number rapid statistical method based on tree structure resource distribution
Technical Field
The invention relates to the technical field of service systems, in particular to a real-time state number rapid statistical method based on tree structure resource distribution.
Background
The traditional service system, especially the security service application system, generally distributes and renders and displays various service resources in a tree structure. When the real-time statistics of various states of various resources is needed, the distribution and all the states of all the resources are usually stored in a relational database, such as mysql, oracle, sqlserver and the like, and then the resource state statistical result of each organization or area is obtained in a way of sql statement retrieval statistics; still another conventional method is to perform traversal statistics directly based on tree-like rendering and displayed resources, which is a way to perform real-time traversal and statistics on all nodes of a tree according to cycles or on demand, and each traversal and statistics will perform multiple accesses to sub-nodes. The above two conventional statistical methods have very low statistical performance and poor real-time performance when the tree has deep distribution layers and many resources, for example, the tree has more than 5 and 6 layers and the number of resources is tens of thousands to hundreds of thousands.
Disclosure of Invention
The invention aims to solve the defects in the prior art and provides a real-time state number rapid statistical method based on tree structure resource distribution.
In order to achieve the purpose, the invention adopts the following technical scheme:
a real-time state number rapid statistical method based on tree structure resource distribution comprises the following steps:
step S1, constructing an organization tree or an area tree of an n-branch tree structure for storing resource data and displaying resource distribution, wherein various service resources are used as leaf nodes of the tree;
step S2, counting the state of all leaf node resources under each non-leaf node in the tree according to the layer from bottom to top;
step S3, finding the shortest path to the root node, triggering the statistics of the resource state for the non-leaf node under the path.
Preferably, the n-ary tree includes nodes representing organizations or regions as non-leaf nodes of the tree.
Preferably, the n-ary tree includes nodes representing traffic resources as leaf nodes of the tree.
Preferably, in the n-ary tree, each non-leaf node stores the key attribute of the organization or region, and all leaf node resource state statistics data sets of the node.
Preferably, in the n-ary tree, each tree node may accurately access a parent node, and may also accurately access all child nodes.
Preferably, the step S2 includes the steps of:
step S21, when initializing service resource data and constructing n-branch tree, making first statistics on resource state according to organization or region node, and using the statistics as initial value of resource state statistics data set of each non-leaf node;
step S22, triggering layer-by-layer statistics when initializing or checking the resource state statistics set data of the tree node;
step S23, the calculation of the resource state statistical data set of each node of each layer depends on the resource state statistical data sets of all sub-nodes of the node and the resource state sets of leaf nodes under the node;
in step S24, the resource status of each leaf node is traversed and counted only once.
Preferably, in step S3, when the state of a leaf node resource changes, the shortest path is found from the parent node of the node to the root node, and the recalculation of the resource state statistics set is triggered for all nodes under the shortest path.
Preferably, the node statistics in the shortest path is performed by using a bottom-up manner and a child node performs statistics first, so that the resource state statistical data set of the parent node needs to be calculated by depending on the resource state statistical data set of the child node.
Preferably, the resource state statistical data set is classified according to resource types, classified according to resource states, and summed for the same state of the same type to obtain a data set.
The invention has the beneficial effects that:
the scheme provided by the invention adopts a method for carrying out statistics according to layers and shortest paths: the statistics of the initial state is carried out in a layer mode, and each node is visited at most once; the change of the resource state is processed in a shortest path mode, and the statistics and the updating are triggered only for the associated nodes, so that the purpose of accurate and rapid statistics is achieved, and the problems of low state statistics performance and low real-time performance of tree-shaped distributed resources in a service system are effectively solved.
Drawings
Fig. 1 is a logic diagram of a real-time status number fast statistical method based on tree-structured resource distribution according to the present invention.
Detailed Description
To facilitate an understanding of the invention, the invention will now be described more fully with reference to the accompanying drawings. Preferred embodiments of the present invention are shown in the drawings. This invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
It will be understood that when an element is referred to as being "secured to" another element, it can be directly on the other element or intervening elements may also be present. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or intervening elements may also be present. The terms "vertical," "horizontal," "left," "right," and the like as used herein are for illustrative purposes only and do not represent the only embodiments.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
Examples
Referring to fig. 1, the present embodiment provides a method for fast counting real-time status numbers based on tree-structured resource distribution, which includes the following steps:
step S1, constructing an organization tree or an area tree of an n-branch tree structure for storing resource data and displaying resource distribution, wherein various service resources are used as leaf nodes of the tree;
step S2, counting the state of all leaf node resources under each non-leaf node in the tree according to the layer from bottom to top;
step S3, finding the shortest path to the root node, triggering the statistics of the resource state for the non-leaf node under the path.
Further, the n-ary tree includes nodes representing organizations or regions as non-leaf nodes of the tree.
Further, the n-ary tree includes nodes representing traffic resources as leaf nodes of the tree.
Further, in the n-ary tree, each non-leaf node stores the key attribute of the organization or region, and all the leaf node resource state statistical data sets of the node.
Furthermore, in the n-ary tree, each tree node can accurately access a parent node and can also accurately access all child nodes.
Further, the step S2 includes the following steps:
step S21, when initializing service resource data and constructing n-branch tree, making first statistics on resource state according to organization or region node, and using the statistics as initial value of resource state statistics data set of each non-leaf node;
step S22, triggering layer-by-layer statistics when initializing or checking the resource state statistics set data of the tree node;
step S23, the calculation of the resource state statistical data set of each node of each layer depends on the resource state statistical data sets of all sub-nodes of the node and the resource state sets of leaf nodes under the node;
in step S24, the resource status of each leaf node is traversed and counted only once.
Further, in step S3, when the state of a leaf node resource changes, the shortest path is found from the parent node of the node to the root node, and the recalculation of the resource state statistics set is triggered for all nodes under the shortest path.
Furthermore, the node statistics in the shortest path is performed in a bottom-up manner, and the child nodes perform statistics first, so that the resource state statistical data set of the parent node needs to be calculated by depending on the resource state statistical data set of the child nodes.
Furthermore, the resource state statistical data set is classified according to resource types, classified according to resource states, and summed for the same state of the same type to obtain a data set.
Specifically, in the embodiment, an organization tree of an n-ary tree structure is constructed in a double-linked list manner, and organization nodes are divided into xxx provinces, xxx municipality and public bureau, xxx district (county) branch bureau, xxx place and xxx street according to the hierarchy from top to bottom, wherein the xxx province is used as a root node of the tree; hanging equipment resources such as cameras, decoders, NVRs and the like under provinces, cities, districts (counties), places and streets on corresponding nodes to serve as leaf nodes of the organization tree; the equipment resources are used as leaf nodes of the tree and store the current on-line, off-line, video recording, alarming, abnormal, normal and other state information of the equipment; and counting the state numbers of the equipment resources in all leaf nodes (including descendant leaf nodes) under each organization node from bottom to top of the organization node according to the layer from the deepest organization node.
Preferably, the counting the number of resource states of each organization node by layers includes:
(1) and calculating the state number of all leaf node equipment resources under the organization node.
(2) A resource state statistics data set of all sub-organization nodes under the organization node is obtained.
(3) And classifying according to the equipment type and the state category, classifying and summing the resource state number of the leaf nodes of the organization nodes and the resource state statistical data sets of the sub-organization nodes to obtain the resource state statistical data set of each organization node of each layer.
(4) And storing the resource state statistical data set on each organization node in a two-dimensional array structure mode to serve as a resource state statistical result of the organization node.
Further, when the state of a certain leaf node device resource changes, only the father node of the leaf node needs to be found, a shortest path is found from the father node to the root node xxx province, the street, the place, the district (county), the city and the province to which the device resource belongs are found, and then the statistics of the device resource state is triggered once for the organization nodes under the path.
Preferably, the counting of the device resource states of the organization nodes under the shortest path includes:
(1) from bottom to top, the device resource state number under the sub-organization node must be counted first, and the resource state statistical data set is updated.
(2) And the parent organization node counts the state number of the leaf node equipment resources.
(3) And acquiring a resource state statistical data set of the child organization by the parent organization node.
(4) Classifying according to the device type and the state category, classifying and summing the resource state number of the leaf node of the parent organization node and the resource state statistical data set of the child organization node to obtain and update the resource state statistical data set of the parent organization node.
The method utilizes the structural characteristics of the n-branch tree, respectively adopts the mode of according to the hierarchy and according to the shortest path to carry out real-time statistics on the tree-shaped distributed resources and the states thereof, and effectively solves the problem of low performance and poor real-time statistics based on SQL sentences and relational databases or by repeatedly traversing node trees.
If the organization structure of the tree is more than 5 layers, and the number of devices such as cameras, decoders, NVRs and the like is more than 30 ten thousand, the method can greatly improve the performance and the real-time performance of resource state statistics.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be considered to be within the technical scope of the present invention, and the technical solutions and the inventive concepts thereof according to the present invention should be equivalent or changed within the scope of the present invention.

Claims (9)

1. A real-time state number rapid statistical method based on tree structure resource distribution is characterized by comprising the following steps:
step S1, constructing an organization tree or an area tree of an n-branch tree structure for storing resource data and displaying resource distribution, wherein various service resources are used as leaf nodes of the tree;
step S2, counting the state of all leaf node resources under each non-leaf node in the tree according to the layer from bottom to top;
step S3, finding the shortest path to the root node, triggering the statistics of the resource state for the non-leaf node under the path.
2. The method of claim 1, wherein the n-ary tree includes nodes representing organizations or regions as non-leaf nodes of the tree.
3. The method of claim 1, wherein the n-ary tree includes nodes representing traffic resources as leaf nodes of the tree.
4. The method of claim 1, wherein each non-leaf node in the n-ary tree stores the key attributes of the organization or region and all the leaf node resource state statistics data sets of the node.
5. The method of claim 1, wherein each tree node in the n-ary tree has an accurate access to a parent node and an accurate access to all child nodes.
6. The method for fast statistics of real-time status count based on tree structure resource distribution as claimed in claim 1, wherein said step S2 comprises the steps of:
step S21, when initializing service resource data and constructing n-branch tree, making first statistics on resource state according to organization or region node, and using the statistics as initial value of resource state statistics data set of each non-leaf node;
step S22, triggering layer-by-layer statistics when initializing or checking the resource state statistics set data of the tree node;
step S23, the calculation of the resource state statistical data set of each node of each layer depends on the resource state statistical data sets of all sub-nodes of the node and the resource state sets of leaf nodes under the node;
in step S24, the resource status of each leaf node is traversed and counted only once.
7. The method as claimed in claim 1, wherein in step S3, the finding of the shortest path to the root node and the statistics of the states of the node resources occur when the state of a leaf node resource changes, and the finding of the shortest path is performed from the parent node of the node to the root node, and the recalculation of the resource state statistics set is triggered for all nodes under the shortest path.
8. The method as claimed in claim 7, wherein the statistics of nodes in shortest path are performed from bottom to top, and the sub-nodes perform statistics first, so that the resource state statistics data set of the parent node needs to be calculated depending on the resource state statistics data sets of the sub-nodes.
9. The method as claimed in claim 4, 6 or 8, wherein the resource state statistical data set is classified according to resource type, classified according to resource state, and summed with the same state of the same type to obtain a data set.
CN202010252100.9A 2020-04-01 2020-04-01 Real-time state number rapid statistical method based on tree structure resource distribution Active CN111597185B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010252100.9A CN111597185B (en) 2020-04-01 2020-04-01 Real-time state number rapid statistical method based on tree structure resource distribution

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010252100.9A CN111597185B (en) 2020-04-01 2020-04-01 Real-time state number rapid statistical method based on tree structure resource distribution

Publications (2)

Publication Number Publication Date
CN111597185A true CN111597185A (en) 2020-08-28
CN111597185B CN111597185B (en) 2023-04-28

Family

ID=72187298

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010252100.9A Active CN111597185B (en) 2020-04-01 2020-04-01 Real-time state number rapid statistical method based on tree structure resource distribution

Country Status (1)

Country Link
CN (1) CN111597185B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116501781A (en) * 2023-06-28 2023-07-28 中博信息技术研究院有限公司 Data rapid statistical method for enhanced prefix tree
CN116527982A (en) * 2023-06-01 2023-08-01 杭州威灿科技有限公司 Method and system for recording question synchronous audio and video

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100191716A1 (en) * 2009-01-25 2010-07-29 Qiming Chen Structured parallel data intensive computing
CN103036795A (en) * 2011-05-23 2013-04-10 北京广联智能科技有限公司 Method and system for tree topology channel sharing network routing
CN103678138A (en) * 2014-01-03 2014-03-26 北京经纬恒润科技有限公司 Method and device for generating state conversion test samples
CN103699593A (en) * 2013-12-11 2014-04-02 中国科学院深圳先进技术研究院 Method and system for rapidly traversing generalized suffix tree
CN104283707A (en) * 2013-07-08 2015-01-14 株式会社日立制作所 Device and method for monitoring multistage tree structure system in real time
CN107590160A (en) * 2016-07-08 2018-01-16 阿里巴巴集团控股有限公司 A kind of method and device for monitoring radix tree internal structure
CN110162525A (en) * 2019-04-17 2019-08-23 平安科技(深圳)有限公司 Read/write conflict solution, device and storage medium based on B+ tree
CN110928851A (en) * 2019-10-12 2020-03-27 中国平安财产保险股份有限公司 Method, device and equipment for processing log information and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100191716A1 (en) * 2009-01-25 2010-07-29 Qiming Chen Structured parallel data intensive computing
CN103036795A (en) * 2011-05-23 2013-04-10 北京广联智能科技有限公司 Method and system for tree topology channel sharing network routing
CN104283707A (en) * 2013-07-08 2015-01-14 株式会社日立制作所 Device and method for monitoring multistage tree structure system in real time
CN103699593A (en) * 2013-12-11 2014-04-02 中国科学院深圳先进技术研究院 Method and system for rapidly traversing generalized suffix tree
CN103678138A (en) * 2014-01-03 2014-03-26 北京经纬恒润科技有限公司 Method and device for generating state conversion test samples
CN107590160A (en) * 2016-07-08 2018-01-16 阿里巴巴集团控股有限公司 A kind of method and device for monitoring radix tree internal structure
CN110162525A (en) * 2019-04-17 2019-08-23 平安科技(深圳)有限公司 Read/write conflict solution, device and storage medium based on B+ tree
CN110928851A (en) * 2019-10-12 2020-03-27 中国平安财产保险股份有限公司 Method, device and equipment for processing log information and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
胡维;蒋艳凰;刘光明;董文睿;崔新武;: "E级超级计算机故障预测的数据采集方法" *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116527982A (en) * 2023-06-01 2023-08-01 杭州威灿科技有限公司 Method and system for recording question synchronous audio and video
CN116527982B (en) * 2023-06-01 2023-09-15 杭州威灿科技有限公司 Method and system for recording question synchronous audio and video
CN116501781A (en) * 2023-06-28 2023-07-28 中博信息技术研究院有限公司 Data rapid statistical method for enhanced prefix tree
CN116501781B (en) * 2023-06-28 2023-09-12 中博信息技术研究院有限公司 Data rapid statistical method for enhanced prefix tree

Also Published As

Publication number Publication date
CN111597185B (en) 2023-04-28

Similar Documents

Publication Publication Date Title
CN103412897B (en) A kind of parallel data processing method based on distributed frame
Papadias et al. Efficient OLAP operations in spatial data warehouses
CN109657074B (en) News knowledge graph construction method based on address tree
US7698257B2 (en) Apparatus and method for recursively rationalizing data source queries
CN107545046A (en) A kind of fusion method and device of multi-source heterogeneous data
CN108038222A (en) System for Information System Modeling and entity-property frame of data access
CN106933833A (en) A kind of positional information method for quickly querying based on Spatial Data Index Technology
Anwar et al. Capturing the spatiotemporal evolution in road traffic networks
CN106326637A (en) Link predicting method based on local effective path degree
CN111597185A (en) Real-time state number rapid statistical method based on tree structure resource distribution
CN108009265B (en) Spatial data indexing method in cloud computing environment
Kan et al. Topology modeling and analysis of a power grid network using a graph database
Ding et al. Massive heterogeneous sensor data management in the Internet of Things
CN111639075A (en) Non-relational database vector data management method based on flattened R tree
US20060080282A1 (en) Data management method and storage medium storing data management program
CN114153821A (en) Electric quantity graph database construction and search method based on graph theory
Aydin et al. Batch to real-time: Incremental data collection & analytics platform
CN105956012B (en) Database schema abstract method based on figure partition strategy
Challal et al. Document-oriented versus column-oriented data storage for social graph data warehouse
CN110275922B (en) Familial graph analysis technology based on graph database
US11556532B2 (en) Hash trie based optimization of database operations
Marple et al. Collapsing corporate confusion: Leveraging network structures for effective entity resolution in relational corporate data
CN111400278A (en) Method and system for constructing multi-level target crowd based on label dragging
WO2014177201A1 (en) Method and system for storing geometrical objects in a database
Zulkarnain et al. Big Data Governance for Building A Smart Cities

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
TA01 Transfer of patent application right

Effective date of registration: 20230106

Address after: 518000 Yingfei Haocheng Science Park, Guansheng 5th Road, Luhu Community, Guanhu Street, Longhua District, Shenzhen, Guangdong 1515

Applicant after: Shenzhen Infineon Information Co.,Ltd.

Address before: 518110 Room 301, Infineon Technology Co., Ltd., No. 12, Guanbao Road, Luhu community, Guanhu street, Longhua District, Shenzhen City, Guangdong Province

Applicant before: SHENZHEN INFINOVA INTELLIGENT TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant