WO2006038498A1 - 配列の生成方法、及び、配列生成プログラム - Google Patents

配列の生成方法、及び、配列生成プログラム Download PDF

Info

Publication number
WO2006038498A1
WO2006038498A1 PCT/JP2005/017794 JP2005017794W WO2006038498A1 WO 2006038498 A1 WO2006038498 A1 WO 2006038498A1 JP 2005017794 W JP2005017794 W JP 2005017794W WO 2006038498 A1 WO2006038498 A1 WO 2006038498A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
vertex
nodes
array
root
Prior art date
Application number
PCT/JP2005/017794
Other languages
English (en)
French (fr)
Inventor
Shinji Furusho
Original Assignee
Turbo Data Laboratories Inc.
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 Turbo Data Laboratories Inc. filed Critical Turbo Data Laboratories Inc.
Priority to CA002581219A priority Critical patent/CA2581219A1/en
Priority to KR1020077005216A priority patent/KR101254544B1/ko
Priority to EP05787558A priority patent/EP1811383A1/en
Priority to JP2006539235A priority patent/JP4712718B2/ja
Priority to US11/576,481 priority patent/US20090106289A1/en
Publication of WO2006038498A1 publication Critical patent/WO2006038498A1/ja

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/901Indexing; Data structures therefor; Storage structures
    • G06F16/9027Trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16BBIOINFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR GENETIC OR PROTEIN-RELATED DATA PROCESSING IN COMPUTATIONAL MOLECULAR BIOLOGY
    • G16B10/00ICT specially adapted for evolutionary bioinformatics, e.g. phylogenetic tree construction or analysis

Definitions

  • the present invention relates to a method for generating an array representing a tree type data structure, and more particularly to a method for expressing a tree type data structure and constructing it on a storage device.
  • the present invention also relates to an information processing apparatus that implements such a method.
  • the invention further relates to a program for carrying out such a method.
  • RDB relational databases
  • the second reason for the inefficiency is that it takes time to express the search results. If you try to express a node group that hits the search, you must also express the node that is a descendant of that node, but unlike the RDBMS, the data structure is atypical, so to express the descendant node It takes time.
  • RDB which is the mainstream of databases
  • a method of converting tree-format data to RDB for example, see Patent Document 1. Proposed.
  • RDB data is broken down into tables. Therefore, to convert the actual tree format data into RDB, it is necessary to push the tree format data into the table.
  • system construction based on RDB is a very laborious work.
  • An example approach to creating a database of XML data as is is to take a copy of the data entered in the tree structure. For example, if the item is "age" Separate search index data is stored (for example, see Patent Document 2). This makes full use of the merits of XML data that allows attributes to be added to the data itself, and allows the relational structure of each item expressed using tags to be stored as is.
  • Patent Document 1 Japanese Unexamined Patent Publication No. 2003-248615
  • Patent Document 2 Japanese Patent Laid-Open No. 2001-195406
  • Non-Patent Document 1 SECK, Inc., "Karearea White Paper", [online], [February 19, 2004 search], Internet ⁇ URL: http: //www.sec. Co.jp/products/karearea /
  • Non-Patent Document 2 W3C, "Extensible Markup Language (XML) 1.0 (ThirdEdition)", [onli ne], February 4, 2004, [Search February 19, 2004], Internet URL: http: ⁇ www .w3.org / TR / 2004 / REC-xml-20040204 />
  • this mechanism can also be used for searches involving relationships between nodes (for example, a tree containing “60 years” t and “age” as ancestors and “1 year” t and “age” as descendants). It cannot be used for (extraction).
  • the fundamental problem of such a conventional technique is that the tree-type data structure is expressed by focusing on only individual data and connecting the nodes that store the data with pointers.
  • the relationship between them for example, parent-child, ancestor, descendant, sibling (generation), generation, etc., cannot be traced efficiently.
  • the value of the pointer is not constant, it cannot be used for the purpose of indicating the data storage address, and the relationship between the nodes cannot be expressed directly.
  • an object of the present invention is to provide a representation of a tree-type data structure and a method related to construction that can efficiently trace the relationship between the data of the tree-type data structure.
  • an object of the present invention is to provide an information processing apparatus related to the construction of a tree-type data structure that can efficiently trace the relationship between the data of the tree-type data structure.
  • an object of the present invention is to provide a tree-type data structure representation that can efficiently trace the relationship between the data of the tree-type data structure and a program related to the construction.
  • An object is to provide a method, an information processing apparatus, and a program for moving a vertex node in a tree-type data structure.
  • An object of the present invention is to provide a node identifier unique to each node, a node identifier assigned to each of non-root nodes whose parent-child relationship between nodes is a node other than the root 'node, A pair consisting of a parent node identifier associated with each of the nodes
  • each vertex node having a node identifier stored in the second array is
  • the new third array stores the node identifiers of the vertex nodes after movement in any of the parent node, child node, brother node, or brother node.
  • the reference point for tracing the location nose can be appropriately changed, and tracing of data having a tree-type data structure can be facilitated.
  • the same generation of nodes is given priority over the child nodes, and consecutive integers unique to the nodes including the root 'node are given,
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • the same generation node is given priority over the child node, and a continuous integer unique to the node including the root node is given.
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • a unique consecutive integer is given to the node including the root node in favor of the same generation of nodes over the child nodes.
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • a node including the root node is given a unique consecutive integer in preference to a node of the same generation over a child node
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • a unique consecutive integer is assigned to a node including a root node in preference to a child node over a node of the same generation
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • a unique consecutive integer is given to the node including the root node in favor of the child node over the same generation of nodes
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • a child node is given priority over a node of the same generation, and a continuous integer unique to the node including the root node is given,
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • the child node is given priority over the node of the same generation, and a continuous integer unique to the node including the root node is given,
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • an object of the present invention is to provide a node identifier assigned to each non-root node in which a node identifier unique to the node is given and a parent-child relationship between the nodes is a node other than the root node.
  • a computer program readable by a computer comprising data of a tree-type data structure represented by a first array consisting of pairs of node identifiers of parent nodes associated with each of the non-root 'nodes.
  • the computer is provided with a second array storing the node identifiers with the specific node as a vertex node. Steps, Referring to the first array, each vertex node having a node identifier stored in the second array is
  • the same generation of nodes is given priority over the child nodes, and a unique consecutive integer is given to the node containing the root 'node,
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • the computer In the step of generating the third array to move each of the vertex nodes to child nodes, the computer
  • the same generation node is given priority over the child node, and a continuous integer unique to the node including the root node is given.
  • the first array includes integers assigned to each parent node of the non-root 'node in order of integers assigned to non-root' nodes that are nodes other than the root 'node. Formed by lining up,
  • the computer In the step of generating the third array to move each of the vertex nodes to a parent node, the computer
  • successive integers unique to the node including the root node are given in preference to the same generation of nodes over the child nodes
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • the computer In the step of generating the third array to move each of the vertex nodes to an older brother node, the computer
  • a unique consecutive integer is assigned to a node including a root node in preference to a node of the same generation over a child node
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • step of generating the third array to move each of the vertex nodes to a brother node Identifying a first node identifier stored in a position corresponding to the node identifier of the vertex node in the first array;
  • successive integers specific to nodes including the root 'node are given priority over child nodes over nodes of the same generation
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • the computer In the step of generating the third array to move each of the vertex nodes to child nodes, the computer
  • the child node is given priority over the node of the same generation, and a continuous integer unique to the node including the root node is given,
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • the computer In the step of generating the third array to move each of the vertex nodes to a parent node, the computer
  • the node identifier of the node identifier of the vertex node after the movement is stored in the corresponding position
  • the step of determining as a child is executed.
  • a unique consecutive integer is given to a node including a root 'node in favor of a child node over a node of the same generation
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • the computer In the step of generating the third array to move each of the vertex nodes to an older brother node, the computer
  • a successive integer unique to the node containing the root 'node is given in preference to the child node over the same generation of nodes
  • the first array is formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • a fifth node identifier that is larger than the value of the node identifier storage position of the vertex node and stored in the value storage position is equal to the first node identifier.
  • an array generation for representing one or more node groups including a specific node and its descendant nodes, and a method, information processing apparatus, and program for processing the array It becomes possible to do.
  • FIG. 1 is a block diagram showing a hardware configuration of a computer system that handles a tree-type data structure that is useful in the embodiment of the present invention.
  • this computer system 10 has the same configuration as a normal one, and the CPU 12 that controls the entire system and individual components by executing programs, RAM that stores work data, etc. Random Access Memory) 14, ROM (Read 0 nly Memory) for storing programs, etc. 16, Fixed storage medium 18 such as hard disk, CD-ROM driver 20 for accessing CD-ROM 19, CD-ROM driver 20 and external Network (not shown) Interface (IZF) 22, an input device 24 composed of a keyboard and a mouse, and a CRT display device 26.
  • CPU12, RAM14 the same configuration as a normal one, and the CPU 12 that controls the entire system and individual components by executing programs, RAM that stores work data, etc. Random Access Memory) 14, ROM (Read 0 nly Memory) for storing programs, etc. 16, Fixed storage medium 18 such as hard disk, CD-ROM driver 20 for accessing CD-ROM 19, CD-ROM
  • ROM 16 external storage medium 18, I / F 22, input device 24, and display device 26 are connected to each other via bus 28.
  • a program for constructing a tree-type data structure on a storage device and a program for converting the tree-type data structure on the storage device according to the present embodiment are accommodated in a CD-ROM 19, and a CD-ROM driver 20 may be read or stored in the ROM 16 in advance. Also, once read from CD-ROM19, external storage medium 1
  • the program may be supplied from the outside via a network (not shown), an external terminal, and the IZF 22.
  • the information processing apparatus converts a program for building a tree-type data structure on the storage device in the computer system 10 and a tree-type data structure on the storage device. This is realized by executing the program.
  • FIGS. 2A and 2B are explanatory diagrams of POS data, which is an example of tree format data
  • FIG. 2A is an example of a visual representation of the data structure (ie, topology) and data values of this tree format data
  • Figure 2B is an example of the same tree format data expressed in XML format.
  • such a tree-type data structure is expressed by connecting nodes that store data with pointers.
  • the pointer representation has the disadvantage that the pointer value is not necessary. That is, in some cases, a specific node A is stored at a certain address (for example, address 100), and in other cases, the same node A is stored at another address (for example, address 200).
  • a pointer value that is not constant is essentially the storage address of the node Is merely an expression. Therefore, for example, when nodes are connected with a pointer according to the depth priority rule, it is difficult to reconnect these nodes with a pointer according to the width priority rule.
  • FIGS. 3A to 3C are explanatory diagrams of an example of an expression format of a tree type data structure using an arc list.
  • Figure 3A shows the entire tree data structure. In Fig.
  • FIG. 3A shows the numbers in the center of a figure such as a circle or heart shape represent the node ID, and the pair of numbers such as 0, 10> on the side of the arrow and arrow represent an arc. ing.
  • the node ID is not limited to a character string, and may be a numeric value, particularly an integer.
  • FIG. 3B shows an arc list from a parent node (From—ID) to a child node (To—ID), and
  • FIG. 3C shows a node list consisting of a list of node ID and node type pairs. Note that there is no need for a node list for the purpose of simply representing a tree-type data structure. In principle, by using such an arc list, the relationship between nodes can be described directly without using pointers.
  • the arc list is described based on a “parent ⁇ child” relationship in which a child node is associated with a parent node. Therefore, since there are three child nodes 10, 60, and 80 in one parent node, for example, root 'node 0, the same node ID 0 appears three times in the From—ID of the arc list. ing. In other words, since the child node cannot be specified even if the parent node is specified, the arc list is composed of the element From—ID array and the element To—ID array. When using an arc list, a node appears in both the From—ID array and the To—ID array.
  • the parent-child relationship can also be expressed by a “child ⁇ parent” relationship.
  • the parent-child relationship between the nodes is represented by an array of pairs of each of the non-root nodes that are nodes other than the root 'node and the associated parent node.
  • This ⁇ child ⁇ parent '' When a parent-child relationship is expressed by a relationship, there is a powerful and important property that cannot be obtained in the case of a “parent ⁇ child” relationship. That is, since only one parent node always corresponds to one child node, the only parent node corresponding to this child node can be immediately identified by specifying the child node.
  • the arc list actually requires only an array of element To-IDs. As a result, the storage capacity for storing the arc list is reduced. This reduction in storage capacity has the effect of reducing the number of accesses to the memory, and as a result, high-speed processing can be realized.
  • FIGS. 4A to 4C are explanatory diagrams of a method for representing a tree-type data structure based on a “child ⁇ parent” relationship according to an embodiment of the present invention.
  • 4A is an explanatory diagram of the entire tree
  • FIG. 4B is an arc list based on the “child ⁇ parent” relationship. Since the arc list in Fig. 4B includes the storage area of the parent node for the root node, "-" is set as the parent node of the root node for convenience. Since there is no corresponding parent node, the storage area of the parent node for the root node may be excluded from the arc list based on the “child ⁇ parent” relationship, as shown in FIG. 4C.
  • a parent-child relationship between nodes is expressed by associating a parent node of a non-root 'node with each non-root' node that is a node other than the root 'node. . Then, the node power of the child expressed as “child ⁇ parent” can express the tree topology by hitting the list of parent nodes.
  • a tree-type data structure based on such a "child-to-parent" relationship is routed to the computer system 10 shown in FIG. 1 as shown in FIG.
  • the parent-child relationship defining step 502 for associating the node identifier assigned to the parent node is executed on the RAM 14.
  • Node identifier power of child node The tree topology can be expressed by subtracting (lookup) the node identifier of the parent node.
  • the node definition step uses a numerical value as the node identifier, more preferably a consecutive integer, and more preferably an integer sequence number from 0 or 1.
  • the node identifier of the parent node corresponding to the node is stored from the node identifier, and the address can be easily obtained. Therefore, the node identifier child power of the child node is subtracted. Processing can be performed at high speed.
  • the depth priority mode that prioritizes the child node over the node of the same generation and the width priority mode that prioritizes the node of the same generation over the child node are used as the rules for assigning the numbers.
  • FIGS. 6A to 6C are explanatory diagrams of processing for converting tree structure type data in the ID format into tree structure type data in the integer serial number format according to one embodiment of the present invention.
  • Fig. 6A shows tree-structured data with each node assigned an ID number
  • Fig. 6B shows conversion rules
  • Fig. 6C shows a tree structure with each node assigned an integer sequence number.
  • Type data is shown.
  • the conversion rule in this example is a rule that assigns serial numbers with depth priority. Specifically, when there are multiple child nodes, the minimum number is assigned to the first child (top brother) node. Assign a higher number to the youngest child (bottom brother) node, and give the child node a priority over the sibling node. In this example, numbering is performed in ascending order, but numbering may be performed in descending order.
  • FIGS. 7A to 7C are explanatory diagrams of processing for converting tree structure type data in the ID format into tree structure type data in the integer serial number format according to another embodiment of the present invention.
  • Fig. 7A shows tree-structured data with ID numbers assigned to each node
  • Fig. 7B shows conversion rules
  • Fig. 7C shows a tree structure with integer sequential numbers assigned to each node.
  • Type data is shown.
  • the conversion rule of this example is a rule that assigns consecutive numbers with width priority. Specifically, when there are multiple child nodes, the smallest number is assigned to the first child (top brother) node, and the last child ( The youngest younger brother) gives the node a higher number and sibling nodes than child nodes Give priority number. In this example, numbers are assigned in ascending order, but numbers may be assigned in descending order.
  • the address where the stored value for the node is stored can be subtracted.
  • the parent node can be drawn immediately from the child node, that is, in the order of O (l).
  • a tree-type data structure based on depth priority as shown in FIG. 6C is stored in the computer system 10 shown in FIG.
  • An array formed by arranging the integers assigned to each parent node of the non-root node in the order of the integers assigned to each of the non-root nodes that are nodes other than the root node is stored in the storage device.
  • nodes are assigned consecutive integers with depth priority, and the parent-child relationship between nodes is represented by an array of “child-to-parent” relationships.
  • FIG. 8 is a flowchart of node definition processing based on depth priority according to an embodiment of the present invention. This node definition process is performed by computer system 10.
  • step 802 for assigning the number next to the number assigned to that particular node to the child node; If there is more than one child node in a given node, the brother node is assigned the next number after all the descendant nodes of the immediately above brother node are numbered according to the sibling relationship between the child nodes.
  • Step 803 for assigning numbers from the top brother node to the bottom brother node so that
  • FIG. 9 is an explanatory diagram of an array of parent-child relationships based on the “child ⁇ parent” expression created from the depth-first tree data structure shown in FIG. 6C according to one embodiment of the present invention. As shown as subtree 1 or subtree 2 in the figure, the parent-child relationship of nodes assigned consecutive numbers with depth priority is arranged based on the “child ⁇ parent” relationship. An excellent property that grandchild nodes appear in a continuous region is obtained.
  • a value greater than or equal to an integer assigned to a certain node is stored from the array! All descendant nodes of the certain node are specified by extracting the continuous region. Thereby, a node group representing a descendant node of a certain node can be acquired as a continuous block in the array. For example, if the size of a continuous block is m, the processing speed for specifying all descendant nodes of a node is on the order of O (m).
  • FIG. 10 is an explanatory diagram of an array of parent-child relationships based on the created “parent ⁇ child” expression. Since there can be a plurality of child nodes for one parent node, the parent-child relationship array stores the child node number for each node, an array Aggr for indicating the area, and the child node number. It is composed of two arrays, P ⁇ C, in which the numbers of the nodes are stored.
  • the value of the second element Aggr [1] from the beginning of the array Aggr is "3", which means that the number of the child node for the node [1] is the element P ⁇ C of the array P ⁇ C [3] Indicates that it is stored after.
  • the node [0] that is, the child node for the root node is the three elements from the beginning of the array P ⁇ C, P ⁇ C [0] 1, P ⁇ C [1] 6, and P ⁇ C [2] is 8.
  • the Aggr value is also obtained for the numbering power of the parent node shown in bold in the figure. This Aggr value represents the starting point of the array P ⁇ C.
  • parent-child relationship based on the expression “parent ⁇ child” can be expressed more simply by two arrays, an array of parent node numbers and an array of corresponding child node numbers.
  • log (n) access time is required, which is inefficient.
  • a tree-type data structure based on breadth-first as shown in FIG. 7C is stored in the computer system 10 shown in FIG.
  • a node definition step that gives priority to a node of the same generation over a child node and gives a unique continuous integer to a node including a root node;
  • the array formed by arranging the integers assigned to each parent node of the non-root 'node in the order of the integers assigned to each of the non-root' nodes that are nodes other than the root 'node.
  • nodes are given consecutive integers in the breadth-first mode, and the parent-child relationship between nodes is expressed by an array of “child ⁇ parent” relationships.
  • FIG. 11 is a flowchart of note definition processing based on width priority according to an embodiment of the present invention. This node definition process is performed by the computer system 10
  • First 1102 assigning a number to the root node
  • the parent node is different for all nodes included in the next generation until no node exists in the next generation of the generation.
  • numbers are assigned to the nodes in the order in which the numbers are assigned to the parent nodes, and when the parent nodes are the same, a plurality of A step in which sibling relations are defined between child nodes, and unique integers that change continuously from the number assigned immediately before from the top brother node to the bottom brother node are assigned in order. 1013 and
  • FIG. 12 is an explanatory diagram of an array of parent-child relationships based on the “child ⁇ parent” expression created from the breadth-first tree data structure shown in FIG. 7C according to one embodiment of the present invention.
  • the parent-child relationship of nodes given consecutive numbers with breadth priority is arranged based on the “child-to-parent” relationship, the child nodes of a certain node appear in a continuous region. Properties are obtained. This is because when the parent-child relationship of nodes assigned consecutive numbers in the breadth-first mode is expressed based on the “child ⁇ parent” relationship, the numbers assigned to the parent nodes are ordered (ascending or descending) in the array. ) By appearing.
  • a continuous area in which the same value as the integer assigned to a certain node is stored is extracted from the array.
  • all child nodes of the certain node are specified.
  • a child node of a node can be searched using a technique such as binary search, that is, it can be searched in the order of O (log (n)).
  • FIG. 13 is an explanatory diagram of an array of parent-child relationships based on the created “parent ⁇ child” expression, with the breadth-first tree type data structure shown in FIG. 7C.
  • Figure 13 Sece there can be multiple child nodes for one parent node, the parent-child relationship array contains an array Aggr to indicate the area where the child node number for each node is stored, Consists of two arrays P ⁇ C that store numbers.
  • the value of the second element Aggr [1] from the beginning of the array Aggr is "3", which means that the child node number for the node [1] is the element P ⁇ C [3] of the array P ⁇ C It is stored after that !.
  • the child node for node [0] that is, the root 'node is the three elements from the beginning of the array P ⁇ C, P ⁇ C [0] 1, P ⁇ C [1] 2, and P ⁇ C [2] is 3.
  • a method for obtaining an array of parent-child relationships based on this “parent ⁇ child” expression will be described.
  • the Aggr value is also obtained for the numbering power of the parent node shown in bold in the figure. This Aggr value represents the starting point of the array P ⁇ C.
  • the value of the node closest to the root node is to represent the node and all nodes from that node to the leaf node (end point).
  • a node group from a certain node and from that node to a leaf 'node is referred to as a partial tree.
  • the node closest to the above node (root 'node) is called the vertex node.
  • FIG. 14A is a diagram showing a tree-type data structure based on the above-described breadth-first mode
  • FIG. 14B is a diagram showing an array of a parent-child relationship based on the tree-type data structure based on the expression “child ⁇ parent”.
  • vertex node [4] contains node identifier ⁇ 4, 8, 9 ⁇
  • vertex node [6] contains node identifier ⁇ 6 ⁇
  • vertex node [3] contains node identifier Includes ⁇ 3, 7, 10, 11 ⁇ .
  • Such an array composed of a plurality of vertex nodes is referred to as a vertex node list.
  • a plurality of partial trees can be specified by the vertex node list, and the plurality of specified partial trees are called a partial tree group.
  • the vertex node list is represented as [a, b,.
  • “a”, “,”,... are node identifiers corresponding to the vertex nodes.
  • each vertex node constituting the vertex node list is expanded and node identifiers of all nodes included in the partial tree having the vertex node as a vertex are obtained. If there is only one node identifier in the obtained list of node identifiers, that is, if node identifiers do not appear in duplicate, this is the case.
  • Such a partial tree group is referred to as a “regular partial tree group”.
  • Such a partial tree group is called “non-normal subtree group”.
  • the vertex tree list can identify a partial tree group including a vertex node and its descendant nodes.
  • the vertex node list [4, 6, 3] can be used to create a partial tree group (partial trees ⁇ 4, 8, 9 ⁇ , ⁇ 6 ⁇ , ⁇ 3, 7, 10, 11 ⁇ ) is specified.
  • the partial tree group specified by the vertex node list can be a target of search, aggregation, sorting, and set operation.
  • FIGS. 15A and 15B when a partial tree including a “heart-shaped” node is searched, a partial tree group as shown in FIG. 16B is obtained.
  • Figure 16A shows the top node list representing this subtree group.
  • an array 1701 is a vertex node list
  • an array 1702 is an array indicating the number of nodes belonging to the partial tree specified by each vertex node.
  • sorting by the number of nodes belonging to each partial tree can be considered as sorting.
  • an array 1801 is a sorted vertex node list
  • an array 1802 is an array indicating the number of nodes belonging to the partial tree specified by the vertex node list.
  • FIG. 18B shows a state where the partial tree is sorted according to the number of nodes.
  • logical product will be described as a set operation between a plurality of partial tree groups.
  • the partial tree group shown in FIG. 19B (the corresponding vertex node list is shown in FIG. 19A) and the partial tree group shown in FIG. 19D (the corresponding vertex node list is shown in FIG. 19C).
  • the logical product will be described as a set operation between a plurality of partial tree groups.
  • FIG. 19B compares the partial tree 1901 identified by the vertex node with the node identifier “4” and the partial tree 1 911 identified by the vertex node identifier with the node identifier “1” in FIG. 19D. Then, the partial tree 1901 is included in the partial tree 1902. A partial tree that has an inclusive relationship with the partial tree 1902 in FIG. 19B does not exist in the partial tree group shown in FIG. 19D. In addition, the partial tree 1903 identified by the vertex node of the node identifier “3” in FIG. 19B and the partial tree identified by the node identifier “7” in FIG. 19D are displayed. Compared to Lee 1913, the partial tree 1913 is included in the partial tree 1903. As a result, the vertex node list indicating the result of the logical product operation is [4, 7] as shown in Fig. 20A. FIG. 20B shows a partial tree group corresponding to the result of the logical product operation.
  • the vertex node list (in addition to this, an array that stores the aggregation results (number of nodes) of the same size as the vertex node list) ) Can represent the result of each process or operation.
  • the vertex node is located at the parent node, but if you want to get a list of all children, you can move the vertex node from mother to child. Even in the case of a vertex node list of a normal partial tree group, the vertex node list after moving the vertex node is not necessarily a normal partial tree group, and may be a non-normal partial tree group.
  • the vertex node with the node identifier “2” moves to the node with the node identifier “6”, and the vertex node with the node identifier “3” moves to the node with the node identifier “7”.
  • the vertex node list representing the vertex nodes after movement is [4, 5, 6, 7] as shown in FIG. 21C.
  • the vertex node is moved to a node corresponding to “parent”.
  • the vertex node with the node identifier “4” and the vertex node with the node identifier “5” move to the node with the node identifier “1”, respectively.
  • the vertex node with the node identifier “6” moves to the node with the node identifier “2”, and the vertex node with the node identifier “7” moves to the node with the node identifier “3”.
  • the vertex node list representing the moved vertex nodes is [1, 1, 2, 3].
  • the vertex nodes are of the same generation and immediately below
  • the node of the “younger brother” the node of the same generation and the same parent node is moved to the node having the closest node identifier.
  • the “younger brother” node is a node of the same generation as the vertex node, and the arc is connected after the arc is connected from the parent node of the vertex node to the vertex node.
  • the “brother” node is a node of the same generation as the vertex node, and the node to which the arc is connected before the arc is connected to the parent node power vertex node of the vertex node. I think.
  • the vertex node with the node identifier “1” moves to the node with the node identifier “2”, and the vertex node with the node identifier “2” has the node identifier “3”. Move to the node.
  • the vertex node with the node identifier “3” disappears because there is no “younger brother” node. Therefore, as shown in FIG. 23C, the vertex node list representing the vertex node after the movement is [2, 3].
  • FIG. 24 is a flowchart showing processing executed in the computer system 10 when moving a vertex node to a node corresponding to a child.
  • the computer system 10 refers to the value of the vertex node list in which the node identifier of the vertex node is stored (step 2401), and the value of the vertex node list (node) in the C—P array. Search for the same value as (identifier) (step 2402).
  • the computer system 10 stores the node identifier of the node having the same value as the node identifier of the vertex node in the CP array in the new vertex node list (step 2403).
  • the new vertex node list stores the node identifier of the vertex node moved to the node corresponding to the child. Is done.
  • the vertex node list is [1, 2, 3]. Paying attention to the vertex node (see arrow) of node identifier “1”, as a result of searching C—P array, for node identifiers “4” and “5”, the value in C—P array “ This is the same as “1” (see Figure 25B). Therefore, the values “4” and “5” are stored in the new vertex node list. In the CP array in the breadth-first mode, since the values are in ascending order, the search in step 2402 is easy. As a result of executing the same processing for the values “2” and “3” in other vertex node lists, a new vertex node list [4, 5, 6, 7] can be obtained.
  • FIG. 26 is a flowchart showing processing executed in the computer system 10 when moving a vertex node to a node corresponding to a parent (parent node).
  • the computer system 10 refers to the value of the vertex node list (step 2601), and acquires the value of the CP array indicated by the value of the vertex node list (step 2602).
  • the computer system 10 stores the acquired value in a new vertex node list (step 2603).
  • the new vertex node list contains the node identifier of the vertex node moved to the node corresponding to the parent. Stored. [0095] In FIG.
  • the vertex node list is considered to be [4, 5, 6, 7]. Focusing on the vertex node with node identifier “4” (see arrow), the value of the CP array corresponding to node identifier “4” is “1”, so this value is stored in the new vertex node list. . Similarly, for the node identifiers “5”, “6” and “7” of other nodes stored in the vertex node list, the corresponding C—P array values are “1” and “2”, respectively. ”,“ 3 ”. Therefore, the new vertex node list is [1, 1, 2, 3].
  • FIG. 28 is a flowchart showing processing executed in the computer system 10 when a vertex node is moved to a node corresponding to a younger brother (younger brother node).
  • the computer system 10 refers to the value of the vertex node list (step 2801) and acquires the value of the C—P array (node identifier) indicated by the value of the vertex node list (step 2801). 28 02). Subsequently, the computer system 10 acquires the value (node identifier) of the C—P array indicated by the next value of the vertex node (in this embodiment, the value obtained by adding “1” to the original value). (Step 2803).
  • the computer system 10 compares the two acquired values, and if the two values match (Yes in step 2804), the computer system 10 sets the next value (node identifier) to the new vertex. Store in the node list (step 2805). On the other hand, if the two do not match, it is determined that if the vertex node that is the object of processing moves, it will disappear.
  • the computer system 10 By executing the processing of steps 2601 to 2603 for all the values in the vertex node list (see step 2806), the computer system 10 is moved to the node corresponding to the younger brother in the new vertex node list. The node identifier of the selected vertex node is stored.
  • the vertex node list is considered to be [4, 5, 6, 7]. Paying attention to the vertex node of node identifier “4” (see arrow), the value of CP array corresponding to node identifier “4” is “1” and the value of C—P array corresponding to node identifier “5” Is also "1". Therefore, since both match, the node identifier “5” is stored in the new vertex node list. For node identifiers “5”, “6” and “7”, respectively, the value of the CP array corresponding to itself and the value of the CP array corresponding to the value obtained by adding “1” to its own value Because of the difference, the vertex node disappears. Therefore, the new vertex node list is [5].
  • the vertex node list If the value of the CP array indicated by the node identifier in the node is compared with the value of the CP array indicated by the node identifier preceding the node identifier (that is, the node identifier whose value is “1”), Good.
  • the processing executed in the computer system 10 when moving the vertex node to the node corresponding to the child is the same as that shown in FIG. Note that the values are not in ascending order in the CP array in depth-first mode. However, the node corresponding to the child is the C—P array indicated by the node identifier from the node identifier next to the node identifier in the vertex node list (in this embodiment, “1” is added to the value). It appears in the range of the node that is one node before the node identifier that is smaller than the value of the vertex node list (in this embodiment, a node identifier that is “1” smaller than such a node identifier).
  • the computer system 10 uses the node in the vertex node list as the reference node, that is, the next position of the reference node (that is, A search pointer is placed at the position indicated by the node identifier obtained by adding “1” to the node identifier of the reference node (step 3001), and the value of the C—P array indicated by the search pointer is specified (step 3002). It is then determined whether the identified value is the same as the node identifier of the reference node (step 3003). If it is determined as Yes in step 3003, the computer system 10 stores the node identifier where the search pointer is located in the new vertex node list (step 3004). Thereafter, the search pointer is advanced by one (step 3005).
  • step 3006 it is determined whether the value is equal to or greater than the node identifier of the value standard node in the CP array (step 3006). If yes in step 3006, the node identifier node where the search pointer is located Is a descendant of the reference node, the search pointer is advanced by one for the next processing (step 3005). If NO in step 3006, the node with the node identifier where the search pointer is located is not a descendant of the vertex node, so the processing is terminated.
  • the vertex node list is [1, 6, 8]. Focus on the vertex node (see arrow) with node identifier “1”. Initially, the search pointer is placed at the position of node identifier “2”. At this time, since the value of the CP array indicated by the search pointer is “1”, the node identifier “2” is stored in the new vertex node list.
  • the search pointer when the search pointer is placed at the node identifier “5”, the value of the C—P array indicated by the search pointer is “1”, so the node identifier “5” is Stored in the new vertex node list. Thereafter, when the search pointer is positioned at the node identifier “6”, the value of the CP array indicated by the search pointer is “0”, which is smaller than the node identifier “1” of the reference node. Ends.
  • FIG. 33 is a flowchart showing processing executed in the computer system 10 when moving a vertex node to a node corresponding to a younger brother.
  • the converter system 10 refers to the value of the vertex node list (step 3301), and acquires the value (node identifier) of the C—P array indicated by the value of the vertex node list (step 3302). ).
  • the computer system 10 searches for a node identifier having the same C—P array value after the next node identifier (a node identifier whose value is larger by “1”) (step 3303). If the same value is found (Yes in Step 3304), the computer system 10 stores the node identifier having the value in the new vertex node list (Step 3305). If the same value is not found, it is determined that the vertex node has disappeared.
  • the computer system executes the processing of steps 3301 to 3305 for all the values of the vertex node list (step 3306), and the vertex node moved to the node corresponding to the younger brother is displayed in the new vertex node list. Is stored.
  • the vertex node list is [2, 5, 7, 9]. Focusing on the vertex node with node identifier “2”, the value of the CP array corresponding to the node identifier is “1”. Since the node identifier “5” having the value “l” in the C—P array can be searched by the process of FIG. 33, the node identifier “5” is stored in the top node list.
  • the same value cannot be found by searching the CP array.
  • the node with the same number as the parent node cannot be found. Therefore, these vertex nodes disappear by movement.
  • the vertex node list of the new vertex node is “5”.
  • FIG. 35 is a functional block diagram of an information processing apparatus 3500 that constructs a tree-type data structure that is useful in one embodiment of the present invention, generates a vertex node list, and generates a vertex node list after the movement of the vertex node. It is a diagram. This information processing apparatus 3500 is actually realized by installing a necessary program in the computer system 10 shown in FIG.
  • the information processing device 3500 includes a storage unit 3501 that stores data representing a tree-type data structure and a vertex node list, and a node identifier that is unique to the node including the root node. And a node definition unit 3502 that stores the node identifier in the storage unit 3501, and a node identifier assigned to each of the non-root node that is a node other than the root node.
  • the vertex node list generated by the vertex node list generation unit 35 and the new vertex node list generated by the vertex node movement processing unit 3505 are stored in the storage unit 3501.
  • the node definition unit 3502 uses a numerical value as the node identifier, and more preferably uses a continuous integer as the node identifier.
  • the parent-child relationship defining unit 3503 stores in the storage unit 3501 an array of pairs of node identifiers assigned to each non-root node and node identifiers assigned to the associated parent node.
  • the vertex node list generation unit 3504 displays the node identifier of the designated node in the vertex node list. Store.
  • an instruction from the input device gives an instruction to move the vertex node (moving to the node corresponding to the parent, moving to the node corresponding to the child, moving to the node corresponding to the brother).
  • the vertex node movement processing unit 3505 acquires the CP array and the vertex node list from the storage unit 3501, generates a new vertex node list, and stores it in the storage unit 3501.
  • FIG. 1 is a block diagram of a computer system that handles a tree-type data structure useful for an embodiment of the present invention.
  • Figs. 2A and 2B are explanatory diagrams of POS data, which is an example of tree format data.
  • Fig. 2 is a visual representation of the data structure (ie, topology) and data values of this tree format data.
  • Fig. 2B is an example of the same tree format data expressed in XML format.
  • FIGS. 3A to 3C are explanatory diagrams of examples of expression formats of tree-type data structures using arc lists, respectively.
  • FIGS. 4A to 4C are explanatory diagrams of a method for expressing a tree-type data structure based on a “child ⁇ parent” relationship according to an embodiment of the present invention.
  • FIG. 5 is a flowchart of a method for constructing a tree-type data structure on a storage device according to an embodiment of the present invention.
  • FIGS. 6A to 6C are diagrams for explaining processing for converting tree structure type data in the ID format into tree structure type data in the integer serial number format according to one embodiment of the present invention.
  • FIGS. 7A to 7C are explanatory diagrams of processing for converting tree structure type data in an ID format into tree structure type data in an integer serial number format according to another embodiment of the present invention.
  • FIG. 8 is a flowchart of node definition processing based on depth priority according to an embodiment of the present invention.
  • FIG. 9 is an explanatory diagram of an array of parent-child relationships based on the “child ⁇ parent” expression created according to one embodiment of the present invention.
  • FIG. 10 is an explanatory diagram of an array of parent-child relationships based on the “parent ⁇ child” expression created from the depth-first tree-type data structure shown in FIG. 6C.
  • FIG. 11 is a flowchart of node definition processing based on width priority according to an embodiment of the present invention.
  • FIG. 12 is an explanatory diagram of an array of parent-child relationships based on a “child ⁇ parent” expression created according to an embodiment of the present invention.
  • FIG. 13 is an explanatory diagram of an array of parent-child relationships based on the “parent ⁇ child” representation created from the breadth-first tree-type data structure shown in FIG. 7C.
  • FIG. 14A is a diagram showing a tree-type data structure based on the breadth-first mode
  • FIG. 14B is a diagram showing an array of a parent-child relationship based on the tree-type data structure based on a “child ⁇ parent” expression.
  • FIG. 15A is a diagram showing an example of a vertex node list
  • FIG. 15B is a diagram showing an example of a partial tree group specified by the vertex node list.
  • FIG. 16A is a diagram showing an example of a vertex node list obtained by the search process
  • FIG. 16B is a diagram showing an example of a partial tree group specified by the vertex node list.
  • FIG. 17A is an example of an array showing a vertex node list and a result of aggregation obtained by the aggregation process
  • FIG. 17B is a diagram showing an example of a partial tree group specified by the vertex node list.
  • FIG. 18A is a vertex node list sorted by the number of nodes and an example of an array indicating the number of corresponding nodes
  • FIG. 18B is a diagram showing an example of a partial tree specified by the vertex node list. .
  • FIGS. 19A and 19C are examples of vertex node lists to be subjected to a logical product operation, respectively.
  • B and D are diagrams each showing an example of a partial tree group specified by the vertex node list.
  • FIG. 20A is an example of a vertex node list showing a result of a logical product operation
  • FIG. 20B is a diagram showing a partial tree group specified by the vertex node list.
  • FIG. 21A is a vertex node list that is useful for this embodiment
  • FIG. 21B is an example of a tree in which the vertex nodes are indicated by arrows
  • FIG. 21C is a diagram in which the vertex nodes are moved to nodes corresponding to children
  • FIG. 21D is a diagram showing an example of a tree in which the moved vertex nodes are indicated by arrows.
  • FIG. 22A is a vertex node list that is useful for the present embodiment
  • FIG. 22B is an example of a tree in which the vertex nodes are indicated by arrows
  • FIG. 22C is a diagram in which the vertex nodes are moved to the node corresponding to the parent
  • FIG. 22D is a diagram showing an example of a tree in which the moved vertex nodes are indicated by arrows.
  • FIG. 23A is a vertex node list that is useful for the present embodiment
  • FIG. 23B is an example of a tree in which the vertex nodes are indicated by arrows
  • FIG. 23C is moved to a node corresponding to the younger brother
  • FIG. 23D is a diagram showing an example of a tree in which the moved vertex nodes are indicated by arrows.
  • FIG. 24 is a flowchart showing processing executed in the computer system when moving a vertex node to a node corresponding to a child.
  • FIG. 25A is a diagram illustrating an example of a tree
  • FIG. 25B is a diagram illustrating processing for moving a vertex node to a node corresponding to a child.
  • FIG. 26 is a flowchart showing processing executed in the computer system when a vertex node is moved to a node corresponding to a parent.
  • FIG. 27A is a diagram showing an example of a tree
  • FIG. 27B is a diagram for explaining processing for moving a vertex node to a node corresponding to a parent.
  • FIG. 28 is a flowchart showing processing executed in the computer system when a vertex node is moved to a node corresponding to a younger brother.
  • FIG. 29A is a view showing an example of a tree
  • FIG. 29B is a view for explaining processing for moving a vertex node to a node corresponding to a younger brother.
  • FIG. 30 is a diagram that is executed by a computer system when searching for a node corresponding to a child.
  • Fig. 31A is a diagram illustrating an example of a tree
  • Fig. 31B is a diagram illustrating a process of moving a vertex node to a node corresponding to a child.
  • FIG. 32A is a diagram showing an example of a tree
  • FIG. 32B is a diagram for explaining processing for moving a vertex node to a node corresponding to a parent.
  • FIG. 33 is a flowchart showing processing executed in the computer system when a vertex node is moved to a node corresponding to a younger brother.
  • FIG. 34A is a diagram showing an example of a tree
  • FIG. 34B is a diagram illustrating processing for moving a vertex node to a node corresponding to a younger brother.
  • FIG. 35 is a functional block diagram of an information processing apparatus that builds a tree-type data structure and a vertex node list on a storage device that are useful in the present embodiment.

Abstract

 ツリー型データ構造のデータ間の、例えば、親子、祖先、子孫、兄弟、世代などの関係を効率的にトレースできるツリー型データ構造の表現方法を提供する。メモリには、ノードに固有のノード識別子が付与され、ノード間の親子関係がルート・ノード以外のノードである非ルート・ノードの各々に付与されたノード識別子と非ルート・ノードの各々に関連付けられた親ノードのノード識別子との組からなるC-P配列によって表現されたツリー型データ構造のデータと、それぞれが特定のノード及びその子孫のノードを含む1以上のノード群を表わすために、特定のノードを頂点ノードとして、そのノード識別子を格納した頂点ノードリストとが設けられる。システム10は、C-P配列を参照して、頂点ノードの各々を、子ノード、親ノード或いは頂点ノードと同世代のノード(兄ノード又は弟ノード)に移動させ、新たな頂点ノードリストを生成する。

Description

明 細 書
配列の生成方法、及び、配列生成プログラム
技術分野
[0001] 本発明はツリー型データ構造を表わす配列の生成方法、特に、ツリー型データ構 造を表現し、記憶装置上に構築する方法に関する。また、本発明は、かかる方法を 実施する情報処理装置に関する。更に、本発明は、かかる方法を実行するためのプ ログラムに関する。
背景技術
[0002] データベースは種々の用途に用いられている力 中規模ないし大規模システムに おいては、論理的な矛盾が排除できるリレーショナルデータベース (RDB)の使用が 主流となっている。たとえば、 RDBは飛行機の座席予約等のシステムに利用されて いる。この場合、キー項目を指定することにより、(多くの場合 1件の)ターゲットを迅速 に検索することもでき、或いは、予約の確定、キャンセル或いは変更などを行うことが できる。また、各便の座席数はせいぜい数百であるため、特定の航空便の空席数を 求めることも可能である。
[0003] このような RDBは、表形式データの取り扱いに適している力 ツリー形式データの 取り扱いには適していないことが知られている(例えば、非特許文献 1を参照。 ) o
[0004] 更に、アプリケーションの中には、表形式による表現よりもツリー形式による表現の 方が適しているものが存在する。特に、近年、イントラネットやインターネットのアプリケ ーシヨンのデータ標準として、ツリー型データ構造を採用する XMLが普及している( XMLの詳細については、例えば、非特許文献 2を参照。 )0
[0005] しかし、ツリー型データ構造の取り扱い、例えば、ツリー形式データの検索は、一般 に、大変効率が悪い。この効率の悪さの第 1の理由は、データが各所のノードに分散 して存在するため、データの存在すべき場所を直ちに特定することが困難である点 にある。 RDBでは、例えば、「年齢」というデータは、あるテーブルの「年齢」という項 目だけに格納されている。しかし、ツリー型データ構造では、「年齢」というデータを保 持するノードが各所に散在しているので、一般的には、ツリー型データ構造の全体を 調べなければ、該当するデータを検索することができない。
[0006] 効率の悪さの第 2の理由は、検索の結果を表現するために時間が力かるという点に ある。検索にヒットしたノード群を表現しょうとすると、屡々、そのノードの子孫にあたる ノードも表現しなければならな 、が、 RDBMSとは異なりデータ構造が非定型である ため、子孫ノードを表現するために時間が力かる。
[0007] そこで、データベースの主流である RDBの利点をいかすため、従来、ツリー型デー タ構造をデータベース化するとき、ツリー形式データを RDB化する方法 (例えば、特 許文献 1を参照。)が提案されている。 RDBでは、データはテーブル (表)に分解して 保持される。そのため、実際のツリー形式データを RDB化するには、ツリー形式デー タをテーブルに押し込める必要がある。しかし、様々のツリー型データ構造を取り扱う ためには、その構造毎に個別にデータをテーブルに押し込め、システム設計を行わ なければならない。したがって、 RDBに基づくシステム構築は非常に手間の力かる作 業である。
[0008] これに対して、ツリー形式データ、特に、 XMLデータをそのままの形でデータべ一 ス化する方法も提案されている。ツリー型データ構造の場合、一つのノードに子孫ノ ードをぶら下げることができ、多様な表現が可能であるため、システム設計の手間を 大幅に削減することができる。したがって、 XMLのようなツリー構造を取り扱える技術 を核として、ツリー構造データを処理することへのニーズが高まって 、る。
[0009] XMLデータをそのままの形でデータベース化する方法の一例のアプローチは、ッ リー構造に記入されているデータのコピーを取り出し、例えば、「年齢」という項目であ れば、「年齢」の検索用インデックスデータを別途保持する(例えば、特許文献 2を参 照。;)。これにより、データ自身に属性を付加できるという XMLデータのメリットを十分 に活用すると共に、タグを用いて表現された各項目の関係構造をそのまま記憶できる ようにしている。
特許文献 1 :特開 2003— 248615号公報
特許文献 2:特開 2001— 195406号公報
非特許文献 1 :株式会社セック、 "Karearea White Paper", [online], [平成 16年 2月 1 9日検索」、インターネット < URL:http://www.sec. co.jp/products/karearea/ 非特許文献 2 :W3C、 "Extensible Markup Language (XML) 1.0 (ThirdEdition)", [onli ne]、 2004年 2月 4日、 [平成 16年 2月 19日検索]、インターネットく URL:http:〃 www .w3.org/TR/2004/REC-xml-20040204/>
発明の開示
発明が解決しょうとする課題
[0010] しかし、検索用インデックスデータを別途保持するようなアプローチでは、少なくとも データは二重に保持され、かつ、インデックスを作成するコスト及びインデックスを格 納するためのデータ領域が必要となり、大規模なデータを保持する上で不利である。
[0011] 実際、このようなメカニズムによって、実際に検索を行い、ノードを特定したとしても、 そのノードを表現するためには時間がかかる。また、このメカニズムは、ノード間の関 係を問題とする検索 (例えば、祖先に「60歳」 t 、う「年齢」を含み、子孫に「1歳」 t 、 う「年齢」を含むツリーの抽出)には利用できない。
[0012] このような従来技術の根本的な問題点は、個々のデータのみに着目し、データを蓄 えたノード間をポインタで接続することによりツリー型データ構造が表現されているた め、データ間の関係、例えば、親子、祖先、子孫、兄弟 (シブリング)、世代などの関 係を効率的にトレースすることができないことにある。換言すると、ポインタは、その値 が一定しないため、データの格納アドレスを示すという用途にし力使用できず、ノード 間の関係を直接的に表現することができない。
[0013] そこで、本発明は、ツリー型データ構造のデータ間の関係を効率的にトレースする ことができるツリー型データ構造の表現、および、構築に関する方法の提供を目的と する。
[0014] 更に、本発明は、ツリー型データ構造のデータ間の関係を効率的にトレースするこ とができるツリー型データ構造の構築に関する情報処理装置の提供を目的とする。
[0015] 更に、本発明は、ツリー型データ構造のデータ間の関係を効率的にトレースするこ とができるツリー型データ構造の表現、および、構築に関するプログラムの提供を目 的とする。
[0016] また、ツリー型データ構造を取り扱う際には、ロケーションパスをたどる基準点となる 、頂点となるノード (頂点ノード)を移動する必要も生じる。そこで、特に、本発明は、ッ リー型データ構造における頂点ノードを移動させる方法、情報処理装置およびプログ ラムを提供することを目的とする。
課題を解決するための手段
[0017] 本発明の目的は、ノードに固有のノード識別子が付与され、ノード間の親子関係が ルート'ノード以外のノードである非ルート'ノードの各々に付与されたノード識別子と 、非ルート ·ノードの各々に関連付けられた親ノードのノード識別子との組からなる第
1の配列によって表現された、ツリー型データ構造のデータを備えたコンピュータに おいて、
それぞれが特定のノードおよびその子孫のノードを含む 1以上のノード群を表わす ために、当該特定のノードを頂点ノードとして、そのノード識別子を格納した第 2の配 列を設けるステップと、
前記第 1の配列を参照して、前記第 2の配列にノード識別子が格納された頂点ノー ドの各々を、
a)当該頂点ノードとアークで直接結ばれ、かつ、当該アークが頂点ノードから延びて いるような子ノード、
b)当該頂点ノードとアークで直接結ばれ、かつ、当該アークがそこ力 頂点ノードま で延びるような親ノード、
c)当該頂点ノードと同世代のノードであって、当該頂点ノードの親ノードから頂点ノー ドに対してアークが接続される以前に、アークが接続されている兄ノード、並びに、 d)当該頂点ノードと同世代のノードであって、当該頂点ノードの親ノードから頂点ノー ドに対してアークが接続された後に、アークが接続される弟ノード
の何れかに移動させて、移動後の新たな頂点ノードのノード識別子を格納した第 3 の配列を生成するステップと、を備えたことを特徴とする配列の生成方法により達成さ れる。
[0018] 本発明において、新たな第 3の配列には、親ノード、子ノード、兄ノード或いは弟ノ ードの何れかに移動後の頂点ノードのノード識別子が格納される。これにより、ロケ一 シヨンノ スをたどる基準点を適切に変更することができ、ツリー型データ構造のデータ のトレース等を容易にすることができる。 [0019] 好ましい実施態様においては、子ノードよりも同じ世代のノードを優先して、ルート' ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、子ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子が格納された格納位置を特定するス テツプと、
移動後の頂点ノードのノード識別子を、当該格納位置に対応するノード識別子と決 定するステップと、を有する。
[0020] また、好ましい実施態様においては、子ノードよりも同じ世代のノードを優先して、ル ート 'ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、親ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納されたノード 識別子を特定するステップと、
移動後の頂点ノードのノード識別子を、前記対応する位置に格納されたノード識別 子と決定するステップと、を有する。
[0021] 別の実施態様においては、子ノードよりも同じ世代のノードを優先して、ルート'ノー ドを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、兄ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納された第 1の ノード識別子を特定するステップと、
前記第 1の配列中、前記頂点ノード識別子に対応する位置の値より 1だけ小さい値 の格納位置に格納された第 2のノード識別子を特定するステップと、
前記第 1のノード識別子と、第 2のノード識別子とがー致する場合に、前記移動後 の頂点ノード識別子を、前記第 2のノード識別子の格納位置に対応するノード識別子 と決定するステップと、を有する。
[0022] さらに別の実施態様においては、子ノードよりも同じ世代のノードを優先して、ルー ト ·ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、弟ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納された第 1の ノード識別子を特定するステップと、
前記第 1の配列中、前記頂点ノード識別子に対応する位置の値より 1だけ大きい値 の格納位置に格納された第 3のノード識別子を特定するステップと、
前記第 1のノード識別子と、第 3のノード識別子とがー致する場合に、前記移動後 の頂点ノード識別子を、前記第 3のノード識別子の格納位置に対応するノード識別子 と決定するステップと、を有する。
[0023] さらに別の実施態様においては、同じ世代のノードよりも子ノードを優先して、ルー ト ·ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、子ノードに移動させるため、前記第 3の配列を生成する ステップが、
前記第 1の配列中、頂点ノードのノード識別子が格納された格納位置を特定するス テツプと、
移動後の頂点ノードのノード識別子を、当該格納位置に対応するノード識別子と決 定するステップと、を有する。
[0024] 別の実施態様においては、同じ世代のノードよりも子ノードを優先して、ルート'ノー ドを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、親ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納されたノード 識別子を特定するステップと、
移動後の頂点ノードのノード識別子を、前記対応する位置に格納されたノード識別 子と決定するステップと、を有する。
[0025] また、別の実施態様においては、同じ世代のノードよりも子ノードを優先して、ルート •ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、兄ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子の格納位置に格納された第 1のノー ド識別子を特定するステップと、
前記第 1の配列中、頂点ノードのノード識別子の格納位置の値より小さい値の格納 位置に格納された、当該第 1のノード識別子と等しい第 4のノード識別子を検索する ステップと、 前記第 4のノード識別子の格納位置のうち、最大の格納位置を特定するステップと 前記移動後の頂点ノードのノード識別子を、前記最大の格納位置に対応するノー ド識別子と決定するステップと、を有する。
[0026] また、別の実施態様においては、同じ世代のノードよりも子ノードを優先して、ルート •ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、弟ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子の格納位置に格納された第 1のノー ド識別子を特定するステップと、
前記第 1の配列中、頂点ノードのノード識別子の格納位置の値より大き 、値の格納 位置に格納された、当該第 1のノード識別子と等しい第 5のノード識別子を検索する ステップと、
前記第 5のノード識別子の格納位置のうち、最小の格納位置を特定するステップと 前記移動後の頂点ノードのノード識別子を、前記最大の格納位置に対応するノー ド識別子と決定するステップと、を有する。
[0027] また、本発明の目的は、ノードに固有のノード識別子が付与され、ノード間の親子 関係がルート'ノード以外のノードである非ルート'ノードの各々に付与されたノード識 別子と、非ルート'ノードの各々に関連付けられた親ノードのノード識別子との組から なる第 1の配列によって表現された、ツリー型データ構造のデータを備えたコンビュ ータにより読み取り可能なコンピュータプログラムであって、前記コンピュータに、 それぞれが特定のノードおよびその子孫のノードを含む 1以上のノード群を表わす ために、当該特定のノードを頂点ノードとして、そのノード識別子を格納した第 2の配 列を設けるステップと、 前記第 1の配列を参照して、前記第 2の配列にノード識別子が格納された頂点ノー ドの各々を、
a)当該頂点ノードとアークで直接結ばれ、かつ、当該アークが頂点ノードから延びて いるような子ノード、
b)当該頂点ノードとアークで直接結ばれ、かつ、当該アークがそこ力 頂点ノードま で延びるような親ノード、
c)当該頂点ノードと同世代のノードであって、当該頂点ノードの親ノードから頂点ノー ドに対してアークが接続される以前に、アークが接続されている兄ノード、並びに、 d)当該頂点ノードと同世代のノードであって、当該頂点ノードの親ノードから頂点ノー ドに対してアークが接続された後に、アークが接続される弟ノード
の何れかに移動させて、移動後の新たな頂点ノードのノード識別子を格納した第 3 の配列を生成するステップと、を実行させることを特徴とする配列生成プログラムによ つても達成される。
[0028] 好ましい実施態様においては、子ノードよりも同じ世代のノードを優先して、ルート' ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、子ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子が格納された格納位置を特定するス テツプと、
移動後の頂点ノードのノード識別子を、当該格納位置に対応するノード識別子と決 定するステップと、を実行させる。
[0029] また、好ましい実施態様においては、子ノードよりも同じ世代のノードを優先して、ル ート 'ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、親ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納されたノード 識別子を特定するステップと、
移動後の頂点ノードのノード識別子を、前記対応する位置に格納されたノード識別 子と決定するステップと、を実行させる。
[0030] 別の実施態様においては、子ノードよりも同じ世代のノードを優先して、ルート'ノー ドを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、兄ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納された第 1の ノード識別子を特定するステップと、
前記第 1の配列中、前記頂点ノード識別子に対応する位置の値より 1だけ小さい値 の格納位置に格納された第 2のノード識別子を特定するステップと、
前記第 1のノード識別子と、第 2のノード識別子とがー致する場合に、前記移動後 の頂点ノード識別子を、前記第 2のノード識別子の格納位置に対応するノード識別子 と決定するステップと、を実行させる。
[0031] さらに別の実施態様においては、子ノードよりも同じ世代のノードを優先して、ルー ト ·ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、弟ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、 前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納された第 1の ノード識別子を特定するステップと、
前記第 1の配列中、前記頂点ノード識別子に対応する位置の値より 1だけ大きい値 の格納位置に格納された第 3のノード識別子を特定するステップと、
前記第 1のノード識別子と、第 3のノード識別子とがー致する場合に、前記移動後 の頂点ノード識別子を、前記第 3のノード識別子の格納位置に対応するノード識別子 と決定するステップと、を実行させる。
[0032] 好ましい実施態様においては、同じ世代のノードよりも子ノードを優先して、ルート' ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、子ノードに移動させるため、前記第 3の配列を生成する ステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子が格納された格納位置を特定するス テツプと、
移動後の頂点ノードのノード識別子を、当該格納位置に対応するノード識別子と決 定するステップと、を実行させる。
[0033] また、好ま U、実施態様にぉ 、ては、同じ世代のノードよりも子ノードを優先して、ル ート 'ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、親ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納されたノード 識別子を特定するステップと、
移動後の頂点ノードのノード識別子を、前記対応する位置に格納されたノード識別 子と決定するステップと、を実行させる。
[0034] 別の好ましい実施態様においては、同じ世代のノードよりも子ノードを優先して、ル ート 'ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、兄ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子の格納位置に格納された第 1のノー ド識別子を特定するステップと、
前記第 1の配列中、頂点ノードのノード識別子の格納位置の値より小さい値の格納 位置に格納された、当該第 1のノード識別子と等しい第 4のノード識別子を検索する ステップと、
前記第 4のノード識別子の格納位置のうち、最大の格納位置を特定するステップと 前記移動後の頂点ノードのノード識別子を、前記最大の格納位置に対応するノー ド識別子と決定するステップと、を実行させる。
[0035] さらに好ましい実施態様においては、同じ世代のノードよりも子ノードを優先して、 ルート'ノードを含むノードに固有の連続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、弟ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子の格納位置に格納された第 1のノー ド識別子を特定するステップと、
前記第 1の配列中、頂点ノードのノード識別子の格納位置の値より大き 、値の格納 位置に格納された、当該第 1のノード識別子と等しい第 5のノード識別子を検索する ステップと、
前記第 5のノード識別子の格納位置のうち、最小の格納位置を特定するステップと
前記移動後の頂点ノードのノード識別子を、前記最大の格納位置に対応するノー ド識別子と決定するステップと、を実行させる。
発明の効果
[0036] 本発明によれば、ツリー型データ構造のデータ間の関係を効率的にトレースするこ とができるツリー型データ構造の表現、および、構築に関する方法を提供することが 可能となる。
[0037] 更に、本発明によれば、ツリー型データ構造のデータ間の関係を効率的にトレース することができるツリー型データ構造の構築に関する情報処理装置を提供することが 可能となる。
[0038] 更に、本発明によれば、ツリー型データ構造のデータ間の関係を効率的にトレース することができるツリー型データ構造の表現、および、構築に関するプログラムを提供 することが可能となる。
[0039] 特に、本発明によれば、特定のノードおよびその子孫のノードを含む 1以上のノード 群を表わすための配列の生成および当該配列を処理する方法、情報処理装置およ びプログラムを提供することが可能となる。 発明を実施するための最良の形態
[0040] 以下、添付図面を参照して、本発明の実施の形態について説明する。
[0041] [コンピュータシステム構成]
図 1は、本発明の実施の形態に力かるツリー型データ構造を取り扱うコンピュータシス テムのハードウェア構成を示すブロックダイヤグラムである。図 1に示すように、このコ ンピュータシステム 10は、通常のものと同様の構成であり、プログラムを実行すること によりシステム全体および個々の構成部分を制御する CPU12、ワークデータなどを 記憶する RAM(Random Access Memory) 14、プログラム等を記憶する ROM(Read 0 nly Memory) 16,ハードディスク等の固定記憶媒体 18、 CD—ROM19をアクセスす るための CD— ROMドライバ 20、 CD—ROMドライバ 20や外部ネットワーク(図示せ ず)と接続された外部端子との間に設けられたインタフェース (IZF) 22、キーボード やマウスからなる入力装置 24、 CRT表示装置 26を備えている。 CPU12、 RAM 14
、 ROM16、外部記憶媒体 18、 I/F22,入力装置 24および表示装置 26は、バス 28 を介して相互に接続されて!ヽる。
[0042] 本実施の形態にかかる、ツリー型データ構造を記憶装置上に構築するプログラム、 及び、ツリー型データ構造を記憶装置上で変換するプログラムは、 CD— ROM19に 収容され、 CD— ROMドライバ 20に読取られても良いし、 ROM16に予め記憶され ていても良い。また、いったん CD— ROM19から読み出したものを、外部記憶媒体 1
8の所定の領域に記憶しておいても良い。或いは、上記プログラムは、ネットワーク( 図示せず)、外部端子および IZF22を経て外部から供給されるものであっても良い。
[0043] また、本発明の実施の形態に力かる情報処理装置は、コンピュータシステム 10にッ リー型データ構造を記憶装置上に構築するプログラム、及び、ツリー型データ構造を 記憶装置上で変換するプログラムを実行させることにより実現される。
[0044] [ツリー型データ構造]
図 2A、 Bは、ツリー形式データの一例である POSデータの説明図であり、図 2Aは 、このツリー形式データのデータ構造 (即ち、トポロジー)及びデータ値を視覚的に表 現した一例であり、図 2Bは、同じツリー形式データを XML形式で表現した一例であ る。図 2A、 Bに示されるようにツリー型データ構造は、ルート'ノード (本例では、 POS データ)力も始めて、各ノードで枝分かれしてリーフ'ノード (端点)に至るノードとァー クの組み合わせによって表現される。各ノードの実体的な値、例えば、店名ノードの 値 ="フランス店〃の格納場所は、店名ノードに関連したポインタで指定される。
[0045] 本発明は、ツリー型データ構造のトポロジーを対象とするため、以下の説明では、 主として、ツリー型データ構造のトポロジーに関して説明する。
[0046] 従来、このようなツリー型データ構造は、データを蓄えたノード間をポインタで接続 すること〖こよって表現されている。しかし、ポインタ表現は、ポインタ値に必然性がな いという欠点がある。即ち、ある場合には特定のノード Aがある番地 (例えば、 100番 地)に格納され、別の場合には同じノード Aが別の番地 (例えば、 200番地)に格納さ れるので、ポインタ値が一定ではなぐポインタ値は、本質的にノードの格納アドレス を表現するに過ぎない。そのため、例えば、ノードが深さ優先の規則に従ってポイン タで接続されて ヽる場合、これらのノードを幅優先の規則に従ってポインタで再接続 することは困難である。
[0047] これに対して、本発明者は、ツリー型データ構造のトポロジーがアークリストによって 記述可能であることに着目した。アークリストとは、ノード間の親子関係を表すアーク のリストである。図 3A〜Cは、アークリストを用いたツリー型データ構造の表現形式の 一例の説明図である。同図の例では、 0、 10、 20、 30、 40、 50、 60、 70、 80、 90、 1 00及び 110のノード識別子 (ID)が付与された 12個のノード力もなるツリー型データ 構造が示されている。図 3Aはツリー型データ構造の全体を示している。図 3Aにおい て、丸形、ハート形などの図形の中央に記載された数字は、ノード IDを表し、矢印と 矢印の側に記載されたく 0, 10 >などの数字の対は、アークを表している。尚、ノー ド IDは、文字列には限られず、数値、特に、整数でもよい。図 3Bは、親ノード (From — ID)から子ノード (To— ID)へのアークリストを示し、図 3Cは、ノード IDとノード Typ eの対のリストからなるノードリストを示す。尚、ツリー型データ構造を表現するだけの 目的のためにはノードリストが無くても構わない。原理的には、このようなアークリスト を用いることによって、ノード間の関係をポインタによらずに直接的に記述することが 可能である。
[0048] [「子→親」関係に基づく表現]
図 3A〜Cの例では、アークリストは、親ノードに子ノードを対応付ける「親→子」関 係に基づいて記述されている。そのため、一つの親ノード、例えば、ルート'ノード 0に は、 3個の子ノード 10、 60及び 80が存在するため、アークリストの From— IDには、 同じノード IDの 0が 3回出現している。つまり、親ノードを特定しても子ノードを特定す ることができないので、アークリストは、要素 From— IDの配列と要素 To— IDの配列 により構成される。アークリストを使用する場合、あるノードは、 From— IDの配列と、 To— IDの配列の両方の配列に出現する。
[0049] これに対して、親子関係は、「子→親」関係によっても表現することが可能である。こ の場合、ノード間の親子関係は、ルート'ノード以外のノードである非ルート'ノードの 各々と、関連付けられた親ノードと、の組の配列によって表現される。この「子→親」 関係によって親子関係を表現する場合、「親→子」関係の場合には得られな力つた 重要な性質がある。即ち、一つの子ノードには必ず唯一の親ノードが対応するので、 子ノードを特定することによって、この子ノードに対応する唯一の親ノードを直ちに特 定することができる。つまり、アークリストは、実際には、要素 To— IDの配列だけを準 備すればよい。この結果として、アークリストを格納するための記憶容量が削減される 。この記憶容量の削減は、メモリへのアクセス回数が低減するという効果があるので、 結果的に、処理の高速ィ匕が実現できる。
[0050] 図 4A〜Cは、本発明の一実施例による「子→親」関係に基づくツリー型データ構造 の表現方法の説明図である。図 4Aはツリー全体の説明図であり、図 4Bは「子→親」 関係に基づくアークリストである。図 4Bのアークリストは、ルート'ノードに対する親ノ ードの格納領域を含んでいるので、ルート'ノードの親ノードとして、便宜的に〃—"が 設定されている。但し、ルート'ノードに対応する親ノードは存在しないので、図 4Cに 示されるように、「子→親」関係に基づくアークリストからルート'ノードに対する親ノー ドの格納領域を除いても構わない。このように本発明の一実施例では、ルート'ノード 以外のノードである非ルート'ノードの各々に対して、非ルート'ノードの親ノードを関 連付けることによりノード間の親子関係を表現する。そして、「子→親」表現された子 のノード力 親のノードのリストを迪ることでツリーのトポロジーを表現することができる
[0051] このような「子→親」関係に基づくツリー型データ構造は、本発明の一実施例によれ ば、図 5に示されるように、図 1に示されたコンピュータシステム 10に、ルート'ノードを 含むノードに固有のノード識別子を付与するノード定義ステップ 501と、前記ルート' ノード以外のノードである非ルート'ノードの各々に付与されたノード識別子に、前記 非ルート'ノードの各々の親ノードに付与されたノード識別子を関連付ける親子関係 定義ステップ 502と、を実行させることによって RAM14上に構築される。このように、 最初に、文字列、浮動小数、整数などの任意の識別情報によってノードにノード識別 子を付与し、次に、「子→親」表現に基づいて親子関係を定義することによって、子ノ ードのノード識別子力 親ノードのノード識別子を引く (ルックアップする)ことでツリー のトポロジーを表現することができる。 [0052] [ノード識別子]
好ま 、一実施例によれば、ノード定義ステップはノード識別子として数値を使用し 、より好ましくは、連続する整数を使用し、更に好ましくは、 0又は 1からの整数連番を 使用する。これにより、ノード識別子から、そのノードに対応する親ノードのノード識別 子が格納されて 、るアドレスを簡単に取得することができるので、子ノードのノード識 別子力 親ノードのノード識別子を引く処理を高速ィ匕することができる。
[0053] ツリー型データ構造のノードにノード識別子として順序付きの番号を付与してノード 間の親子関係を表現する場合、番号の付与順序に規則を定めることによって、その 後のツリー型データ構造の取り扱 、が容易になると 、う利点がある。本発明によれば 、この番号の付与順序の規則として、同じ世代のノードよりも子ノードを優先する深さ 優先モードと、子ノードよりも同じ世代のノードを優先する幅優先モードが利用される
[0054] 図 6A〜Cは、本発明の一実施例により ID形式のツリー構造型データを整数連番 形式のツリー構造型データへ変換する処理の説明図である。図 6Aには、各ノードに I D番号が付与されたツリー構造型データが示され、図 6Bには、変換規則が示され、 図 6Cには、各ノードに整数連番が付与されたツリー構造型データが示されている。 本例の変換規則は、深さ優先で連続番号を付与する規則であり、具体的には、複数 の子ノードが存在する場合、長子 (一番上の兄)ノードに最小番号を付与し、末子 (一 番下の弟)ノードに大きい番号を付与し、かつ、兄弟ノードよりも子ノードを優先して 番号を付与する。本例では、昇順に番号付けをしているが、降順に番号付けをしても よい。
[0055] また、図 7A〜Cは、本発明の他の一実施例により ID形式のツリー構造型データを 整数連番形式のツリー構造型データへ変換する処理の説明図である。図 7Aには、 各ノードに ID番号が付与されたツリー構造型データが示され、図 7Bには、変換規則 が示され、図 7Cには、各ノードに整数連番が付与されたツリー構造型データが示さ れている。本例の変換規則は、幅優先で連続番号を付与する規則であり、具体的に は、複数の子ノードが存在する場合、長子(一番上の兄)ノードに最小番号を付与し 、末子(一番下の弟)ノードに大きい番号を付与し、かつ、子ノードよりも兄弟ノードを 優先して番号を付与する。本例では、昇順に番号付けをしているが、降順に番号付 けをしてもよい。
[0056] このようにノード識別子として番号を使用すると、ノード番号から直ちに、即ち、 0 (1
)のオーダーで、そのノードに関する格納値が格納されているアドレスを引くことがで きる。また、親子関係を「子→親」表現することによって、子ノードから親ノードを直ち に、即ち、 O (l)のオーダーで引くことができる。
[0057] [深さ優先モード]
本発明の一実施例によれば、図 6Cに示されるような深さ優先に基づくツリー型デ ータ構造は、図 1に示されたコンピュータシステム 10に、
同じ世代のノードよりも子ノードを優先して、ルート'ノードを含むノードに固有の連 続する整数を付与するノード定義ステップと、
ルート ·ノード以外のノードである非ルート ·ノードの各々に付与された整数の順に、 非ルート'ノードの各々の親ノードに付与された整数を並べることにより形成される配 列を前記記憶装置に格納する親子関係定義ステップと、
を実行させることによって、記憶装置上に構築される。これにより、ノードは深さ優先 で連続整数が付与され、ノード間の親子関係は「子→親」関係の配列によって表現さ れる。
[0058] 図 8は、本発明の一実施例による深さ優先に基づくノード定義処理のフローチヤ一 トである。このノード定義処理は、コンピュータシステム 10に
最初にルート'ノードに番号を付与するステップ 801と、
既に番号が付与されたあるノードに唯一の子ノードが存在する場合には、当該子ノ ードに当該あるノードに付与された前記番号の次の番号を付与するステップ 802と、 既に番号が付与されたあるノードに複数の子ノードが存在する場合には、当該複数 の子ノードの間の兄弟関係に従って、弟ノードは直上の兄ノードの全ての子孫ノード に番号が付与された後に次の番号が付与されるように、一番上の兄ノードから一番 下の弟ノードまで番号を付与するステップ 803と、
を実行させる。これにより、深さ優先モードで同一の親ノードから派生した複数の子ノ ードの間に兄弟関係が定義される。 [0059] 図 9は、本発明の一実施例により図 6Cに示された深さ優先のツリー型データ構造 から作成された「子→親」表現に基づく親子関係の配列の説明図である。同図にサ ブツリー 1又はサブツリー 2として示されているように、深さ優先で連続番号が付与さ れたノードの親子関係を「子→親」関係に基づいて配列表現すると、あるノードの子 孫ノードが連続領域に出現するという優れた性質が得られる。
[0060] 本発明の一実施例では、深さ優先モードの優れた性質を利用することにより、前記 配列から、あるノードに付与された整数以上の値が格納されて!ヽる連続領域を抽出 することにより、前記あるノードの全ての子孫ノードを特定する。これにより、あるノード の子孫ノードを表すノード群が前記配列内の連続ブロックとして獲得できる。例えば、 連続ブロックのサイズを mとすると、あるノードの全ての子孫ノードを特定するための 処理速度は、 O (m)のオーダーになる。
[0061] 既に説明したように、ノード間の親子関係は、「子→親」関係の配列の他に、「親→ 子」関係の配列によっても表現できる。図 10は、図 6Cに示された深さ優先のツリー型 データ構造力 作成された「親→子」表現に基づく親子関係の配列の説明図である。 一つの親ノードに対して複数の子ノードが存在し得るので、親子関係の配列は、各ノ ードに対する子ノードの番号が格納されて 、る領域を示すための配列 Aggrと、子ノ ードの番号が格納されている配列 P→Cの二つの配列により構成される。例えば、配 列 Aggrの先頭から 2番目の要素 Aggr [1]の値は" 3"であり、これは、ノード [1]に対 する子ノードの番号は、配列 P→Cの要素 P→C [3]以降に格納されていることを表し ている。これにより、ノード [0]、即ち、ルート'ノードに対する子ノードは、配列 P→C の先頭から 3個の要素、 P→C[0]の 1、 P→C[1]の 6、及び P→C [2]の 8であること がわカゝる。
[0062] この「親→子」表現に基づく親子関係の配列の求め方を説明する。
(1)ノードの番号が配列 P→Cの最大の添字( = 11)と一致する場合、このノードに属 する子ノードは存在しない。したがって、処理は継続されない。
(2)同図に太字で表された親ノードの番号力も Aggr値を求める。この Aggr値は、配 列 P→Cの開始点を表す。
(3)太字で表された親ノード番号 + 1に対応する Aggr値を求める。この Aggr値 1 が配列 P→Cの終了点である。
[0063] 例えば、ノード 0の子ノードの開始点は、 Aggr [0]、即ち、 0であり、終了点は、 Agg r[l]— 1、即ち、 3— 1 = 2である。したがって、ノード 0の子ノードは、配列 P→Cの 0 〜2番目の要素、即ち、 1、 6及び 8である。
[0064] 或いは、「親→子」表現に基づく親子関係は、より単純に、親ノード番号の配列と、 対応する子ノード番号の配列と、の二つの配列により表現することも可能である。しか し、この配列を利用して親子関係を見つけるためには、親ノードの番号を検索しなけ ればならないので、即ち、 log (n)のアクセス時間を要するので効率が悪い。
[0065] [幅優先モード]
本発明の一実施例によれば、図 7Cに示されるような幅優先に基づくツリー型デー タ構造は、図 1に示されたコンピュータシステム 10に、
子ノードよりも同じ世代のノードを優先して、ルート'ノードを含むノードに固有の連 続する整数を付与するノード定義ステップと、
前記ルート'ノード以外のノードである非ルート'ノードの各々に付与された整数の 順に、前記非ルート'ノードの各々の親ノードに付与された整数を並べることにより形 成される配列を前記記憶装置に格納する親子関係定義ステップと、
を実行させることによって、記憶装置上に構築される。これにより、ノードは幅優先モ ードで連続整数が付与され、ノード間の親子関係は「子→親」関係の配列によって表 現される。
[0066] 図 11は、本発明の一実施例による幅優先に基づくノート定義処理のフローチャート である。このノード定義処理は、コンピュータシステム 10に、
各ノードが前記ルート'ノードから何世代目のノードである力 及び、各世代に含ま れるノード数を算出するステップ 1101と、
最初に前記ルート ·ノードに番号を付与するステップ 1102と、
ある世代に含まれる全てのノードに番号が付与されたならば、当該ある世代の次の 世代にノードが存在しなくなるまで、当該次の世代に含まれる全てのノードに対して、 親ノードが異なる場合には、当該親ノードに番号が付与された順番に当該ノードに番 号を付与し、当該親ノードが同一である場合には、当該親ノードから派生した複数の 子ノードの間に兄弟関係を定義し、一番上の兄ノードから一番下の弟ノードまで直前 に付与された番号の次の番号から連続的に変化する固有の整数を順に付与するス テツプ 1013と、
を実行させる。これにより、幅優先モードで同一の親ノードから派生した複数の子ノー ドの間に兄弟関係が定義される。
[0067] 図 12は、本発明の一実施例により図 7Cに示された幅優先のツリー型データ構造 から作成された「子→親」表現に基づく親子関係の配列の説明図である。同図に示さ れているように、幅優先で連続番号が付与されたノードの親子関係を「子→親」関係 に基づいて配列表現すると、あるノードの子ノードは連続領域に出現するという優れ た性質が得られる。これは、幅優先モードで連続番号が付与されたノードの親子関 係を「子→親」関係に基づいて配列表現すると、親ノードに付与された番号が前記配 列中に順序付き (昇順又は降順)で出現することによる。
[0068] したがって、本発明の一実施例では、幅優先モードの優れた性質を利用することに より、前記配列から、あるノードに付与された整数と同じ値が格納されている連続領域 を抽出することにより、前記あるノードの全ての子ノードを特定する。これにより、あるノ 一ドの子ノードを、例えば、二分探索などの手法を用いて検索することが可能であり、 即ち、 O (log (n) )のオーダーで検索することが可能になる。
[0069] 既に説明したように、ノード間の親子関係は、「子→親」関係の配列の他に、「親→ 子」関係の配列によっても表現できる。図 13は、図 7Cに示された幅優先のツリー型 データ構造力 作成された「親→子」表現に基づく親子関係の配列の説明図である。 図 13—つの親ノードに対して複数の子ノードが存在し得るので、親子関係の配列は 、各ノードに対する子ノードの番号が格納されて 、る領域を示すための配列 Aggrと、 子ノードの番号が格納されている配列 P→Cの二つの配列により構成される。例えば 、配列 Aggrの先頭から 2番目の要素 Aggr [1]の値は" 3"であり、これは、ノード [1] に対する子ノードの番号は、配列 P→Cの要素 P→C [3]以降に格納されて!、ることを 表している。これにより、ノード [0]、即ち、ルート'ノードに対する子ノードは、配列 P →Cの先頭から 3個の要素、 P→C[0]の 1、 P→C[1]の 2、及び、 P→C[2]の 3であ ることがゎカゝる。 [0070] この「親→子」表現に基づく親子関係の配列の求め方を説明する。
(1)ノードの番号が配列 P→Cの最大の添字( = 11)と一致する場合、このノードに属 する子ノードは存在しない。したがって、処理は継続されない。
(2)同図に太字で表された親ノードの番号力も Aggr値を求める。この Aggr値は、配 列 P→Cの開始点を表す。
(3)太字で表された親ノード番号 + 1に対応する Aggr値を求める。この Aggr値 1 が配列 P→Cの終了点である。
[0071] 例えば、ノード 0の子ノードの開始点は、 Aggr[0]、即ち、 0であり、終了点は、 Agg r[l]— 1、即ち、 3— 1 = 2である。したがって、ノード 0の子ノードは、配列 P→Cの 0 〜2番目の要素、即ち、 1、 2及び 3である。
[0072] [頂点ノードおよび部分ツリー群]
上述したツリーにおいて、ルート'ノードに最も近いノードの値で、当該ノードおよび そのノードから枝分かれしてリーフ'ノード (端点)に至るまでの全てのノードを表現す ることを考える。ここで、あるノードおよびそのノードから枝分かれしてリーフ'ノードに 至るまでのノード群を、部分ツリーと称する。また、上記ノード (ルート'ノード)に最も 近 ソードを頂点ノードと称する。
[0073] 図 14Aは、前述した幅優先モードに基づくツリー型データ構造、図 14Bは、当該ッ リー型データ構造を、「子→親」表現に基づく親子関係の配列を示す図である。たと えば、頂点ノード [4]は、ノード識別子 {4, 8, 9}を含み、頂点ノード [6]は、ノード識 別子 {6}を含み、また、頂点ノード [3]は、ノード識別子 {3, 7, 10, 11 }を含む。この ような、複数の頂点ノードからなる配列を、頂点ノードリストと称する。頂点ノードリスト により複数の部分ツリーを指定でき、指定された複数の部分ツリーを部分ツリー群と 称する。
[0074] 以下、頂点ノードリストを、 [a, b, · · ·]と表す。ここに、「a」、 」、 · · ·は、頂点ノード に対応するノード識別子である。頂点ノードリストを構成する頂点ノードの各々を展開 して、当該頂点ノードを頂点とする部分ツリーに含まれるすべてのノードのノード識別 子を求めることを考える。求められたノード識別子のリストにおいて、あるノード識別子 は 1つしか存在しない場合、すなわち、ノード識別子が重複して出現しない場合、こ のような部分ツリー群を、「正規部分ツリー群」と称する。そうでないような部分ツリー群 を、「非正規部分ツリー群」と称する。
[0075] 正規部分ツリー群であっても、非正規部分ツリー群であっても、頂点ノードリストによ つて、頂点ノードおよびその子孫ノードからなる部分ツリー群を特定することができる
。たとえば、図 15Aに示すように、頂点ノードリスト [4, 6, 3]により、図 15Bに示すよう な部分ツリー群 (部分ツリー {4, 8, 9}、 {6}、 {3, 7, 10, 11 })が特定される。
[0076] 頂点ノードリストにより特定される部分ツリー群は、検索、集計、ソート、集合演算の 対象とすることができる。
[0077] たとえば、図 15A、 Bの例で、「ハート形」のノードを含む部分ツリーを検索すると、 図 16Bに示すような部分ツリー群が得られる。図 16Aは、この部分ツリー群を表す頂 点ノードリストである。
[0078] また、各部分ツリーに属するノード数魏計すると、図 17Bに示すようになる。図 17 Aにおいて、配列 1701は頂点ノードリスト、配列 1702は、各頂点ノードにより特定さ れる部分ツリーに属するノード数を示す配列である。
[0079] たとえば、ソートとして、各部分ツリーに属するノード数によるソートを考えることがで きる。図 18A中、配列 1801は、ソートされた頂点ノードリスト、配列 1802は、頂点ノ 一ドリストにより特定される部分ツリーに属するノード数を示す配列である。また、図 1 8Bは、部分ツリーがノード数にしたがってソートされた状態を示す。
[0080] さらに、複数の部分ツリー群の間の集合演算として、論理積について説明する。図 14A、 Bに示すツリーにおいて、図 19Bに示す部分ツリー群 (対応する頂点ノードリス トを図 19Aに示す)と、図 19Dに示す部分ッリ一群 (対応する頂点ノードリストを図 19 Cに示す)との論理積を考える。
[0081] 図 19Bにおける、ノード識別子「4」の頂点ノードにて特定される部分ツリー 1901と 、図 19Dにおける、ノード識別子「1」の頂点ノード識別子にて特定される部分ツリー 1 911とを比較すると、部分ツリー 1901は、部分ツリー 1902に包含される。図 19Bに おける部分ツリー 1902と包含関係をもつような部分ツリーは、図 19Dに示す部分ッリ 一群には存在しない。また、図 19Bにおけるノード識別子「3」の頂点ノードにて特定 される部分ツリー 1903と、図 19Dにおける、ノード識別子「7」にて特定される部分ッ リー 1913とを比較すると、部分ツリー 1913は、部分ツリー 1903に包含される。その 結果、論理積演算の結果を示す頂点ノードリストは、図 20Aに示すように、 [4, 7]と なる。図 20Bは、論理積演算の結果に対応する部分ツリー群である。
[0082] 図 16A、 B〜図 20A、 B力も理解できるように、頂点ノードリスト (集計においては、こ れに加えて、頂点ノードリストと同一サイズの、集計結果 (ノード数)を格納する配列) によって、それぞれの処理や演算の結果を表わすことができる。
[0083] [頂点ノードの移動]
表形式のデータでは、項目が規則的に並んでいるので、表示、編集の対象となる セル (或いは列や行)を指定する操作は簡単に実行可能である。その一方、ツリーの データは、ノードが規則的に並んでいないので、表示、編集、集計の対象となるノー ド (表形式データの「セル」に該当する)群を特定する操作が不可欠となる。上述した 頂点ノードにより、このような表示、編集、集計などの操作を行う対象のノード群を指 定することができる。表示、編集、集計などの操作対象となるノード群を指定するノー ドをコンテキストノードと称することもある。したがって、本明細書において、頂点ノード は、コンテキストノードと同じ機能をもつ。
[0084] 上述した検索、集計、ソード、集合演算は、頂点ノードリスト中の値と異なる新たな 値が出現しない操作であった。ところが、部分ツリー群を対象とした操作においては、 ツリーのトポロジーを移動することが求められることがしばしば生じる。
[0085] たとえば、親を頂点ノードとして、家族構成を表わすようなツリーを考える。現在、母 親のノードに、頂点ノードが位置しているが、子供全員の一覧を得たい場合には、頂 点ノードを、母親から子供に移動する場合が考えられる。なお、正規部分ツリー群の 頂点ノードリストであっても、頂点ノードを移動した後の頂点ノードリストは、正規部分 ツリー群になるとは限らず、非正規部分ツリー群になる場合もある。
[0086] 以下、頂点ノードを移動する例について説明する。図 21Bに示すツリーにおいて、 図 21Aの頂点ノードリストに示されるように、ノード識別子「1」、「2」および「3」のノー ドが、それぞれ、頂点ノードであるときに、当該頂点ノードを、「子供」に相当するノー ドに移動する場合を考える。なお、図 21B、 Dにおいて、矢印を付されたノードが、頂 点ノードであることを示す。 [0087] この場合には、図 22Dに示すように、ノード識別子「1」の頂点ノードは、ノード識別 子「4」および「5」のノードに移動する。また、ノード識別子「2」の頂点ノードは、ノード 識別子「6」のノードに移動するとともに、ノード識別子「3」の頂点ノードは、ノード識別 子「7」のノードに移動する。その結果、移動後の頂点ノードを表わす頂点ノードリスト は、図 21Cに示すように、 [4, 5, 6, 7]となる。
[0088] 図 21Dに示すように、ノード識別子「4」、「5」、「6」および「7」のノードが頂点ノード であるときに、頂点ノードを、「親」に相当するノードに移動する場合を考える。ノード 識別子「4」の頂点ノード、および、ノード識別子「5」の頂点ノードは、それぞれ、ノー ド識別子「1」のノードに移動する。また、ノード識別子「6」の頂点ノードは、ノード識別 子「2」のノードに移動し、ノード識別子「7」の頂点ノードは、ノード識別子「3」のノード に移動する。その結果、移動後の頂点ノードを表わす頂点ノードリストは、 [1, 1, 2, 3]となる。
[0089] 次に、図 23Bに示すように、ノード識別子「1」、「2」、「3」のノードが頂点ノードであ るときに、頂点ノードを、同じ世代で、かつ、すぐ下の「弟」のノード、つまり、本発明に かかるノード識別子の付与規則にしたがえば、同じ世代で、かつ、親ノードが同一で あるノードのうち、最も近いノード識別子を有するノードに移動させることを考える(図 23Bの破線矢印参照)。ここに、「弟」のノードは、頂点ノードと同世代のノードであつ て、当該頂点ノードの親ノードから頂点ノードに対してアークが接続された後に、ァー クが接続されるようなノードと考える。また、「兄」のノードとは、当該頂点ノードと同世 代のノードであって、当該頂点ノードの親ノード力 頂点ノードに対してアークが接続 される以前に、アークが接続されているノードと考える。
[0090] 図 23B、図 23Dに示すように、ノード識別子「1」の頂点ノードは、ノード識別子「2」 のノードに移動し、ノード識別子「2」の頂点ノードは、ノード識別子「3」のノードに移 動する。その一方、ノード識別子「3」の頂点ノードは、「弟」のノードが存在しないため 消滅する。したがって、図 23Cに示すように、移動後の頂点ノードを表わす頂点ノー ドリストは、 [2, 3]となる。
[0091] [頂点ノードを移動させる際の処理 (幅優先モード) ]
以下、本発明の実施の形態において、頂点ノードを移動させる際に実行される処 理について説明する。まず、幅先モードに基づくツリー型データ構造力 作られた「 子→親」表現に基づく配列 (C P配列)を利用した場合の頂点ノードの移動につい て説明する。
[0092] 図 24は、頂点ノードを子供に相当するノードに移動する際に、コンピュータシステム 10において実行される処理を示すフローチャートである。図 24に示すように、コンビ ユータシステム 10は、頂点ノードのノード識別子が格納された頂点ノードリストの値を 参照して (ステップ 2401)、 C— P配列中、当該頂点ノードリストの値 (ノード識別子)と 同一の値を検索する(ステップ 2402)。次いで、コンピュータシステム 10は、 C— P配 列において頂点ノードのノード識別子を同一の値を有するノードのノード識別子を、 新たな頂点ノードリストに格納する(ステップ 2403)。ステップ 2401〜2403の処理を 全ての頂点ノードリスト中の値について実行することで (ステップ 2404参照)、新たな 頂点ノードリストには、子供に相当するノードに移動された頂点ノードのノード識別子 が格納される。
[0093] 図 25Aの例において、頂点ノードリストが [1, 2, 3]であると考える。ノード識別子「1 」の頂点ノード (矢印参照)に着目すると、 C— P配列を検索した結果、ノード識別子「 4」および「5」について、 C— P配列の値力 頂点ノードリスト中の値「1」と同様である ことがわかる(図 25B参照)。そこで、新たな頂点ノードリストには、値「4」および「5」が 格納される。なお、幅優先モードにおける C P配列では、値が昇順であるため、ステ ップ 2402の検索は容易である。他の頂点ノードリスト中の値「2」、 「3」についても同 様の処理を実行する結果、新たな頂点ノードリスト [4, 5, 6, 7]を得ることができる。
[0094] 図 26は、頂点ノードを親に相当するノード (親ノード)に移動する際に、コンピュータ システム 10において実行される処理を示すフローチャートである。図 26に示すように 、コンピュータシステム 10は、頂点ノードリストの値を参照して (ステップ 2601)、当該 頂点ノードリストの値が示す C P配列の値を取得する(ステップ 2602)。コンビユー タシステム 10は、取得した値を、新たな頂点ノードリストに格納する (ステップ 2603)。 ステップ 2601〜2603の処理を全ての頂点ノードリスト中の値について実行すること で (ステップ 2604参照)、新たな頂点ノードリストには、親に相当するノードに移動さ れた頂点ノードのノード識別子が格納される。 [0095] 図 27Aにおいて、頂点ノードリストが [4, 5, 6, 7]であると考える。ノード識別子「4」 の頂点ノード (矢印参照)に着目すると、ノード識別子「4」に対応する C P配列の値 は、「1」であるため、この値が、新たな頂点ノードリストに格納される。同様に、頂点ノ 一ドリストに格納された他のノードのノード識別子「5」、「6」および「7」について、それ ぞれ、対応する C— P配列の値は、「1」、「2」、「3」となる。したがって、新たな頂点ノ 一ドリストは、 [1, 1, 2, 3]となる。
[0096] 図 28は、頂点ノードを、弟に相当するノード (弟ノード)に移動する際に、コンビユー タシステム 10において実行される処理を示すフローチャートである。図 28に示すよう に、コンピュータシステム 10は、頂点ノードリストの値を参照して (ステップ 2801)、当 該頂点ノードリストの値が示す C— P配列の値 (ノード識別子)を取得する (ステップ 28 02)。続いて、コンピュータシステム 10は、当該頂点ノードの次の値 (本実施の形態 では、もとの値に「1」を加えた値)が示す C— P配列の値 (ノード識別子)を取得する( ステップ 2803)。
[0097] 次いで、コンピュータシステム 10は、取得した 2つの値を比較して、両者が一致する 場合には (ステップ 2804でイエス (Yes))、上記次の値 (ノード識別子)を、新たな頂点 ノードリストに格納する (ステップ 2805)。その一方、両者が一致しない場合には、処 理対象となって 、る頂点ノードが移動すると、消滅すると判断される。
[0098] コンピュータシステム 10は、ステップ 2601〜2603の処理を全ての頂点ノードリスト 中の値について実行することで (ステップ 2806参照)、新たな頂点ノードリストには、 弟に相当するノードに移動された頂点ノードのノード識別子が格納される。
[0099] 図 29Aにおいて頂点ノードリストが [4, 5, 6, 7]であると考える。ノード識別子「4」 の頂点ノード (矢印参照)に着目すると、ノード識別子「4」に対応する C P配列の値 は、「1」であり、ノード識別子「5」に対応する C— P配列の値も「1」である。したがって 両者は一致するため、ノード識別子「5」が、新たな頂点ノードリストに格納される。ノ ード識別子「5」、「6」および「7」については、それぞれ、自身に対応する C P配列 の値と、自身の値に「1」をカ卩えたものに対応する C P配列の値とが相違するため、 頂点ノードは消滅する。したがって、新たな頂点ノードリストは、 [5]となる。
[0100] なお、頂点ノードを、「兄」に相当するノードに移動させる場合には、頂点ノードリスト 中のノード識別子が示す C P配列の値と、当該ノード識別子の一つ前のノード識別 子(つまり、値が「一 1」であるようなノード識別子)が示す C P配列の値とを比較すれ ばよい。
[0101] [頂点ノードを移動させる際の処理 (深さ優先モード) ]
以下、本発明の実施の形態において、頂点ノードを移動させる際に実行される処 理について説明する。まず、深さ優先モードに基づくツリー型データ構造力 作られ た「子→親」表現に基づく配列 (C P配列)を利用した場合の頂点ノードの移動につ いて説明する。
[0102] 深さ優先モードの下においても、頂点ノードを子供に相当するノードに移動する際 に、コンピュータシステム 10において実行される処理は、図 24に示すものと同様であ る。なお、深さ優先モードにおける C— P配列では、値は昇順とはなっていない。しか しながら、子供に相当するノードは、頂点ノードリスト中のノード識別子の次の (本実 施の形態では値に「1」が加えられた)ノード識別子から、ノード識別子が示す C— P 配列の値が、頂点ノードリストの値より小さくなるようなノード識別子の一つ手前 (本実 施の形態では、そのようなノード識別子より「1」だけ小さいノード識別子)のノードの範 囲に現れる。
[0103] したがって、子供に相当するノードを検索する際には、図 30に示すように、コンビュ ータシステム 10は、頂点ノードリスト中のノードを基準ノードとして、当該基準ノードの 次の位置(つまり、基準ノードのノード識別子に「1」を加えたノード識別子が示す位置 )に、検索用ポインタを配置し (ステップ 3001)、検索用ポインタが示す C— P配列の 値を特定する (ステップ 3002)。次いで、特定された値が、基準ノードのノード識別子 と同じであるかが判断される(ステップ 3003)。ステップ 3003でイエス (Yes)と判断さ れた場合には、コンピュータシステム 10は、検索用ポインタが位置するノード識別子 を、新たな頂点ノードリストに格納する (ステップ 3004)。その後、検索用ポインタが 1 つ進められる(ステップ 3005)。
[0104] その一方、ステップ 3003でノー (No)と判断された場合には、 C— P配列の値力 基 準ノードのノード識別子以上であるかを判断する(ステップ 3006)。ステップ 3006で イエス (Yes)と判断された場合には、検索用ポインタが位置するノード識別子のノード は、基準ノードの子孫であるため、次の処理のため、検索用ポインタが 1つ進められる (ステップ 3005)。ステップ 3006でノー (No)であることは、検索用ポインタが位置する ノード識別子のノードは、頂点ノードの子孫ではないため、処理を終了させる。
[0105] 図 31Aの例において、頂点ノードリストが [1, 6, 8]であると考える。ノード識別子「1 」の頂点ノード (矢印参照)に着目する。検索用ポインタは、初期的には、ノード識別 子「2」の位置に配置される。この時点で、検索用ポインタが示す C P配列の値は、「 1」であるため、ノード識別子「2」が新たな頂点ノードリストに格納される。
[0106] また、検索用ポインタが、ノード識別子「5」に配置されるときに、当該検索用ポイン タが示す C— P配列の値は、「1」であるため、ノード識別子「5」が新たな頂点ノードリ ストに格納される。その後、検索用ポインタがノード識別子「6」には位置されるときに 、当該検索用ポインタが示す C P配列の値は「0」であり、基準ノードのノード識別子 「1」より小さいため、処理自体が終了する。
[0107] 次に、頂点ノードを親に相当するノードに移動する際に、コンピュータシステム 10に て実行される処理について説明する。親に相当するノードに移動する際の処理は、 図 26に示すものと同様である。図 32Aの例において、頂点ノードリストが [2, 5, 7, 9 ]であると考える。ノード識別子「2」の頂点ノード (矢印参照)に着目すると、ノード識 別子「2」に対応する C— P配列の値(図 32B参照)は、「1」であるため、この値が、新 たな頂点ノードリストに格納される。同様に、ノード識別子「5」、「7」、「9」について、 それぞれ、対応する C P配列の値は「1」、「6」、「8」であるため、新たな頂点ノードリ ストは、 [1, 1, 6, 8]となる。
[0108] 図 33は、頂点ノードを弟に相当するノードに移動する際に、コンピュータシステム 1 0において実行される処理を示すフローチャートである。図 33に示すように、コンビュ ータシステム 10は、頂点ノードリストの値を参照して (ステップ 3301)、当該頂点ノー ドリストの値が示す C— P配列の値 (ノード識別子)を取得する (ステップ 3302)。次 ヽ で、コンピュータシステム 10は、次のノード識別子(「1」だけ値が大きいノード識別子 )以降で、同一の C— P配列の値をもつノード識別子を検索する (ステップ 3303)。同 一の値が見つかれば (ステップ 3304でイエス (Yes))、コンピュータシステム 10は、そ の値を有するノード識別子を、新たな頂点ノードリストに格納する (ステップ 3305)。 同一の値が見つからない場合には、当該頂点ノードは消滅したと判断される。
[0109] コンピュータシステムは、ステップ 3301〜3305の処理を全ての頂点ノードリストの 値について実行することで (ステップ 3306)、新たな頂点ノードリストには、弟に相当 するノードに移動された頂点ノードのノード識別子が格納される。図 34Aにおいて、 頂点ノードリストが [2, 5, 7, 9]であると考える。ノード識別子「2」の頂点ノードに着目 すると、ノード識別子に対応する C— P配列の値は「1」である。図 33の処理によって、 C— P配列の値力 「l」であるようなノード識別子「5」を検索することができるため、頂 点ノードリストには、ノード識別子「5」が格納される。ノード識別子「5」、「7」、「9」の頂 点ノードについては、 C— P配列を検索しても、同一の値を見出すことができない。つ まり、親ノードとして同じ番号をもつノードを見出すことが出来ない。したがって、これ ら頂点ノードは、移動によって消滅する。その結果、新たな頂点ノードの頂点ノードリ ストは「5」となる。
[0110] [情報処理装置]
図 35は、本発明の一実施例に力かるツリー型データ構造を構築し、頂点ノードリス トを生成し、かつ、頂点ノードの移動後の頂点ノードリストを生成する情報処理装置 3 500の機能ブロックダイヤグラムである。この情報処理装置 3500は、実際には、図 1 に示すコンピュータシステム 10に必要なプログラムをインストールすることにより実現 される。
[0111] 図 35に示すように、情報処理装置 3500は、ツリー型データ構造を表現するデータ 、および、頂点ノードリストを記憶する記憶部 3501と、ルート'ノードを含むノードに固 有のノード識別子を付与し、ノード識別子を記憶部 3501に格納するノード定義部 35 02と、前記ルート'ノード以外のノードである非ルート'ノードの各々に付与されたノー ド識別子に、前記非ルート'ノードの各々の親ノードに付与されたノード識別子を関連 付け、当該関連付けを示す配列である C— P配列を記憶部 3501に格納する親子関 係定義部 3503と、記憶部 3501に格納されたノード識別子および C— P配列に基づ いて、頂点ノードリストを生成する頂点ノードリスト生成部 3504と、入力装置(図 1の符 号 24参照)など力もの指示にしたがって、頂点ノードを移動させ、移動後の頂点ノー ドを示す新たな頂点ノードリストを生成する頂点ノード移動処理部 3505とを備えてい る。頂点ノードリスト生成部 35にて生成された頂点ノードリストや、頂点ノード移動処 理部 3505にて生成された新たな頂点ノードリストは、記憶部 3501に記憶される。
[0112] 好ましくは、ノード定義部 3502は、ノード識別子として数値を用い、より好ましくは、 ノード識別子として連続する整数を用いる。また、親子関係定義部 3503は、非ルート 'ノードの各々に付与されたノード識別子と、関連付けられた親ノードに付与されたノ ード識別子と、の組の配列を記憶部 3501に格納する。
[0113] また、入力装置(図 1の符号 24参照)からの指示などにより、ノードが指定されると、 頂点ノードリスト生成部 3504は、指定されたノードのノード識別子を、頂点ノードリスト 中に格納する。また、入力装置からの指示などにより、頂点ノードの移動の指示 (親 に相当するノードへの移動、子に相当するノードへの移動、弟(兄)に相当するノード への移動)が与えられると、頂点ノード移動処理部 3505は、 C P配列および頂点ノ 一ドリストを、記憶部 3501から取得して、新たな頂点ノードリストを生成し、記憶部 35 01に記憶する。
[0114] 本発明は、以上の実施の形態に限定されることなぐ特許請求の範囲に記載された 発明の範囲内で、種々の変更が可能であり、それらも本発明の範囲内に包含される ものであることは言うまでもない。
図面の簡単な説明
[0115] [図 1]図 1は、本発明の実施の形態に力かるツリー型データ構造を取り扱うコンビユー タシステムのブロックダイヤグラムである。
[図 2]図 2A、 Bは、ツリー形式データの一例である POSデータの説明図であり、図 2 は、このツリー形式データのデータ構造 (即ち、トポロジー)及びデータ値を視覚的に 表現した例であり、図 2Bは、同じツリー形式データを XML形式で表現した例である。
[図 3]図 3A〜Cは、それぞれ、アークリストを用いたツリー型データ構造の表現形式 の一例の説明図である。
[図 4]図 4A〜Cは、本発明の一実施例による「子→親」関係に基づくツリー型データ 構造の表現方法の説明図である。
[図 5]図 5は、本発明の一実施例によるツリー型データ構造を記憶装置上に構築する 方法のフローチャートである。 [図 6]図 6A〜Cは、本発明の一実施例により ID形式のツリー構造型データを整数連 番形式のツリー構造型データへ変換する処理の説明図である。
[図 7]図 7A〜Cは、本発明の他の一実施例により ID形式のツリー構造型データを整 数連番形式のツリー構造型データへ変換する処理の説明図である。
[図 8]図 8は、本発明の一実施例による深さ優先に基づくノード定義処理のフローチ ヤートである。
[図 9]図 9は、本発明の一実施例により作成された「子→親」表現に基づく親子関係の 配列の説明図である。
[図 10]図 10は、図 6Cに示された深さ優先のツリー型データ構造から作成された「親 →子」表現に基づく親子関係の配列の説明図である。
[図 11]図 11は、本発明の一実施例による幅優先に基づくノード定義処理のフローチ ヤートである。
[図 12]図 12は、本発明の一実施例により作成された「子→親」表現に基づく親子関 係の配列の説明図である。
[図 13]図 13は、図 7Cに示された幅優先のツリー型データ構造から作成された「親→ 子」表現に基づく親子関係の配列の説明図である。
[図 14]図 14Aは、幅優先モードに基づくツリー型データ構造、図 14Bは、当該ツリー 型データ構造を、「子→親」表現に基づく親子関係の配列を示す図である。
[図 15]図 15Aは、頂点ノードリストの例、図 15Bは、頂点ノードリストで特定される部分 ツリー群の例を示す図である。
[図 16]図 16Aは、検索処理により得られた頂点ノードリストの例、図 16Bは、頂点ノー ドリストで特定される部分ツリー群の例を示す図である。
[図 17]図 17Aは、集計処理により得られた頂点ノードリストおよび集計結果を示す配 列の例、図 17Bは、頂点ノードリストで特定される部分ツリー群の例を示す図である。
[図 18]図 18Aは、ノード数でソートされた頂点ノードリスト、および、対応するノード数 を示す配列の例、図 18Bは、頂点ノードリストで特定される部分ツリーの例を示す図 である。
[図 19]図 19A、 Cは、それぞれ、論理積演算の対象となる頂点ノードリストの例、図 19 B、 Dは、それぞれ頂点ノードリストで特定される部分ツリー群の例を示す図である。
[図 20]図 20Aは、論理積演算の結果を示す頂点ノードリストの例、図 20Bは、頂点ノ 一ドリストで特定される部分ツリー群を示す図である。
[図 21]図 21Aは、本実施の形態に力かる頂点ノードリスト、図 21Bは、頂点ノードを矢 印で示したツリーの例、図 21Cは、頂点ノードを子供に相当するノードに移動したとき の頂点ノードリスト、図 21Dは、移動した頂点ノードを矢印で示したツリーの例を示す 図である。
[図 22]図 22Aは、本実施の形態に力かる頂点ノードリスト、図 22Bは、頂点ノードを矢 印で示したツリーの例、図 22Cは、頂点ノードを親に相当するノードに移動したときの 頂点ノードリスト、図 22Dは、移動した頂点ノードを矢印で示したツリーの例を示す図 である。
[図 23]図 23Aは、本実施の形態に力かる頂点ノードリスト、図 23Bは、頂点ノードを矢 印で示したツリーの例、図 23Cは、頂点ノードを弟に相当するノードに移動したときの 頂点ノードリスト、図 23Dは、移動した頂点ノードを矢印で示したツリーの例を示す図 である。
[図 24]図 24は、頂点ノードを子供に相当するノードに移動する際に、コンピュータシ ステムにおいて実行される処理を示すフローチャートである。
[図 25]図 25Aは、ツリーの例を示す図、図 25Bは、頂点ノードを子供に相当するノー ドに移動する処理を説明する図である。
[図 26]図 26は、頂点ノードを親に相当するノードに移動する際に、コンピュータシス テムにおいて実行される処理を示すフローチャートである。
[図 27]図 27Aは、ツリーの例を示す図、図 27Bは、頂点ノードを親に相当するノード に移動する処理を説明する図である。
[図 28]図 28は、頂点ノードを、弟に相当するノードに移動する際に、コンピュータシス テムにおいて実行される処理を示すフローチャートである。
[図 29]図 29Aは、ツリーの例を示す図、図 29Bは、頂点ノードを弟に相当するノード に移動する処理を説明する図である。
[図 30]図 30は、子供に相当するノードを検索する際に、コンピュータシステムにて実
行される処理を示すフローチャートである。
[図 〇 31]図 31Aは、ツリーの例を示す図、図 31Bは、頂点ノードを子供に相当するノー ドに移動する処理を説明する図である。
[図 32]図 32Aは、ツリーの例を示す図、図 32Bは、頂点ノードを親に相当するノード に移動する処理を説明する図である。
[図 33]図 33は、頂点ノードを弟に相当するノードに移動する際に、コンピュータシス テムにおいて実行される処理を示すフローチャートである。
[図 34]図 34Aは、ツリーの例を示す図、図 34Bは、頂点ノードを弟に相当するノード に移動する処理を説明する図である。
[図 35]図 35は、本実施の形態に力かるツリー型データ構造、および、頂点ノードリスト を記憶装置上に構築する情報処理装置の機能ブロックダイヤグラムである。
符号の説明
コンピュータシステム
12 CPU
14 RAM
16 ROM
18 固定記憶装置
20 CD— ROMドライバ
22 I/F
24 入力装置
26 表示装置
3500 情報処理装置
3501 n己' 1思 ρβ
3502 ノード定義部
3503 親子関係定義部
3504 頂点ノード生成部
3505 頂点ノード移動処理部

Claims

請求の範囲
[1] ノードに固有のノード識別子が付与され、
ノード間の親子関係がルート'ノード以外のノードである非ルート'ノードの各々に付 与されたノード識別子と、非ルート'ノードの各々に関連付けられた親ノードのノード 識別子との組からなる第 1の配列によって表現された、ツリー型データ構造のデータ を備えたコンピュータにおいて、
それぞれが特定のノードおよびその子孫のノードを含む 1以上のノード群を表わす ために、当該特定のノードを頂点ノードとして、そのノード識別子を格納した第 2の配 列を設けるステップと、
前記第 1の配列を参照して、前記第 2の配列にノード識別子が格納された頂点ノー ドの各々を、
a)当該頂点ノードとアークで直接結ばれ、かつ、当該アークが頂点ノードから延びて いるような子ノード、
b)当該頂点ノードとアークで直接結ばれ、かつ、当該アークがそこ力 頂点ノードま で延びるような親ノード、
c)当該頂点ノードと同世代のノードであって、当該頂点ノードの親ノードから頂点ノー ドに対してアークが接続される以前に、アークが接続されている兄ノード、並びに、 d)当該頂点ノードと同世代のノードであって、当該頂点ノードの親ノードから頂点ノー ドに対してアークが接続された後に、アークが接続される弟ノード
の何れかに移動させて、移動後の新たな頂点ノードのノード識別子を格納した第 3 の配列を生成するステップと、を備えたことを特徴とする配列の生成方法。
[2] 子ノードよりも同じ世代のノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、子ノードに移動させるために、前記第 3の配列を生成す るステップが、 前記第 1の配列中、頂点ノードのノード識別子が格納された格納位置を特定するス テツプと、
移動後の頂点ノードのノード識別子を、当該格納位置に対応するノード識別子と決 定するステップと、を有することを特徴とする請求項 1に記載の方法。
[3] 子ノードよりも同じ世代のノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、親ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納されたノード 識別子を特定するステップと、
移動後の頂点ノードのノード識別子を、前記対応する位置に格納されたノード識別 子と決定するステップと、を有することを特徴とする請求項 1に記載の方法。
[4] 子ノードよりも同じ世代のノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、兄ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納された第 1の ノード識別子を特定するステップと、
前記第 1の配列中、前記頂点ノード識別子に対応する位置の値より 1だけ小さい値 の格納位置に格納された第 2のノード識別子を特定するステップと、
前記第 1のノード識別子と、第 2のノード識別子とがー致する場合に、前記移動後 の頂点ノード識別子を、前記第 2のノード識別子の格納位置に対応するノード識別子 と決定するステップと、を有することを特徴とする請求項 1に記載の方法。
[5] 子ノードよりも同じ世代のノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、弟ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納された第 1の ノード識別子を特定するステップと、
前記第 1の配列中、前記頂点ノード識別子に対応する位置の値より 1だけ大きい値 の格納位置に格納された第 3のノード識別子を特定するステップと、
前記第 1のノード識別子と、第 3のノード識別子とがー致する場合に、前記移動後 の頂点ノード識別子を、前記第 3のノード識別子の格納位置に対応するノード識別子 と決定するステップと、を有することを特徴とする請求項 1に記載の方法。
[6] 同じ世代のノードよりも子ノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、子ノードに移動させるため、前記第 3の配列を生成する ステップが、
前記第 1の配列中、頂点ノードのノード識別子が格納された格納位置を特定するス テツプと、
移動後の頂点ノードのノード識別子を、当該格納位置に対応するノード識別子と決 定するステップと、を有することを特徴とする請求項 1に記載の方法。
[7] 同じ世代のノードよりも子ノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、 前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、親ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納されたノード 識別子を特定するステップと、
移動後の頂点ノードのノード識別子を、前記対応する位置に格納されたノード識別 子と決定するステップと、を有することを特徴とする請求項 1に記載の方法。
[8] 同じ世代のノードよりも子ノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、兄ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子の格納位置に格納された第 1のノー ド識別子を特定するステップと、
前記第 1の配列中、頂点ノードのノード識別子の格納位置の値より小さい値の格納 位置に格納された、当該第 1のノード識別子と等しい第 4のノード識別子を検索する ステップと、
前記第 4のノード識別子の格納位置のうち、最大の格納位置を特定するステップと 前記移動後の頂点ノードのノード識別子を、前記最大の格納位置に対応するノー ド識別子と決定するステップと、を有することを特徴とする請求項 1に記載の方法。
[9] 同じ世代のノードよりも子ノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、弟ノードに移動させるために、前記第 3の配列を生成す るステップが、
前記第 1の配列中、頂点ノードのノード識別子の格納位置に格納された第 1のノー ド識別子を特定するステップと、
前記第 1の配列中、頂点ノードのノード識別子の格納位置の値より大き 、値の格納 位置に格納された、当該第 1のノード識別子と等しい第 5のノード識別子を検索する ステップと、
前記第 5のノード識別子の格納位置のうち、最小の格納位置を特定するステップと 前記移動後の頂点ノードのノード識別子を、前記最大の格納位置に対応するノー ド識別子と決定するステップと、を有することを特徴とする請求項 1に記載の方法。 ノードに固有のノード識別子が付与され、
ノード間の親子関係がルート'ノード以外のノードである非ルート'ノードの各々に付 与されたノード識別子と、非ルート'ノードの各々に関連付けられた親ノードのノード 識別子との組からなる第 1の配列によって表現された、ツリー型データ構造のデータ を備えたコンピュータにより読み取り可能なコンピュータプログラムであって、前記コン ピュータに、
それぞれが特定のノードおよびその子孫のノードを含む 1以上のノード群を表わす ために、当該特定のノードを頂点ノードとして、そのノード識別子を格納した第 2の配 列を設けるステップと、
前記第 1の配列を参照して、前記第 2の配列にノード識別子が格納された頂点ノー ドの各々を、
a)当該頂点ノードとアークで直接結ばれ、かつ、当該アークが頂点ノードから延びて いるような子ノード、
b)当該頂点ノードとアークで直接結ばれ、かつ、当該アークがそこ力 頂点ノードま で延びるような親ノード、 c)当該頂点ノードと同世代のノードであって、当該頂点ノードの親ノードから頂点ノー ドに対してアークが接続される以前に、アークが接続されている兄ノード、並びに、 d)当該頂点ノードと同世代のノードであって、当該頂点ノードの親ノードから頂点ノー ドに対してアークが接続された後に、アークが接続される弟ノード
の何れかに移動させて、移動後の新たな頂点ノードのノード識別子を格納した第 3 の配列を生成するステップと、を実行させることを特徴とする配列生成プログラム。
[11] 子ノードよりも同じ世代のノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、子ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子が格納された格納位置を特定するス テツプと、
移動後の頂点ノードのノード識別子を、当該格納位置に対応するノード識別子と決 定するステップと、を実行させることを特徴とする請求項 10に記載のプログラム。
[12] 子ノードよりも同じ世代のノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、親ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納されたノード 識別子を特定するステップと、
移動後の頂点ノードのノード識別子を、前記対応する位置に格納されたノード識別 子と決定するステップと、を実行させることを特徴とする請求項 10に記載のプログラム [13] 子ノードよりも同じ世代のノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、兄ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納された第 1の ノード識別子を特定するステップと、
前記第 1の配列中、前記頂点ノード識別子に対応する位置の値より 1だけ小さい値 の格納位置に格納された第 2のノード識別子を特定するステップと、
前記第 1のノード識別子と、第 2のノード識別子とがー致する場合に、前記移動後 の頂点ノード識別子を、前記第 2のノード識別子の格納位置に対応するノード識別子 と決定するステップと、を実行させることを特徴とする請求項 10に記載のプログラム。
[14] 子ノードよりも同じ世代のノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、弟ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納された第 1の ノード識別子を特定するステップと、
前記第 1の配列中、前記頂点ノード識別子に対応する位置の値より 1だけ大きい値 の格納位置に格納された第 3のノード識別子を特定するステップと、
前記第 1のノード識別子と、第 3のノード識別子とがー致する場合に、前記移動後 の頂点ノード識別子を、前記第 3のノード識別子の格納位置に対応するノード識別子 と決定するステップと、を実行させることを特徴とする請求項 10に記載のプログラム。
[15] 同じ世代のノードよりも子ノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、子ノードに移動させるため、前記第 3の配列を生成する ステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子が格納された格納位置を特定するス テツプと、
移動後の頂点ノードのノード識別子を、当該格納位置に対応するノード識別子と決 定するステップと、を実行させることを特徴とする請求項 10に記載のプログラム。
[16] 同じ世代のノードよりも子ノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、親ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子に対応する位置に格納されたノード 識別子を特定するステップと、
移動後の頂点ノードのノード識別子を、前記対応する位置に格納されたノード識別 子と決定するステップと、を実行させることを特徴とする請求項 10に記載のプログラム
[17] 同じ世代のノードよりも子ノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、兄ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子の格納位置に格納された第 1のノー ド識別子を特定するステップと、
前記第 1の配列中、頂点ノードのノード識別子の格納位置の値より小さい値の格納 位置に格納された、当該第 1のノード識別子と等しい第 4のノード識別子を検索する ステップと、
前記第 4のノード識別子の格納位置のうち、最大の格納位置を特定するステップと 前記移動後の頂点ノードのノード識別子を、前記最大の格納位置に対応するノー ド識別子と決定するステップと、を実行させることを特徴とする請求項 10に記載のプ ログラム。
同じ世代のノードよりも子ノードを優先して、ルート'ノードを含むノードに固有の連 続する整数が付与され、
前記第 1の配列が、前記ルート'ノード以外のノードである非ルート'ノードの各々に 付与された整数の順に、前記非ルート'ノードの各々の親ノードに付与された整数を 並べることにより形成され、
前記頂点ノードの各々を、弟ノードに移動させるために、前記第 3の配列を生成す るステップにおいて、前記コンピュータに、
前記第 1の配列中、頂点ノードのノード識別子の格納位置に格納された第 1のノー ド識別子を特定するステップと、
前記第 1の配列中、頂点ノードのノード識別子の格納位置の値より大き 、値の格納 位置に格納された、当該第 1のノード識別子と等しい第 5のノード識別子を検索する ステップと、
前記第 5のノード識別子の格納位置のうち、最小の格納位置を特定するステップと 前記移動後の頂点ノードのノード識別子を、前記最大の格納位置に対応するノー ド識別子と決定するステップと、を実行させることを特徴とする請求項 10に記載のプ ログラム。
PCT/JP2005/017794 2004-10-01 2005-09-28 配列の生成方法、及び、配列生成プログラム WO2006038498A1 (ja)

Priority Applications (5)

Application Number Priority Date Filing Date Title
CA002581219A CA2581219A1 (en) 2004-10-01 2005-09-28 Arrangement generation method and arrangement generation program
KR1020077005216A KR101254544B1 (ko) 2004-10-01 2005-09-28 배열의 생성방법 및 이를 실행하는 컴퓨터 프로그램을 수록한 기록 매체
EP05787558A EP1811383A1 (en) 2004-10-01 2005-09-28 Arrangement generation method and arrangement generation program
JP2006539235A JP4712718B2 (ja) 2004-10-01 2005-09-28 配列の生成方法、及び、配列生成プログラム
US11/576,481 US20090106289A1 (en) 2004-10-01 2005-09-28 Array Generation Method And Array Generation Program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2004290638 2004-10-01
JP2004-290638 2004-10-01

Publications (1)

Publication Number Publication Date
WO2006038498A1 true WO2006038498A1 (ja) 2006-04-13

Family

ID=36142576

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2005/017794 WO2006038498A1 (ja) 2004-10-01 2005-09-28 配列の生成方法、及び、配列生成プログラム

Country Status (7)

Country Link
US (1) US20090106289A1 (ja)
EP (1) EP1811383A1 (ja)
JP (1) JP4712718B2 (ja)
KR (1) KR101254544B1 (ja)
CN (1) CN100587673C (ja)
CA (1) CA2581219A1 (ja)
WO (1) WO2006038498A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019149019A (ja) * 2018-02-27 2019-09-05 株式会社東芝 支援システム

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101128825A (zh) * 2005-01-25 2008-02-20 特博数据实验室公司 树的检索、合计、排序方法、信息处理装置以及树的检索、合计、排序程序
US20060212852A1 (en) * 2005-03-16 2006-09-21 Jinwoo Hwang Methods, systems and computer program products for detecting memory leaks
US8312050B2 (en) * 2008-01-16 2012-11-13 International Business Machines Corporation Avoiding database related joins with specialized index structures
CN101963931A (zh) * 2009-07-22 2011-02-02 鸿富锦精密工业(深圳)有限公司 可扩展固件接口下的硬盘测试方法
CN102402545B (zh) * 2010-09-14 2015-09-02 腾讯科技(深圳)有限公司 一种存储数据的方法及装置
US20150286720A1 (en) * 2012-12-11 2015-10-08 Tmm Data, Llc Methods and systems for collecting, managing, and sharing data
US10120956B2 (en) * 2014-08-29 2018-11-06 GraphSQL, Inc. Methods and systems for distributed computation of graph data
US20160217302A1 (en) * 2015-01-23 2016-07-28 Karim Kassam High-speed, hacker-resistant computer data storage and retrieval system
CN110889022A (zh) * 2018-08-17 2020-03-17 迈普通信技术股份有限公司 数据查询方法、装置及电子设备
CN111522819A (zh) * 2020-04-24 2020-08-11 上海用天网络科技有限公司 一种树型结构数据汇总的方法及系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS648448A (en) * 1987-07-01 1989-01-12 Hitachi Ltd Expression system for tree structure data
JP2000348038A (ja) * 1999-06-02 2000-12-15 Fujitsu Ltd 半構造データベースのためのデータ格納装置および方法
JP2002334001A (ja) * 2001-04-27 2002-11-22 K-Plex Inc 木構造データの操作方法及び、それを実現する装置及びプログラム
JP2003271443A (ja) * 2002-03-15 2003-09-26 Toshiba Corp 構造化データ格納システムおよび方法、構造化データ検索システムおよび方法、記録媒体

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2789618B2 (ja) * 1988-11-30 1998-08-20 富士ゼロックス株式会社 木構造図作成システム
WO1996033470A1 (de) * 1995-04-18 1996-10-24 International Business Machines Corporation Abbildung eines graphen in einen speicher
JPH10240741A (ja) * 1997-02-28 1998-09-11 Nippon Telegr & Teleph Corp <Ntt> 木構造型データの管理方法
DE19810843B4 (de) * 1998-03-12 2004-11-25 Telefonaktiebolaget Lm Ericsson (Publ) Verfahren und Zugriffseinrichtung zum Bestimmen der Speicheradresse eines Datenwerts in einer Speichereinrichtung
US6812941B1 (en) * 1999-12-09 2004-11-02 International Business Machines Corp. User interface management through view depth
US6549221B1 (en) * 1999-12-09 2003-04-15 International Business Machines Corp. User interface management through branch isolation
US6847979B2 (en) * 2000-02-25 2005-01-25 Synquiry Technologies, Ltd Conceptual factoring and unification of graphs representing semantic models
US20020087596A1 (en) * 2000-12-29 2002-07-04 Steve Lewontin Compact tree representation of markup languages
US6925470B1 (en) * 2002-01-25 2005-08-02 Amphire Solutions, Inc. Method and apparatus for database mapping of XML objects into a relational database
US8818833B2 (en) * 2002-02-14 2014-08-26 International Business Machines Corporation Method and system for managing service requests across multiple systems
US20030188264A1 (en) * 2002-03-29 2003-10-02 Full Degree, Inc. Method and apparatus for XML data normalization
US7210097B1 (en) * 2002-05-22 2007-04-24 Pitney Bowes Inc. Method for loading large XML documents on demand
US20030236968A1 (en) * 2002-06-19 2003-12-25 Anindya Basu Method and apparatus for generating efficient data structures for use in pipelined forwarding engines
JP3935856B2 (ja) * 2003-03-28 2007-06-27 インターナショナル・ビジネス・マシーンズ・コーポレーション レイアウトの定められた文書のダイジェストを作成するための情報処理装置、サーバ、方法及びプログラム
US20090138491A1 (en) * 2007-11-28 2009-05-28 Sandeep Chowdhury Composite Tree Data Type

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS648448A (en) * 1987-07-01 1989-01-12 Hitachi Ltd Expression system for tree structure data
JP2000348038A (ja) * 1999-06-02 2000-12-15 Fujitsu Ltd 半構造データベースのためのデータ格納装置および方法
JP2002334001A (ja) * 2001-04-27 2002-11-22 K-Plex Inc 木構造データの操作方法及び、それを実現する装置及びプログラム
JP2003271443A (ja) * 2002-03-15 2003-09-26 Toshiba Corp 構造化データ格納システムおよび方法、構造化データ検索システムおよび方法、記録媒体

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019149019A (ja) * 2018-02-27 2019-09-05 株式会社東芝 支援システム

Also Published As

Publication number Publication date
CN100587673C (zh) 2010-02-03
JP4712718B2 (ja) 2011-06-29
JPWO2006038498A1 (ja) 2008-07-31
US20090106289A1 (en) 2009-04-23
CN101031892A (zh) 2007-09-05
CA2581219A1 (en) 2006-04-13
EP1811383A1 (en) 2007-07-25
KR101254544B1 (ko) 2013-04-19
KR20070057819A (ko) 2007-06-07

Similar Documents

Publication Publication Date Title
WO2006038498A1 (ja) 配列の生成方法、及び、配列生成プログラム
JP4681544B2 (ja) 配列の生成方法、情報処理装置、及び、プログラム
JP4537391B2 (ja) ツリー型データ構造を取り扱う方法、情報処理装置、及び、プログラム
JP4653157B2 (ja) ツリーの検索、集計、ソート方法、情報処理装置、および、ツリーの検索、集計、ソートプログラム
JP4886693B2 (ja) 情報処理方法、情報処理装置および情報処理プログラム
JP5834883B2 (ja) 因果関係要約方法、因果関係要約装置及び因果関係要約プログラム
JP2005025763A (ja) 構造化文書の分割プログラム、分割装置、及び分割方法
JP5241738B2 (ja) 表からツリー構造データを構築する方法及び装置
WO2006054506A1 (ja) ツリーデータの検索・集計・ソート方法及びプログラム
JP4681555B2 (ja) ノード挿入方法、情報処理装置、および、ノード挿入プログラム
JP4951407B2 (ja) コンテンツ部品検索方法及び装置
JP3578045B2 (ja) 全文検索方法及び装置及び全文検索プログラムを格納した記憶媒体
JP2004118543A (ja) 構造化文書検索方法、検索支援方法、検索支援装置および検索支援プログラム
JP2009251845A (ja) 検索結果評価装置及び検索結果評価方法
JP5434500B2 (ja) 木構造処理装置及びプログラム
Chen et al. Efficient processing of XPath queries using indexes

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A1

Designated state(s): AE AG AL AM AT AU AZ BA BB BG BR BW BY BZ CA CH CN CO CR CU CZ DE DK DM DZ EC EE EG ES FI GB GD GE GH GM HR HU ID IL IN IS JP KE KG KM KP KR KZ LC LK LR LS LT LU LV LY MA MD MG MK MN MW MX MZ NA NG NI NO NZ OM PG PH PL PT RO RU SC SD SE SG SK SL SM SY TJ TM TN TR TT TZ UA UG US UZ VC VN YU ZA ZM ZW

AL Designated countries for regional patents

Kind code of ref document: A1

Designated state(s): BW GH GM KE LS MW MZ NA SD SL SZ TZ UG ZM ZW AM AZ BY KG KZ MD RU TJ TM AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HU IE IS IT LT LU LV MC NL PL PT RO SE SI SK TR BF BJ CF CG CI CM GA GN GQ GW ML MR NE SN TD TG

121 Ep: the epo has been informed by wipo that ep was designated in this application
DPE1 Request for preliminary examination filed after expiration of 19th month from priority date (pct application filed from 20040101)
WWE Wipo information: entry into national phase

Ref document number: 1020077005216

Country of ref document: KR

WWE Wipo information: entry into national phase

Ref document number: 2581219

Country of ref document: CA

Ref document number: 2006539235

Country of ref document: JP

WWE Wipo information: entry into national phase

Ref document number: 200580032898.X

Country of ref document: CN

WWE Wipo information: entry into national phase

Ref document number: 2005787558

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

WWP Wipo information: published in national office

Ref document number: 2005787558

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 11576481

Country of ref document: US