WO2007020850A1 - 情報処理方法、情報処理装置および情報処理プログラム - Google Patents

情報処理方法、情報処理装置および情報処理プログラム Download PDF

Info

Publication number
WO2007020850A1
WO2007020850A1 PCT/JP2006/315739 JP2006315739W WO2007020850A1 WO 2007020850 A1 WO2007020850 A1 WO 2007020850A1 JP 2006315739 W JP2006315739 W JP 2006315739W WO 2007020850 A1 WO2007020850 A1 WO 2007020850A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
array
node identifier
tree
value
Prior art date
Application number
PCT/JP2006/315739
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 US12/063,596 priority Critical patent/US20090106298A1/en
Priority to JP2007530961A priority patent/JP4886693B2/ja
Publication of WO2007020850A1 publication Critical patent/WO2007020850A1/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
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/81Indexing, e.g. XML tags; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion
    • G06F16/86Mapping to a database

Definitions

  • the present invention relates to a method for handling a tree-type data structure, in particular, a method for deleting a tree force partial tree, a method for inserting another tree into a tree, an information processing apparatus for performing these methods, and these
  • the present invention relates to a program for causing a computer to execute a method.
  • RDB relational databases
  • the first reason for this inefficiency is that it is difficult to immediately identify where the data should be, because the data is distributed across the nodes.
  • RDB for example, the data “age” is stored only in the item “age” of a certain table.
  • nodes that hold the data “age” are scattered in various places. Generally, if the entire tree-type data structure is not examined, the corresponding data is searched. I can't.
  • 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 Sekk Co., Ltd., "Karearea White Paper", [online], [February 2004 1 9 days search], Internet ⁇ URL: http: //www.sec. Co.jp/products/karearea/>
  • Non-patent literature 2 W3C, "Extensible Markup Language (XML) 1.0 (Third Edition)" ⁇ [onl ine ], February 4, 2004, [Search February 19, 2004], Internet URL: http: ⁇ ww w.w3.org/TR/2004/REC-xml-20040204/>
  • Non-Patent Document 3 R. Alain, Iku, Brad Lupen, Sultan Luman, “Programming XML”, Nikkei DP Soft Press, 2002, p. 59-p. 84
  • this mechanism is a search that uses the relationship between nodes as a problem (for example, extraction of a tree that includes “60 years old” and “age” as ancestors and “1 year” and “age” as descendants) Not available for
  • 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.
  • it has been difficult to edit the topology of a tree-type data structure in particular, to insert a descendant node into a node with tree-structured data.
  • the above DOM only specifies the interface for operations that edit the topology of the tree-type data structure, not the specific method of operation.
  • the present invention efficiently removes a partial tree that is a part of the tree from the tree, and inserts another tree into the tree, an information processing apparatus, and a program.
  • the purpose is to provide lamb.
  • the present invention provides a parent-child relationship between nodes constituting a tree-type data structure and a parent node to a child node that is not a parent-child relationship in which a child node is associated with a parent node. Insertion and deletion are realized by using a parent-child relationship definition array expressed by a “child-to-parent” relationship that associates nodes.
  • a parent-child relationship When a parent-child relationship is expressed by a known “parent ⁇ child” relationship, a single parent node may correspond to a plurality of child nodes.
  • the parent-child relationship cannot be defined without specifying. That is, even if a parent node is specified, a child node having a parent-child relationship with the parent node cannot be specified.
  • the parent-child relationship is expressed by a “child ⁇ parent” relationship as in the present invention, since only one parent node always corresponds to one child node, this child node can be identified by specifying this child node. A single parent node corresponding to a child node can be immediately identified.
  • an object of the present invention is a node identifier assigned to a node including a root 'node to represent a tree-type data structure, and a node of a parent node with respect to a node having a parent-child relationship.
  • the identifier is a node identifier that is assigned to each of the non-root nodes other than the root node by using a node identifier that is a continuous integer that satisfies the relationship ⁇ ⁇ and ⁇ ⁇ smaller than the node identifier of the child node.
  • An information processing method for generating comprising: reading from the storage device a parent-child relationship definition array of a tree from which the partial tree is to be deleted;
  • the same size as the parent-child relationship definition array generated in the storage device Nodes constituting the partial tree in the erase flag array Setting the flag for the node identifier of
  • the node identifier of the parent node is smaller than the node identifier of the child node for each node in the tree after deletion of the partial tree, and for the node in the parent-child relationship.
  • a node identifier which is a continuous integer satisfying the relationship is assigned, and a new node identifier array storing the assigned new node identifier in association with the node identifier of the node of the tree before deletion is stored in a storage device.
  • a partial tree deletion in which a node identifier of a parent node of a node having the node identifier is stored in association with the new node identifier based on the parent-child relationship definition array and the new node identifier array. Generating a subsequent parent-child relationship definition array in the storage device;
  • the node identifier is a continuous integer assigned in preference to a node of the same generation over a child node, and is a node other than the root 'node.
  • a parent-child relationship definition array storing a node identifier assigned to each parent node of the non-root node in association with a node identifier assigned to each is stored in the storage device.
  • the step of generating the new node identifier array includes the step of assigning a node identifier, which is a continuous integer, given to each of the nodes in preference to a node of the same generation over a child node.
  • the node identifier is a continuous integer that is given priority over child nodes over nodes of the same generation, and is assigned to each of the non-root nodes that are nodes other than the root node
  • a parent-child relationship definition array storing a node identifier assigned to each parent node of the non-root 'node in association with a node identifier is stored in the storage device
  • the step of generating the new node identifier array may include a step of giving a node identifier that is an integer given to each of the nodes in preference to a child node over a node of the same generation! ⁇ .
  • a node of the tree node is stored in the storage device.
  • a node value storage array storing at least the node value of the node is stored,
  • the storage device stores a node value storage array storing at least a node value of the node in association with each node identifier of the node of the tree,
  • a new node value storage array that stores the node value in association with each new node identifier in accordance with the association between the original node identifier and the new node identifier with reference to the new node identifier array. It has a step to generate.
  • the step of generating the new node identifier array comprises:
  • the value of the erasure flag array is set.
  • the value of the current node identifier area is stored as the value of the new node identifier array.
  • the step of generating the parent-child relationship definition array after the partial tree deletion comprises:
  • the new node identifier array referring to the value at the same position as the storage position of the value in the parent-child relationship definition array, the new node identifier array is included in the storage address array except when the value is an invalid value. Storing the value in Reserving an area in the storage device for a parent node identifier array having the same size as the parent-child relationship definition array;
  • the new node identifier referring to the position value indicated by the value of the parent-child relationship definition array, the new node identifier is located at the same position as the value of the parent-child relationship definition array in the parent node identifier array. Storing the values of the array;
  • an object of the present invention is a unique node identifier assigned to a node including a root 'node in order to represent a tree-type data structure, and a node of the same generation is given priority over a child node.
  • the parent identifier of each of the non-root 'nodes is associated with the node identifier assigned to each of the non-root' nodes that are nodes other than the root node.
  • Reading from the storage device a first parent-child relationship definition array of the inserted-side tree and a second parent-child relationship definition array of the inserted-side tree;
  • the root 'node of the insertion side tree is set as a vertex node closest to the root' node in the partial tree of the insertion side tree. Identifying a node of the inserted tree adjacent to each node, and storing information of the node of the inserted tree in the storage device;
  • each node was given priority to the same generation node over the child node with respect to the inserted tree after insertion of the inserting tree.
  • a node identifier that is a continuous integer is assigned, and the new node identifier assigned is stored in association with the node identifier of the node of the inserted tree before insertion.
  • the first new node identifier array is generated in the storage device, and the insertion-side tree after the insertion-side tree is inserted based on the information on the position where the vertex node of the insertion-side tree is inserted.
  • Each node is assigned a node identifier, which is a continuous integer assigned in preference to the same generation of nodes over the child nodes, and the new node identifier assigned is assigned to the node in the insertion side tree before insertion.
  • the parent node of the node having the node identifier is associated with the new node identifier.
  • the first node stores at least the node value of the node in association with each of the node identifiers of the nodes of the inserted tree in the storage device.
  • a second node value storage array storing at least the node value of the node in association with each of the node identifiers of the nodes of the insertion side tree,
  • first and second new node identifier arrays according to the association between the original node identifier of each of the inserted-side tree and the inserted-side tree and the new node identifier of the tree after insertion, Updating at least one of the first node value storage array and the second node array.
  • the first node stores at least the node value of the node in association with each node identifier of the node of the inserted tree in the storage device.
  • a value storage array is stored, and a second node value storage array storing at least the node value of the node is associated with each node identifier of the node of the insertion side tree.
  • the node value In association with each new node identifier, the node value And a step of generating a new node value storage array storing the above.
  • the step of storing the information of the node of the inserted tree in the storage device includes:
  • the node immediately after the insertion position and the immediately following The node includes a step of storing a value indicating that the node is an insertion position by a node having an ancestor as a node.
  • the embodiment further stores a level value representing a depth level of each node of the inserted-side tree from a vertex node of the inserted-side tree. Generating a first level array in the storage device;
  • the depth of each node of the insertion-side tree from the vertex node of the insertion-side tree is determined.
  • the insertion mark array at the position where the value of the insertion mark array changes to a value indicating the insertion position, (a) referring to a level value at the position in the first level array, and specifying a range having the same level value in the second level array;
  • the method further includes a step.
  • the step of generating the parent-child relationship definition array after inserting the tree comprises:
  • the node identifier of the node that becomes the parent node of the vertex node of the insertion side node is stored as the first value, and the second parent-child relationship definition is stored as another value.
  • the value of the second new node identifier array is set to the same position as the value of the parent-child relationship definition array in the second parent node identifier array.
  • an object of the present invention is a node identifier assigned to a node including a root 'node in order to represent a tree-type data structure, and for a node having a parent-child relationship, the node identifier of the parent node is a child identifier.
  • the node identifier which is a continuous integer satisfying the relationship of being smaller than the node identifier of the node, is used in association with the node identifier assigned to each of the non-root nodes other than the root node.
  • It has a parent-child relationship definition array generated in the storage device that stores the node identifier assigned to each parent node of the non-root 'node, and from a tree, a specific node is a vertex node and its descendant nodes And a parent-child relationship definition array is stored in the storage device for the tree-type data structure of the tree after the partial tree is deleted.
  • a parent-child relationship definition array generated in the storage device that stores the node identifier assigned to each parent node of the non-root 'node, and from a tree, a specific node is a vertex node and its descendant nodes And a parent-child relationship definition array is stored in the storage device for the tree-type data structure of the tree after the partial tree is deleted.
  • Data reading means for reading from the storage device a parent-child relationship definition array of a tree from which the partial tree is to be deleted;
  • the deletion flag array generation means for setting the flag for the node identifiers of the nodes constituting the partial tree in the deletion flag array, and the tree after deletion of the partial tree with reference to the deletion flag array, respectively.
  • the node identifier of the parent node is smaller than the node identifier of the child node, and a node identifier that is a continuous integer that satisfies this relationship is assigned.
  • the new node identifier sequence generation unit that,
  • the node identification of the parent node of the node having the node identifier associated with the new node identifier is generated in the storage device;
  • the node identifier is a continuous integer assigned in preference to a node of the same generation over a child node, and is a node other than the root 'node.
  • a parent-child relationship definition array storing a node identifier assigned to each parent node of the non-root node in association with a node identifier assigned to each is stored in the storage device.
  • the new node identifier generation means is configured to assign a node identifier, which is a continuous integer, given to each of the nodes by giving priority to a node of the same generation over a child node.
  • the node identifier is a continuous integer given a child node in preference to a node of the same generation, and is a node other than the root 'node.
  • a parent-child relationship definition array storing a node identifier assigned to each parent node of the non-root node in association with a node identifier assigned to each of the root 'nodes is stored in the storage device,
  • the new node generation means is configured to give a node identifier, which is a continuous integer, giving a priority to child nodes over nodes of the same generation.
  • the storage device stores a node value storage array storing at least a node value of the node in association with each node identifier of the node of the tree,
  • Node value storage array updating means for updating the node value storage array in accordance with the association between the original node identifier and the new node identifier with reference to the new node identifier array.
  • a node value storage array storing at least a node value of the node is stored in the storage device in association with each node identifier of the node of the tree.
  • Node value storage array generation means for generating is provided.
  • the new node identifier array generation means includes:
  • a current node identifier area for temporarily storing a new node identifier is secured in the storage device, and its initial value is stored.
  • the value of the erasure flag array is set.
  • the value of the current node identifier area is stored as the value of the new node identifier array. If the value of the current node identifier area is incremented, while the value of the erase flag array is set, the invalid value is stored as the value of the new node identifier array.
  • the post-deletion parent-child relationship definition array generating means reserves an area for a storage address array having the same size as the parent-child relationship definition array in the storage device,
  • the new node identifier array referring to the value at the same position as the storage position of the value in the parent-child relationship definition array, the new node identifier array is included in the storage address array except when the value is an invalid value. Stores the value in
  • An area for a parent node identifier array having the same size as the parent-child relationship definition array is secured in the storage device;
  • the new node identifier referring to the position value indicated by the value of the parent-child relationship definition array, the new node identifier is located at the same position as the value of the parent-child relationship definition array in the parent node identifier array.
  • a parent-child relationship definition array storing values of the parent node identifier array in association with values in the storage address array is generated.
  • an object of the present invention is to include a node including a root 'node to represent a tree-type data structure.
  • a node identifier other than the root node is used by using a node identifier that is a unique node identifier given to a node and is a consecutive integer given a node of the same generation in preference to a child node.
  • a parent-child relationship definition array generated during storage that stores the node identifier assigned to each parent node of the non-root 'node in association with the node identifier assigned to each non-root' node.
  • An information processing apparatus comprising: a tree as an insertion-side tree, and by inserting the root 'node of the insertion-side tree that is another tree into a specific node of the insertion-side tree, the insertion In the information processing apparatus configured to generate a parent-child relationship definition array in the storage device for the tree-type data structure of the inserted tree after adding the side tree!
  • Data reading means for reading from the storage device the first parent-child relationship definition array of the inserted-side tree and the second parent-child relationship definition array of the inserted-side tree;
  • the root 'node of the insertion side tree is set as a vertex node closest to the root' node in the partial tree of the insertion side tree.
  • An insertion position information generating means for identifying a node of the insertion-side tree adjacent to each node and storing information on the node of the insertion-side tree in the storage device;
  • each node was given priority to the same generation node over the child node with respect to the inserted tree after insertion of the inserting tree.
  • a first new node identifier array in which node identifiers that are consecutive integers are assigned and the assigned new node identifier is stored in association with the node identifier of the node of the inserted tree before insertion is stored Based on the information on the position where the vertex node of the insertion-side tree is inserted, the insertion-side tree after insertion of the insertion-side tree is the same as each node than the child node.
  • a node identifier that is a continuous integer assigned with priority given to the generation node is assigned, and the new node identifier assigned is identified as the node of the node in the insertion side tree before insertion.
  • the first and second parent-child relationship defining arrays, and the first and second new nodes Based on the node identifier array, a parent-child relationship definition array of the tree after insertion is generated in the storage device in association with the new node identifier and storing the node identifier of the parent node of the node having the node identifier. And a post-insertion parent-child relationship definition array generating means.
  • the first node storing at least the node value of the node in association with each of the node identifiers of the node of the inserted tree is stored in the storage device.
  • a second node value storage array storing at least the node value of the node in association with each of the node identifiers of the nodes of the insertion side tree,
  • Node value storage array updating means for updating at least one of the first node value storage array and the second node array is provided.
  • the first node stores at least the node value of the node in association with each node identifier of the node of the inserted tree in the storage device.
  • a value storage array is stored, and a second node value storage array storing at least the node value of the node is associated with each node identifier of the node of the insertion side tree.
  • Node value storage array generation means for generating a new node value storage array storing the node values in association with each new node identifier is provided.
  • the insertion position information generating means includes:
  • the node immediately after the insertion position and the immediately following A node having an ancestor as a node is configured to store a value indicating the insertion position. Further, in another preferred embodiment, a level value representing a depth level of each node of the inserted-side tree from a vertex node of the inserted-side tree is further stored.
  • 1st level array generating means for generating 1 level array in the storage device, and referring to a level value corresponding to an insertion position of a vertex node of the insertion side tree in the first level array
  • Second level array generation for generating, in the storage device, a second level array storing a level value representing a depth level of each node of the insertion side tree from the vertex node of the inserted side tree.
  • the new node identifier array generating means is
  • An area for the first and second parent-child relationship definition arrays and the first and second new node identifier arrays having the same size are allocated in the storage device, respectively.
  • a current node identifier area for temporarily storing a new node identifier is secured in the storage device, and an initial value thereof is stored.
  • the post-insertion parent-child relationship defining sequence generating means comprises:
  • the position of the value of the parent-child relationship definition array in the first parent node identifier array with reference to the value indicated by the value of the first parent-child relationship definition array in the first new node identifier array Stores the value of the first new node identifier array in the same position as
  • An area for a second parent node identification array having the same size as the second parent-child relationship definition array is secured in the storage device;
  • the node identifier of the node that becomes the parent node of the vertex node of the insertion side node is stored as the first value, and the second parent-child relationship definition is stored as another value.
  • the value of the second new node identifier array is placed at the same position as the value of the parent-child relationship definition array in the second parent node identifier array.
  • an object of the present invention is a node identifier assigned to a node including a root 'node in order to represent a tree-type data structure, and for a node having a parent-child relationship, the node identifier of the parent node Is associated with the node identifier assigned to each non-root node other than the root node, using a node identifier that is a continuous integer that satisfies the relationship that it is less than the node identifier of the child node.
  • the parent-child relationship definition generated in the storage device storing the node identifier assigned to each parent node of the non-root 'node.
  • Reading from the storage device a parent-child relationship definition array of a tree from which the partial tree is to be deleted;
  • the node identifier of the parent node is smaller than the node identifier of the child node for each node in the tree after deletion of the partial tree, and for the node in the parent-child relationship.
  • a node identifier which is a continuous integer satisfying the relationship is assigned, and a new node identifier array storing the assigned new node identifier in association with the node identifier of the node of the tree before deletion is stored in a storage device.
  • a partial tree deletion in which a node identifier of a parent node of a node having the node identifier is stored in association with the new node identifier based on the parent-child relationship definition array and the new node identifier array. Generating a subsequent parent-child relationship definition array in the storage device;
  • the node identifier is a continuous integer assigned in preference to a node of the same generation over a child node, and is assigned to each non-root node that is a node other than the root node.
  • a parent-child relationship definition array storing a node identifier assigned to each parent node of the non-root node in association with the determined node identifier is stored in the storage device;
  • the computer In the step of generating the new node identifier array, the computer is assigned to each of the nodes with priority given to a node of the same generation over a child node.
  • the step of assigning a node identifier which is an integer to be executed is executed.
  • the node identifier is a continuous integer given a child node in preference to a node of the same generation, and is a node other than the root 'node' non-root 'node
  • a parent-child relationship definition array storing a node identifier assigned to each parent node of the non-root 'node in association with a node identifier assigned to each of the nodes;
  • the computer is caused to execute a step of giving a node identifier which is an integer given to each of the nodes in preference to a child node over a node of the same generation. .
  • the storage device stores a node value storage array storing at least a node value of the node in association with each node identifier of the node of the tree. And to the computer,
  • the step of updating the node value storage array according to the association between the original node identifier and the new node identifier is executed with reference to the new node identifier array.
  • a node value storage array storing at least a node value of the node is stored in the storage device in association with each node identifier of the node of the tree, and the computer stores the node value storage array.
  • a new node value storage array that stores the node value in association with each new node identifier in accordance with the association between the original node identifier and the new node identifier with reference to the new node identifier array.
  • the generation step is executed.
  • the value of the erase flag array is set.
  • the value of the current node identifier area is set as the value of the new node identifier array. And then incrementing the value of the current node identifier area, while if the value of the erase flag array is set, storing an invalid value as the value of the new node identifier array And execute.
  • the new node identifier array referring to the value at the same position as the storage position of the value in the parent-child relationship definition array, the new node identifier array is included in the storage address array except when the value is an invalid value. Storing the value in
  • the new node identifier referring to the position value indicated by the value of the parent-child relationship definition array, the new node identifier is located at the same position as the value of the parent-child relationship definition array in the parent node identifier array. Storing the values of the array;
  • an object of the present invention is a unique node identifier assigned to a node including a root 'node in order to represent a tree-type data structure, and prioritizes nodes of the same generation over child nodes.
  • a node identifier that is a given consecutive integer, in association with a node identifier assigned to each of the non-root 'nodes that are nodes other than the root node, each parent node of the non-root' node.
  • the root 'node of the insertion side tree is set as a vertex node closest to the root' node in the partial tree of the insertion side tree. Identifying a node of the inserted tree adjacent to each node, and storing information of the node of the inserted tree in the storage device;
  • each node was given priority to the same generation node over the child node with respect to the inserted tree after insertion of the inserting tree.
  • a first new node identifier array in which node identifiers that are consecutive integers are assigned and the assigned new node identifier is stored in association with the node identifier of the node of the inserted tree before insertion is stored Based on the information on the position where the vertex node of the insertion-side tree is inserted, the insertion-side tree after insertion of the insertion-side tree is the same as each node than the child node.
  • a node identifier that is a continuous integer assigned with priority given to the generation node is assigned, and the new node identifier assigned is identified as the node of the node in the insertion side tree before insertion.
  • Generating in the storage device a second new node identifier array stored in association with the child;
  • the parent node of the node having the node identifier is associated with the new node identifier.
  • the first node value storage in which at least the node value of the node is stored in the storage device in association with each node identifier of the node of the inserted tree.
  • An array is stored, and a second node value storage array storing at least a node value of the node is stored in association with each of the node identifiers of the nodes of the insertion side tree, and the computer stores:
  • the inserted tree and the insertion Updating at least one of the first node value storage array and the second node array in accordance with an association between each original node identifier of the entry-side tree and a new node identifier of the tree after insertion; Let it run.
  • the first node stores at least the node value of the node in association with each node identifier of the node of the inserted tree in the storage device.
  • a value storage array is stored
  • a second node value storage array storing at least a node value of the node is stored in association with each node identifier of the node of the insertion side tree
  • the computer stores:
  • a step of generating a new node value storage array storing the node values in association with each new node identifier is executed.
  • the node immediately after the insertion position and the immediately following causes a step of storing a value indicating the insertion position to be executed.
  • the computer further includes a level representing a depth level of each node of the inserted-side tree from a vertex node of the inserted-side tree. Generating a first level array storing values in the storage device;
  • the depth of each node of the insertion-side tree from the vertex node of the insertion-side tree is determined.
  • the computer In the step of generating the first and second new node identifier arrays, the computer
  • the first and second parent-child relationship definition arrays and the first and second of the same size, respectively Reserving an area in the storage device for a second new node identifier array;
  • the computer In the insertion mark array, at a position other than the position where the value changes to a value indicating the insertion position, the computer is
  • the value of the parent-child relationship definition array in the first parent node identifier array is referred to by referring to the value indicated by the value of the first parent-child relationship definition array in the first new node identifier array. Storing the value of the first new node identifier array at the same position as the position of, and associating the value of the first new node identifier array with the value of the first parent node identifier array; ,
  • the node identifier of the node that becomes the parent node of the vertex node of the insertion side node is stored as the first value, and the second parent-child relationship definition is stored as another value.
  • the value of the second new node identifier array is set to the same position as the value of the parent-child relationship definition array in the second parent node identifier array.
  • FIG. 1 is a block diagram showing a hardware configuration of an information processing apparatus that handles a tree-type data structure that is useful in the embodiment of the present invention.
  • this information processing device 10 has the same configuration as an ordinary computer, and stores a CPU 12, work data, and the like that control the entire device and individual components by executing a program.
  • RAM Random Access Memory
  • ROM Read Only Memo
  • hard disk device 18 for storing programs, etc. ry
  • driver 20 for accessing CD-ROM19
  • interface 20 provided between driver 20 and external terminal connected to external network (not shown) 22
  • it is equipped with an input device 24 and a display device 26 that have a keyboard and mouse power.
  • the CPU 12, RAM 14, ROM 16, hard disk device 18, I / F 22, input device 24 and display device 26 are connected to each other via a node 28.
  • the computer system 10 is configured to read the data stored in the CD-ROM 19 by the dry memory 20, but is not limited to this. CD-R / W, DVD -ROM, DVD—You may be able to read data stored in RAM.
  • the program for building the tree-type data structure on the memory such as the RAM 14 and the program for converting the tree-type data structure on the memory according to the present embodiment are accommodated in the CD-ROM 19, and the driver 20 Or may be stored in the ROM 16 in advance. Further, what is once read from the CD-ROM 19 may be stored in a predetermined area of the hard disk device 18. Alternatively, the program may be supplied from the outside via a network (not shown), an external terminal, and the IZF 22.
  • the information processing apparatus provides a computer with a program for building a tree-type data structure on a memory and a program for converting the tree-type data structure on the memory. It is realized from the fact that it is executed. Programs that convert this tree-type data structure in memory include programs that realize tree insertion processing and programs that delete tree deletion, which will be described later.
  • FIG. 2A and 2B are explanatory diagrams of POS data, which is an example of tree-type data
  • FIG. 2A is an example of a visual representation of the data structure (ie, topology) and data values of this tree-type data
  • Figure 2B is an example of the same tree type data expressed in XML format.
  • the tree-type data structure starts with the root 'node (POS data in this example), and is a combination of the node and arc that branches at each node and reaches the leaf' node (endpoint) Is expressed by
  • Each node is associated with item name information, ie, node type, and item value information, ie, node value.
  • item name information ie, node type
  • item value information ie, node value.
  • This association can be realized, for example, by associating a node identifier with a pointer to a node information storage area in which information describing the node type and node value is stored.
  • the present invention is not limited by the way the actual values of the tree data structure are handled.
  • 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 essentially represents the storage address of the node. 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.
  • a tree type data structure consisting of 12 node powers with a node identifier (ID) of “110” is shown.
  • Figure 3A shows the entire tree-type data structure.
  • Figure 3A the numbers written in the center of the shapes such as circles and heart shapes (representing the node type) represent the node IDs, and 0, 10> etc.
  • a pair of numbers represents an arc.
  • Node IDs are limited to character strings. It may be a numerical value, particularly an integer.
  • Figure 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” is three times in the From—ID of the arc list. Has appeared. In other words, since the child node cannot be specified even if the parent node is specified, the arc list is composed of an array of element From—ID and an array of element To—ID. 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” relationship there is an important characteristic that cannot be obtained in the case of the “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 expressing 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, As shown, the storage area of the parent node for the root node may be excluded from the arc list based on the “child ⁇ parent” relationship.
  • 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 from “0” or “1”. To do.
  • a numerical value as the node identifier, more preferably a consecutive integer, and more preferably an integer sequence from “0” or “1”. To do.
  • the process of subtracting the node identifier of the child node is also performed. It can be fast.
  • 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 ( Assign a higher number to the lowermost brother) node, and give a priority to the sibling node over the child node. 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.
  • 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 in which the depth-first tree-type data structure force shown in FIG. 6C is also created according to an embodiment of the present invention.
  • Fig. 9 as sub-tree 1 or sub-tree 2, if the parent-child relationship of nodes assigned consecutive numbers with depth priority is arranged based on the "child-to-parent" relationship, An excellent property is that the mode appears in a continuous region.
  • 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).
  • the parent-child relationship between the nodes includes "parent->parent” as well as an array of "child->parent” relationships. It can also be expressed by an array of “child” relationships.
  • 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.
  • node [0] that is, the child node for the root node is the three elements from the beginning of the array P ⁇ C, “1” of P ⁇ C [0], “6” of P ⁇ C [1] ”And“ 8 ”in P ⁇ C [2].
  • 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.
  • 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
  • Step 1013 in which a unique integer continuously changing from the number next to the number assigned immediately before from the top brother node to the bottom brother node is assigned in order,
  • FIG. 12 is an explanatory diagram of an array of parent-child relationships based on the “child ⁇ parent” expression in which the breadth-first tree-type data structure force shown in FIG. 7C is also created according to an embodiment of the present invention.
  • Fig. 12 when the parent-child relationship of nodes assigned consecutive numbers with breadth priority is arranged based on the "child-to-parent" relationship, the child node of a certain node appears in a continuous region. The obtained 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 region 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.
  • the parent-child relationship array is an array Aggr for indicating the area where the child node number for each node is stored.
  • two arrays P ⁇ C that store the child node numbers.
  • the value of the second element Aggr [l] from the top of the array Aggr is “3”, which means that the child node number for node [1] is the element P ⁇ C [3] of the array P ⁇ C This indicates that it has been stored since then.
  • node [0] that is, the child node for the root node is the three elements from the top of the array P ⁇ C, “1” of P ⁇ C [0], “2” of P ⁇ C [1] ”And P ⁇ C [2]“ 3 ”.
  • 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.
  • depth priority mode and width priority mode for assigning sequential numbers to nodes.
  • Each of the doors has unique and excellent properties.
  • the information processing apparatus 10 will not be described in detail, but as shown in FIG. 14, the “child ⁇ parent” representation format based on depth priority and the “child ⁇ parent” based on width priority are shown.
  • the expression format can be converted between the “expression format” and the “parent ⁇ child” format.
  • Tree deletion which is one of the operations for editing the topology of a tree-type data structure.
  • “Tree deletion” means to remove a specific node and its descendants (ie, a partial tree) from the entire tree in the tree-type data structure.
  • CP array a parent-child relationship definition array represented by a “child ⁇ parent” expression stored in memory, which represents a tree-type data structure.
  • C-> The node information corresponding to the partial tree is deleted from “P” or “CP”), and the new nodes are attached to the remaining nodes according to, for example, the breadth-first mode.
  • the partial tree deleted from the entire tree includes those composed of a single node.
  • a node and a node group from the node force branching to the leaf 'node are referred to as a partial tree.
  • a node closest to the root 'node is referred to as a vertex node.
  • a tree-type data structure is represented in the width priority mode, and a CP array storing the node identifiers of the nodes constituting the tree is stored in the memory according to the width priority mode. Describe the case of deleting a tree.
  • FIG. 15 is a diagram visually showing an example of a tree-type data structure expressed in the breadth-first mode that is useful for the present embodiment.
  • this tree-type data structure let us consider deleting a partial tree whose node is a node with node identifier “2” (see reference numeral 1501).
  • the single deletion process basically, the partial tree having the node identifier “2” as the vertex node is removed from the entire tree, and the remaining nodes are newly added according to the breadth-first mode. Is assigned a node identifier, and array power related to the node identifier
  • FIG. 16 is a flowchart showing tree deletion processing that is useful in the present embodiment.
  • the CPU 12 secures a delete flag array, a new node identifier array, and a current node number area in a memory such as the RAM 14 (step 1601).
  • the CPU 12 sets a delete flag array flag for the node identifier of the vertex node of the partial tree to be deleted (step 1602).
  • the operator refers to the topology of the tree-type data structure shown in FIG. 15 displayed on the display device 26, operates the input device 24, and designates the vertex node. (Node 1 501 in this example).
  • FIG. 17 shows an array representing the parent-child relationship of the tree-type data structure shown in FIG. 15, a delete flag array (indicated as “Delete Flag” in the figure) storing initial values, and a new node identifier array. (Indicated as “New Node No.” in the figure), and a diagram showing a powerful node identifier area (indicated as “Current Node No.” in the figure) in which initial values are arranged. is there.
  • the current node identifier area 1702 stores an initial value “0”.
  • the CPU 12 initializes a processing target position for specifying a processing target node to “0” (step 1603).
  • the CPU 12 checks the flag at the processing target position in the delete flag array (step 1604), and determines whether the flag is set (step 1605). If NO in step 1605, then the CPU 12 checks the flag for the parent node of the node at the processing target position in the delete flag array (step 1606) and determines whether the flag is set. (Step 1607). If NO is also determined in step 1607, the CPU 12 stores the value of the current node identifier area in the processing target position in the new node identifier array and increments the value of the current node identifier area. (Step 1608).
  • step 1605 if it is determined yes or no in step 1605 or yes in step 1607, the CPU 12 sets the element at the processing target position to “1” in the delete flag array. To In the new node identifier array, “—1” is stored at the processing target position (step 1609).
  • “1” is set in the corresponding element of the delete flag array, and it is clear that the node is the deletion target. Also, in the new node identifier array, a specific value “—1” is given so that the node can be deleted.
  • a new node identifier excluding one or more nodes constituting the partial tree to be deleted for that node. Is granted.
  • the new node identifier is stored in the new node identifier array.
  • Step 1605 when the position to be processed is “0”, it is determined NO in Step 1605 and Step 1607. As a result, the value “0” of the current node identifier area is stored in the processing target position “0” in the new node identifier array, and then the value S of the current node identifier area is incremented to “1”. . As shown in FIG. 18B, even in the case of the processing target position “1”, it is determined NO in Step 1605 and Step 1607. As a result, the value “1” of the current node identifier region is stored in the processing target position “1” in the new node identifier array, and then the value S of the current node identifier region is incremented to “2”.
  • the value of the processing target position “2” in the delete flag array is set to “1” (although it is actually set), and the processing target position “2” in the new node identifier array “—1” is stored as the value of.
  • FIG. 19B when the processing target position is “6”, it is determined as Yes in step 1607.
  • the value of the processing target position “6” is set to “1” in the delete flag array, and “ ⁇ 1” is stored as the value of the processing target position “6” in the new node identifier array. .
  • Figure 16 shows all nodes (that is, nodes with node identifiers "0" to "11").
  • an array as shown in FIG. 20 can be obtained.
  • the CPU 12 Based on the new node identifier array, the CPU 12 generates a CP array of the tree after deleting the nodes constituting the partial tree.
  • FIG. 21 is a flowchart showing processing for generating a CP array after tree deletion (tree deletion processing (2)).
  • the CPU 12 secures a new C—P array area in the memory (step 2101). Note that the size of the area for the new C—P array is smaller than the size of the C—P array before tree deletion, so it is sufficient if it is the same as the size of the C—P array before tree deletion. It is.
  • the CPU 12 stores the storage address array area for temporarily storing the storage address (that is, storage position number) of the new CP array, and the node identifier of the parent node of each node after tree deletion An area of the parent node identifier array for temporarily storing is reserved in the memory (step 2102). The size of these arrays should be the same as the size of the CP array!
  • the CPU 12 initializes the processing target position to “0” (step 2103).
  • the CPU 12 calculates a storage address and a node identifier of the parent node for each node to be processed.
  • the CPU 12 acquires the value of the processing target position in the new node identifier array (step 2104).
  • the CPU 12 stores the value acquired in step 2104 in the processing target position in the storage address array (step 2105).
  • the value in the new node identifier array is “ ⁇ 1”, an invalid value is stored in the storage address array.
  • FIGS. 22A to 22D are diagrams specifically illustrating the processing executed in step 2104 and step 2105.
  • FIG. 22A when the processing target position is “0”, the value “0” of the storage position number “0” is acquired in the new node identifier array, and the acquired value “0” is stored. It is stored at the position of storage position number “0” in the address array (indicated as “Addr” in the figure). Also, as shown in FIG. 22B, when the processing target position is “1”, the value “1” of the storage position number “1” is acquired in the new node identifier array, and the acquired value “1” is the storage address. Stored at the position of storage position number “1” in the array.
  • the CPU 12 obtains the value of the processing target position (node identifier) in the C—P array (step 2106), and in the new node identifier array, The position value indicated by the value (node identifier) is acquired (step 2107). Further, the CPU 12 stores the acquired value of the new node identifier array at the processing target position in the parent node identifier array (step 2108). Although not shown in FIG. 21, when the value of the C—P array (node identifier) is “—1,” the exception is that the same processing target position in the parent node identifier array Stores the value "one 1". This is an exception handling for the root node.
  • FIGS. 23A to 23D are diagrams for specifically explaining the processing executed in steps 2106 to 2108.
  • FIG. 23A when the processing target position is “0”, the value of the C—P array is “1”, so as an exception process, the parent node identifier array (“P—Node” in the figure) “1” is stored as the value of the storage position number “0”.
  • FIG. 23B the value “0” of the storage position number “0” is acquired in the new node identifier array because the value of the C—P array is “0” at the processing target position “1”.
  • the acquired value “0” is stored in the processing target position “1” (the position of the storage position number “1”) in the parent node identifier array.
  • step 2104 and 2105 For all node identifiers, storage address calculation (steps 2104 and 2105) and parent node identifier calculation (steps 2106 to 2108) are executed (see steps 2109 and 2110). After that, CPU12 has a storage location for the new CP array.
  • the value (node identifier) of the position indicated by the same storage position number in the parent node identification array is stored at the position indicated by the value of the storage address array at the position indicated by the number (step 2111).
  • the processing in step 2111 also actually initializes the processing target position, acquires the storage address and parent node identifier for each processing target position, and stores the parent node identifier in the new CP array. Just go. If the value in the storage address array is invalid, storing the value in the new CP array is omitted.
  • 24A and B are examples of the storage address array obtained by the processes of FIGS. 22A to 22D and the parent node identifier array obtained by the processes of FIGS. 23A to 23D, respectively.
  • the value of storage position number “0” is “0” in the storage address array, it is the same in the parent node identifier array at the position indicated by the value “0” of the storage address array in the new CP array.
  • the storage position number “0” position value “1” is stored.
  • the value of the storage location number “1” in the storage address array is “1”, the same value in the parent node array at the position indicated by the storage address array value “1” in the new CP array.
  • step 2111 corresponds to obtaining a new CP array by synthesizing the storage address array and the parent node identifier array by omitting invalid values in the storage address array.
  • FIG. 25A is a diagram visually showing an example of the same tree-type data structure as FIG. 15. From this tree, the partial tree having the node with the node identifier “2” as a vertex node is deleted. It is shown that. Based on the CP array shown in Fig. 24C, a tree-type data structure can be visually represented as shown in Fig. 25B. Referring to FIG. 25B, the node with node identifier “2” and its descendant node with node identifier “6” have been deleted, indicating that the tree deletion according to this embodiment has been completed. Has been.
  • Tree insertion which is an operation for editing the topology of the tree-type data structure, will be described.
  • “Tree insertion” allows a certain node to be routed to a specific node of the tree.
  • G means adding another tree that is a node (ie, adding the root node and its top node and its descendants).
  • the former tree is referred to as an insertion-side tree, and the latter is referred to as an insertion-side tree.
  • it is inserted from the CP array stored in the memory that represents the tree-type data structure on the insertion side and the CP array stored in the memory that represents the tree-type data structure on the insertion side.
  • a C—P array is created in memory, with the node identifier of each node attached according to the breadth-first mode. Note that the inserted tree and the Z or the insertion tree may be composed of only a single node.
  • a tree-type data structure is represented in the width priority mode, and a CP array storing the node identifiers of the nodes constituting the tree is stored in the memory according to the width priority mode.
  • FIG. 26A is a diagram visually showing an example of a tree-type data structure expressed in the breadth-first mode that is useful in the present embodiment.
  • the tree-type data structure 2600 is the insertion-side tree, and the node identifier “0” is inserted between the node with the node identifier “1” and the node with the node identifier “2” in the insertion-side tree.
  • the node root 'node: see 2601
  • the top node see 2610.
  • the node with the node identifier “0” in the insertion side tree is linked as a child node of the node with the node identifier “0” in the insertion side tree.
  • the node with the node identifier “0” and the node with the node identifier “2” in the inserted tree are already connected to the node with the node identifier “0” in the inserted tree as child nodes.
  • the node with the node identifier “0” in the insertion-side tree is lower than the node with the node identifier “1” in the insertion-side tree, and is higher than the node with the node identifier “2”. It is linked as a child node of the node with node identifier “0” of the tree.
  • Fig. 26B shows the tree 2600 and the tree 2610 in the C-P arrangement, respectively.
  • each tree is given a number (node identifier) in accordance with the breadth-first mode, and the information is stored in the memory as an array.
  • the operator operates the input device 24 and refers to the tree-type data structure displayed on the screen of the display device 26 as shown in FIG. 26A.
  • the tree insertion position (see reference numeral 2602) can be specified. By specifying the operator, it is possible to find the insertion position of the C—P sequence for the tree 2610 in the C—P sequence for the tree 2600 (see reference numeral 2621).
  • FIG. 27 is a flowchart showing an outline of tree insertion that works according to the present embodiment.
  • the operator operates the input device 24 to predetermine the positions where the C-P array of the inserted tree, the CP array of the inserted tree, and the vertex node of the inserted tree should be inserted. .
  • the position where the vertex node of the insertion tree should be inserted is, for example, which node's child is! /, Information (node identifier of the inserted tree that is the parent node of the vertex node of the insertion tree) ), And information indicating the number of children of the parent node of the vertex node of the inserting tree can be specified. Therefore, the CPU 12 may acquire these information according to the operator's input and store it temporarily in the memory.
  • FIG. 28 is a flowchart showing the insertion mark array generation process in more detail.
  • the CPU 12 first allocates an area of the insertion mark array having the same size as the C—P array of the inserted tree in the memory (step 2801), and sets an initial value “ “0” is stored (step 2802).
  • the CPU 12 initializes the processing target position to “0” (step 2803), and determines whether or not the value of the processing target position is the same as the node identifier immediately after the insertion position (step 2804).
  • step 2804 the CPU 12 refers to the value of the processing target position in the CP array of the insertion side tree, that is, the node identifier of the parent node, and inserts into the insertion mark array. Then, it is determined whether or not the element at the position indicated by the node identifier of the parent node is marked (that is, whether or not the value is “1”) (step 2805).
  • step 2804 If it is determined as Yes in step 2804, or if it is determined as Yes in step 2805, the CPU 12 sets the value of the processing target position in the insertion mark array. Set to “1” (step 2806). The CPU 12 executes such processing for all the node identifiers of the inserted-side tree (see steps 2807 and 2808).
  • FIG. 29 is a diagram showing an example of the CP array of the insertion-side tree and the generated insertion mark array (referred to as rinsert MarkJ in the figure).
  • the insertion side On the other hand, it is considered that the insertion side tree is inserted between the node having the node identifier “1” and the node having the node identifier “2”.
  • the processing target position is “0” or “1”
  • “No” is determined in Step 2804 and Step 2805.
  • step 2804 When the processing target position is “3” or “4”, it is determined NO (N 0) in step 2804 and step 2805.
  • the processing target position When the processing target position is “5”, it can be seen that the value of the corresponding storage position number “5” in the CP array is “2” and the node identifier power “2” of the parent node. Since the CPU 12 has the value “1” of the storage position number “2” in the insertion mark array, it is determined as YES in Step 2805. Therefore, the value of the storage position number “5” is set to “1” in the insertion mark array (see reference numeral 2902). A similar insertion mark array can be obtained by executing the same processing for the processing target positions “6” to “9”.
  • the CPU 12 generates a level array in the memory for storing a level value indicating the depth of each node constituting the tree in each of the inserted-side tree and the inserted-side tree (step 2702). Nodes of the same generation have the same level value. For example, in the inserted tree, the CPU 12 stores the level value “0” in the level array for the first node (root ′ node) of the C—P array. For other nodes, the CPU 12 refers to the CP array to identify the parent node, refers to the level value of the parent node, adds “1” to the level value, and sets the level of that node. Calculate the value. Next, the CPU 12 stores the calculated level value at the corresponding position in the level array.
  • the CPU 12 executes the same processing and stores a value in the level array.
  • the CPU 12 temporarily inserts the node of the inserted tree, which is the parent node of the vertex node of the inserting tree, out of the information temporarily stored in the memory indicating the position where the top node of the inserting tree is to be inserted.
  • the level array value corresponding to the node identifier (referred to as the parent node level value) is obtained by referring to the node identifier.
  • the CPU 12 adds “the level value of the parent node + 1” to each value of the level array of the insertion side tree.
  • Level array power that stores the level value after addition Level array of the insertion side tree It becomes.
  • FIG. 30A is a view for explaining the level array of the inserted-side tree.
  • the level array is described as “Levels”. For the first node (the root node of node identifier “0”), “0” is stored as the level value in the level array. For the subsequent two nodes (node identifiers “1” and “2”), the node identifier of the parent node is “0”, so the value “1” that is “0” plus “1” Stored in the level array as level values.
  • FIG. 30B is a diagram for explaining the level array of the insertion-side tree.
  • the array indicated by reference numeral 3010 is an array in which processing similar to that of the inserted tree is executed.
  • CPU12 generates a new node identifier array for each tree by referring to the CP array, level array and insertion mark array of the inserted tree, and the CP array and level array of the inserted tree. (Step 2703).
  • FIG. 31 and FIG. 32 are flowcharts showing the generation of a new node identifier in more detail. As shown in FIG. 31, the CPU 12 secures a new node identifier array area in the memory having the same size as each CP array for both the insertion side tree and the insertion side tree (step 3101).
  • the CPU 12 secures the current node identifier area (indicated as “Current Node No.” in the figure) in the memory, stores the initial value “0” (step 3102), and inserts the insertion side tree. Then, both processing target positions of the insertion side tree are initialized to “0” (step 3103).
  • the CPU 12 refers to the value of the processing target position on the insertion side in the insertion mark array (step 3104), and the value of the previous processing target position is "0" and the value of the current processing target position " Whether or not “l” is determined (step 3105).
  • the value of the insertion mark array is “1”
  • “Yes” is determined in step 3105.
  • the value of the current node identifier area is stored as the value of the insertion target processing position in the new node identifier array on the insertion side (step 3106).
  • step 3105 the processing target moves to the insertion side tree.
  • the level of the insertion-side tree at this insertion-side processing target position The level value in the array is the same as the level value in the level array of the inserted tree at the insertion target processing position.
  • the CPU 12 stores the value of the current node identifier area as the value of the insertion side processing target position (step 3201). .
  • the CPU 12 increments the value of the current node identifier area and also increments the insertion-side processing target position (step 3202).
  • the CPU 12 refers to the value of the level array for the new insertion-side processing target position, and determines whether the level array value has changed (step 3203). If the value in the level array at the insertion-side processing target position before incrementing matches the value in the level array at the insertion-side processing target position after incrementing, it is determined No in step 3203, and Returning to step 3201, processing proceeds. On the other hand, if “Yes” is determined in Step 3203, the process proceeds to Step 3106.
  • step 3107 When the processing is completed in the inserted-side tree and the inserted-side tree, that is, when the storage into the new node identifier array is completed, it is determined as Yes in step 3107. The In other cases, the CPU 12 increments the value of the current node identifier area and increments the processing target position on the insertion side (step 3108).
  • FIG. 33 shows a state in which the area of the new node identifier array and the current node identifier area storing the initial value “0” are secured in the memory.
  • the processing target position is “0” for both the inserted tree and the inserted tree.
  • step 3105 when the processing target position on the insertion side is “2”, the value of that position is “1” in the insertion mark array, and the insertion mark array of FIG. The value has changed from “0”. Therefore, it is judged as Yes in step 3105. Therefore, the processing moves to the insertion side tree, and the value “2” of the current node identifier area is stored as the storage position number “0” in the new node identifier array on the insertion side. Thereafter, the value S of the current node identifier area is incremented to “3”, and the processing target position on the insertion side is incremented to “1”.
  • the value of the processing target position “1” on the insertion side is “2”, which is not the same as the value “1” of the level array of the processing target position “0” before increment. Therefore, the process proceeds to step 3106 in FIG. 31, and the value “3” of the current node identifier area is stored as the value of the processing target position “2” on the insertion side in the new node identifier array. Thereafter, the value of the current node identifier area is incremented to “4” (see FIG. 35B).
  • a new node identifier storing a new node identifier by inserting a tree on each of the inserted side and the inserted side, as shown in FIG. 37B.
  • An array can be obtained.
  • the CPU 12 generates a CP array of the inserted-side tree and the inserted-side tree in the memory based on the new node identifier array! (Step 2704).
  • the same processing as that shown in FIG. 21 may be executed for each of the insertion-side tree and the insertion-side tree. Actually, it is not necessary to execute the storage address calculation process.
  • the CPU 12 calculates the node identifier of the parent node (steps 2106 to 2108 in FIG. 21), each of the inserted-side tree and the inserted-side tree of CP sequence can be determined.
  • each value of the parent node identifier array is associated with a value at the same storage position of the new node identifier array.
  • FIG. 38A is a diagram showing a state in which a new CP sequence is obtained on the insertion side
  • FIG. 38B is a diagram showing a status in which a new CP sequence is obtained on the insertion side. is there.
  • the CPU 12 executes the processing shown in steps 2106 to 2108 in FIG. 21 to obtain a new C—P array (see reference numeral 3801), and then the CPU 12 For the 'root' node (the node whose C—P array value is “1”), the node identifier (“0” in this example) of the node that becomes the parent node when inserted is stored (see reference numeral 3802).
  • the CPU 12 merges new CP arrays of the insertion-side tree and the insertion-side tree, and generates a CP array after insertion (step 2705).
  • a CP array after insertion As shown in Fig. 39, in the new C—P array (see reference numeral 3901) on the target side, there is no value in the part where the node identifier of the parent node of the insertion side tree should be placed. Even in the new CP array on the insertion side (see reference numeral 3902), there is no value for the part where the node identifier of the parent node of the tree on the insertion side should enter. Therefore, if an array is generated by mutually using portions that store non-invalid values, a CP array after insertion is obtained (see reference numeral 3910).
  • FIG. 40A is a diagram showing an inserted-side tree before insertion-side tree insertion.
  • the topology as shown in FIG. 40B is typically obtained by inserting the insertion side tree into the tree in FIG. 40A. Needless to say, this is in accordance with the width priority mode described above.
  • each node constituting one tree is associated with a node type and a node value.
  • the node type is not essential, but exists to indicate the meaning of the value of the node (for example, in FIG. 2B, the value “French store” indicates “Store name”).
  • FIG. 41A is a diagram schematically illustrating the insertion-side tree exemplified in FIG. 26A and the like.
  • Figure 4B shows an example of a CP array stored in memory representing the inserted tree, and a node value storage array stored in memory associated with each node identifier.
  • FIG. 41B in this example, only the node value “part name” (indicated as “PARTS—NAME” in the figure) is stored in the node, and the node type is not provided.
  • the node value is described together with the node identifier.
  • the example tree shows the parts of a model airplane (TOY PLANE), and each node represents the part name.
  • TOY PLANE model airplane
  • FIG. 42A is a diagram schematically showing the insertion-side tree exemplified in FIG. 26A and the like.
  • FIG. 42B is a diagram showing an example of a C—P array stored in the memory representing the insertion-side tree and a storage array of node values stored in the memory associated with each node identifier. It is. Also in FIG. 42A, the node value is described together with the node identifier.
  • a new CP array is generated by the tree insertion process in the present embodiment.
  • the CPU 12 refers to the inserted-side and inserted-side new node identifier arrays shown in FIGS. 38A and 38B, respectively, so that the node identifier of the inserted-side tree is newly determined in the tree structure after insertion. It is possible to grasp what kind of node identifier is newly given in the tree structure after the insertion of the node identifier given by the node identifier or the node identifier of the insertion side tree. Therefore, the CPU 12 generates a storage array that stores the node value associated with the new node identifier together with the generation of a new CP array.
  • FIG. 43A is a diagram schematically showing the tree after insertion
  • FIG. 43B is a diagram showing a new CP array stored in the memory and a storage array of new node values stored in the memory. .
  • the CPU 12 when generating a new node value storage array, specifies the insertion position of the node value storage array of the insertion-side tree, and inserts the insertion position into the insertion side. A value to be inserted in the storage array of the node values of the tree may be inserted. Alternatively, the CPU 12 newly reserves an area for storing the node value in the memory, and at the position corresponding to the new node identifier, the value of the node value storing array of the inserted side tree or A process of storing one of the values in the storage array of the same node value may be executed. [0146] Similarly, when deleting a partial tree, the CPU 12 refers to the new node identifier array (see Fig.
  • the new node identifier can be known. Therefore, the CPU 12 can delete the deletion position value from the node value storage array. Alternatively, the CPU 12 may newly execute a process of allocating an area for the storage array in the memory and storing the value of the original storage array at the position corresponding to the new node identifier. .
  • FIG. 44 is a functional block diagram of an information processing apparatus that constructs a tree-type data structure useful for the embodiment of the present invention.
  • the information processing apparatus 4400 generates a storage unit 4401 for storing data representing a tree-type data structure and the same P array for representing the tree-type data structure according to the present embodiment.
  • a tree definition unit 4402, a tree insertion processing unit 4403, and a tree deletion processing unit 4404 stored in the storage device.
  • the tree insertion processing unit 4403 is used to identify the insertion-side tree and the insertion-side tree input by the operator operating the input device (not shown in Fig. 44), and information specifying the insertion position. Based on this, the CP array of the processing target tree is read from the storage unit 4401, a C—P array representing the tree-type data structure after insertion is generated, and the C—P array is stored in the storage unit 4401. To do. Also, the tree insertion processing unit 4403 updates the node value storage array in accordance with the insertion of the tree, or generates a new storage array in accordance with the insertion of the tree.
  • the tree deletion processing unit 4404 Based on the node identifier of the vertex node of the partial tree to be deleted, which is input by the operator operating the input device, the tree deletion processing unit 4404 receives the CP array of the tree to be processed from the storage unit 4401. And the like, and a C—P array expressing the tree-type data structure after the partial tree is deleted is generated, and the C—P array is stored in the storage unit 4401. Further, the tree deletion processing unit 4404 updates the node value storage array according to the deletion of the partial tree, or generates a new storage array according to the deletion of the partial tree.
  • the unique node identifier assigned to a node is a continuous integer assigned with priority given to a node of the same generation over a child node.
  • the insertion side 1 In each of the insertion side trees, the parent-child relationship between nodes is the node identifier assigned to each parent node of the non-root 'node associated with the order of the node identifier assigned to each of the non-root' nodes. Powerful sequence C—P sequence).
  • the tree definition unit 4402 reads the tree data given in XML format stored in the storage unit 4401 or other storage device, and assigns node identifiers to the nodes constituting the tree.
  • a CP array storing the node identifier of the parent node of the node is stored in the storage unit 4401.
  • the tree definition unit 4402 generates a storage array that stores the actual data (node type and node value) associated with each node in the tree data given in XML format in association with the node identifier. And this is memorize
  • tree deletion is applied to a configuration that represents a tree-type data structure in accordance with a breadth-first mode that prioritizes nodes of the same generation over child nodes.
  • a new C—P array according to the width priority mode after the partial tree deletion is generated from the parent-child relationship definition array (C—P array) related to the node identifier assigned to each of the nodes based on the width priority mode.
  • C—P array parent-child relationship definition array
  • the tree deletion according to the present invention is also applicable to a configuration in which a tree-type data structure is expressed according to a depth priority mode in which child nodes are given priority over nodes of the same generation.
  • FIG. 45 is a diagram showing an example of a tree-type data structure represented in the depth priority mode. This is the same as the topology of the tree-type data structure shown in FIG. In the following, let us consider a case where a partial tree having the node indicated by reference numeral 4501 as a vertex node in the tree-type data structure of FIG. 45 is deleted.
  • FIG. 46 shows an array (CP array) representing a parent-child relationship of the tree-type data structure shown in FIG. 45, a delete flag array storing initial values, a new node identifier array, and initial values.
  • FIG. 6 is a diagram showing a current node identifier area. This corresponds to Figure 17 in breadth-first mode.
  • step 1602 in FIG. 16 is executed. It is the one at the time.
  • FIG. 47 is a diagram for explaining the tree deletion processing in the depth priority mode.
  • FIG. 48A and 48B show the storage address array and the parent node identifier array when the processing of FIG. 21 is executed, respectively, and FIG. 48C is obtained by executing Step 2111 of FIG. It is a figure which shows the new CP arrangement according to the depth priority mode after partial tree deletion.
  • the topology of the tree-type data structure based on this CP array is shown in Figure 49B. Compared to FIG. 49A showing the tree-type data structure before the partial tree deletion, it can be seen that the partial tree having the node indicated by reference numeral 4501 as the vertex node is deleted.
  • the node identifier of the parent node is smaller than the node identifier of the child node.
  • the single deletion method according to the present invention can be achieved. Can be applied.
  • FIG. 1 is a block diagram showing a hardware configuration of an information processing apparatus that handles a tree-type data structure that is useful for an embodiment of the present invention.
  • FIGS. 2A and 2B are explanatory diagrams of POS data, which is an example of tree-type data.
  • FIG. 2A is a visual representation of the data structure (ie, topology) and data values of this tree-type data.
  • Figure 2B shows an example of the same tree type data expressed in XML format.
  • FIGS. 3A to 3C are explanatory diagrams of an example of an expression format of a tree-type data structure using an arc list.
  • 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.
  • FIG. 5 is a flowchart of a method for building 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 ID-format tree structure type data into integer serial number format tree structure-type data according to the 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 a node definition process based on depth priority, which is effective in the 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 in the 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 a node definition process based on breadth priority, which is useful in the embodiment of the present invention.
  • FIG. 12 is an explanatory diagram of an array of parent-child relationships based on the “child ⁇ parent” expression created in the embodiment of the present invention.
  • FIG. 13 is an explanatory diagram of an array of parent-child relationships based on a “parent ⁇ child” expression created from the depth-first tree-type data structure shown in FIG. 7C.
  • FIG. 14 is a diagram showing the relationship of mutual conversion of three expression formats according to the embodiment of the present invention.
  • FIG. 15 is a diagram schematically illustrating an example of a tree-type data structure represented in a breadth-first mode that is useful for the present embodiment.
  • FIG. 16 is a flowchart showing the first half of the tree deletion process (tree deletion process (1)), which is useful in the present embodiment.
  • FIG. 17 shows an array representing the parent-child relationship of the tree-type data structure shown in FIG. 15, a delete flag array in which initial values are stored, a new node identifier array, and a current node identifier area in which initial values are arranged.
  • FIG. 17 shows an array representing the parent-child relationship of the tree-type data structure shown in FIG. 15, a delete flag array in which initial values are stored, a new node identifier array, and a current node identifier area in which initial values are arranged.
  • FIGS. 18A and 18B are views for explaining tree deletion processing that is useful in the present embodiment.
  • FIGS. 19A and 19B are diagrams for explaining tree deletion processing that is useful in the present embodiment.
  • FIG. 20 is a diagram for explaining tree deletion processing that is useful in the present embodiment.
  • FIG. 21 is a flowchart showing a process (tree deletion process (2)) for generating a CP array after deleting a tree.
  • FIGS. 22A to 22D are diagrams specifically illustrating the processing executed in step 2103 and step 2104.
  • FIGS. 23A to 23D are diagrams specifically illustrating the processing executed in steps 2106 to 2108.
  • FIGS. 24A and B are examples of storage address arrays obtained by the processes of FIGS. 22A to 22D and parent node identifier arrays obtained by the processes of FIGS. 23A to 23D, respectively. This is a new CP array obtained from! / Based on the stored address array and the parent node identifier array.
  • Figure 25A is a visual representation of the same tree-type data structure as in Figure 15, and Figure 25B is a visual representation of the tree-type data structure based on the CP array shown in Figure 24C.
  • FIG. 25A is a visual representation of the same tree-type data structure as in Figure 15, and Figure 25B is a visual representation of the tree-type data structure based on the CP array shown in Figure 24C.
  • FIG. 25A is a visual representation of the same tree-type data structure as in Figure 15, and Figure 25B is a visual representation of the tree-type data structure based on the CP array shown in Figure 24C.
  • FIG. 26A and FIG. 26B are diagrams showing examples of the inserted-side tree and the inserted-side tree according to the present embodiment.
  • FIG. 27 is a flowchart showing an outline of tree insertion according to the present embodiment.
  • FIG. 28 is a flowchart showing the insertion mark array generation process in more detail.
  • FIG. 29 is a diagram showing an example of a CP array of a tree to be inserted and an insertion mark array to be generated.
  • FIGS. 30A and 30B are diagrams illustrating level arrays of an inserted-side tree and an inserted-side tree, respectively.
  • FIG. 31 is a flowchart showing the generation of a new node identifier in more detail.
  • FIG. 32 is a flowchart showing the generation of a new node identifier in more detail.
  • FIG. 33 is a diagram specifically explaining generation of a new node identifier.
  • FIGS. 34A and 34B are diagrams specifically explaining generation of a new node identifier.
  • FIG. 35A and FIG. 35B are diagrams for specifically explaining the generation of a new node identifier.
  • FIG. 36A and FIG. 36B are diagrams for specifically explaining the generation of a new node identifier.
  • FIGS. 37A and 37B are diagrams specifically illustrating generation of a new node identifier.
  • FIG. 38A is a diagram showing a state in which a new C—P sequence is obtained on the insertion side
  • FIG. 38B is a diagram in which a new C—P sequence is obtained on the insertion side!
  • FIG. 39 is a diagram showing a CP sequence after insertion of an insertion side tree.
  • FIG. 40A is a diagram visually showing the inserted-side tree before inserting the inserting-side tree.
  • B is a diagram visually representing the tree after insertion of the insertion side tree.
  • FIG. 41A is a diagram schematically showing the inserted-side tree
  • FIG. 41B is a diagram showing the CP array stored in the memory, which represents the inserted-side tree, and each node identifier. It is a figure which shows the example of the storage array of the node value linked
  • FIG. 42A is a diagram schematically showing an insertion side tree.
  • FIG. 42B shows an example of the CP array stored in the memory representing the insertion side and the node value storage array stored in the memory in association with each node identifier.
  • FIG. 42A is a diagram schematically showing an insertion side tree.
  • FIG. 42B shows an example of the CP array stored in the memory representing the insertion side and the node value storage array stored in the memory in association with each node identifier.
  • FIG. 42A is a diagram schematically showing an insertion side tree.
  • FIG. 42B shows an example of the CP array stored in the memory representing the insertion side and the node value storage array stored in the memory in association with each node identifier.
  • FIG. 43A is a diagram schematically showing the tree after insertion
  • FIG. 43B is a diagram showing a new CP array stored in the memory and a storage array of new node values stored in the memory. It is.
  • FIG. 44 is a functional block diagram of an information processing apparatus for constructing a tree-type data structure useful for the embodiment of the present invention.
  • FIG. 45 is a diagram showing an example of a tree-type data structure represented in a depth priority mode that is useful in the present embodiment.
  • FIG. 46 shows an array representing the parent-child relationship of the tree-type data structure shown in FIG. 45, a delete flag array in which initial values are stored, a new node identifier array, and a current node identifier area in which initial values are arranged.
  • FIG. 47 is a diagram for explaining the tree deletion processing in the depth priority mode.
  • FIGS. 48A and 48B are examples of storage address arrays obtained by the processes of FIGS. 22A to 22D and parent node identifier arrays obtained by the processes of FIGS. 23A to 23D, respectively.
  • FIG. 10 is a diagram showing a CP array after partial tree deletion.
  • FIGS. 49A and 49B are diagrams for explaining tree deletion processing in the depth priority mode.

Landscapes

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

Abstract

 効率的にツリーから、部分ツリーを削除し、また、あるツリーに他のツリーを挿入する。消去フラグ配列中、削除対象となる部分ツリーを構成するノードのノード識別子について、フラグをセットし、消去フラグ配列の値を参照して、部分ツリー削除後のツリーについて、それぞれのノードに、子ノードよりも同じ世代のノードを優先して付与された連続する整数であるノード識別子を付与し、付与された新たなノード識別子を、削除前のツリーのノードのノード識別子と関連付けて格納した新規ノード識別子配列を、記憶装置に生成し、かつ、親子関係定義配列および新規ノード識別子配列に基づいて、新たなノード識別子に関連付けて、当該ノード識別子をもつノードの親ノードのノード識別子を格納した、部分ツリー削除後のツリーの親子関係定義配列を、前記記憶装置に生成する。

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データのメリットを十分 に活用すると共に、タグを用いて表現された各項目の関係構造をそのまま記憶できる ようにしている。
[0010] また、 XML文書をツリー構造でメモリ上に展開するための DOMと呼ばれるォブジ エタトモデルのインタフェースが公開されている(例えば、非特許文献 3を参照。)。 特許文献 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 (Third Edition)"ゝ [onl ine]、 2004年 2月 4日、 [平成 16年 2月 19日検索]、インターネットく URL:http:〃 ww w.w3.org/TR/2004/REC-xml-20040204/>
非特許文献 3 :R. ァラン ヮイク、ブラッド ルーペン、サルタン ルーマン、「プログ ラミング XML」、 日経 DPソフトプレス、 2002年、第 59頁一第 84頁
発明の開示
発明が解決しょうとする課題
[0011] しかし、上記の検索用インデックスデータを別途保持するようなアプローチでは、少 なくともデータは二重に保持され、かつ、インデックスを作成するコスト及びインデック スを格納するためのデータ領域が必要となり、大規模なデータを保持する上で不利 である。
[0012] このようなメカニズムによって、実際に検索を行い、ノードを特定したとしても、そのノ ードを表現するためには時間がかかる。また、このメカニズムは、ノード間の関係を問 題とする検索 (例えば、祖先に「60歳」 、う「年齢」を含み、子孫に「1歳」 、う「年齢 」を含むツリーの抽出)には利用できない。
[0013] このような従来技術の根本的な問題点は、個々のデータのみに着目し、データを蓄 えたノード間をポインタで接続することによりツリー型データ構造が表現されているた め、データ間の関係、例えば、親子、祖先、子孫、兄弟 (シブリング)、世代などの関 係を効率的にトレースすることができないことにある。換言すると、ポインタは、その値 が一定しないため、データの格納アドレスを示すという用途にし力使用できず、ノード 間の関係を直接的に表現することができない。その結果として、従来技術では、ッリ 一型データ構造のトポロジーを編集すること、特に、ツリー構造型データのあるノード に子孫ノードを挿入することが困難であった。また、上記の DOMは、ツリー型データ 構造のトポロジーを編集する操作のインタフェースを規定するだけであり、操作の具 体的手法を規定するものではな 、。
[0014] そこで、本発明は、効率的にツリーから、当該ツリーの一部分である部分ツリーを削 除し、また、あるツリーに他のツリーを挿入する方法、情報処理装置、および、プログ ラムを提供することを目的とする。
課題を解決するための手段
[0015] 上記目的を達成するため、本発明は、ツリー型データ構造を構成するノード間の親 子関係を、親ノードに子ノードを対応付ける「親→子」関係ではなぐ子ノードに親ノ ードを対応付ける「子→親」関係によって表現した親子関係定義配列を用いて、挿入 や削除を実現する。
[0016] 従来力 知られている「親→子」関係によって親子関係を表現する場合、一つの親 ノードに複数の子ノードが対応する場合があるので、親ノードと子ノードの二つの要 素を特定しなければ親子関係を定義できない。即ち、親ノードを特定しても、その親 ノードと親子関係にある子ノードを特定することができない。これに対して、本発明の ように「子→親」関係によって親子関係を表現する場合、一つの子ノードには必ず唯 一の親ノードが対応するので、子ノードを特定することによって、この子ノードに対応 する唯一の親ノードを直ちに特定することができる。
[0017] より詳細には、本発明の目的は、ツリー型データ構造を表すために、ルート'ノード を含むノードに付与されたノード識別子であって、親子関係にあるノードについて、 親ノードのノード識別子は、子ノードのノード識別子より小さ ヽと ヽぅ関係を満たす、 連続する整数であるノード識別子を用いて、前記ルート'ノード以外のノードである非 ルート'ノードの各々に付与されたノード識別子に関連付けて、前記非ルート'ノード の各々の親ノードに付与されたノード識別子を格納した、記憶装置中に生成された 親子関係定義配列を備えた情報処理装置にお!、て、
あるツリーから、特定のノードである頂点ノードおよびその子孫ノードからなる部分ッ リーを削除し、かつ、当該部分ツリー削除後のツリーのツリー型データ構造について 、前記記憶装置中に親子関係定義配列を生成する情報処理方法であって、 前記部分ツリーを削除すべきツリーの親子関係定義配列を、前記記憶装置から読 み出すステップと、
前記部分ツリーにおいて最もルート'ノードに近い位置にある頂点ノードのノード識 別子、および、前記親子関係定義配列を参照して、記憶装置に生成された、前記親 子関係定義配列と同一サイズの消去フラグ配列中、前記部分ツリーを構成するノード のノード識別子について、当該フラグをセットするステップと、
前記消去フラグ配列を参照して、前記部分ツリーの削除後のツリーについて、それ ぞれのノードに、親子関係にあるノードについて、親ノードのノード識別子は、子ノー ドのノード識別子より小さ 、と 、う関係を満たす連続する整数であるノード識別子を付 与し、付与された新たなノード識別子を、削除前のツリーのノードのノード識別子と関 連付けて格納した新規ノード識別子配列を、記憶装置に生成するステップと、 前記親子関係定義配列および前記新規ノード識別子配列に基づいて、前記新た なノード識別子に関連付けて、当該ノード識別子をもつノードの親ノードのノード識別 子を格納した、部分ツリー削除後の親子関係定義配列を、前記記憶装置に生成する ステップと、
を備えたことを特徴とする情報処理方法により達成される。
[0018] 好ましい実施態様においては、前記ノード識別子が、子ノードよりも同じ世代のノー ドを優先して付与された連続する整数であり、前記ルート'ノード以外のノードである 非ルート'ノードの各々に付与されたノード識別子に関連付けて、前記非ルート'ノー ドの各々の親ノードに付与されたノード識別子を格納した親子関係定義配列が、前 記記憶装置中に記憶され、
前記新規ノード識別子配列を生成するステップが、前記それぞれのノードに、子ノ ードより同じ世代のノードを優先して付与された連続する整数であるノード識別子を 付与するステップを含む。
[0019] 或いは、前記ノード識別子が、同じ世代のノードよりも子ノードを優先して付与され た連続する整数であり、前記ルート'ノード以外のノードである非ルート'ノードの各々 に付与されたノード識別子に関連付けて、前記非ルート'ノードの各々の親ノードに 付与されたノード識別子を格納した親子関係定義配列が、前記記憶装置中に記憶さ れ、
前記新規ノード識別子配列を生成するステップが、前記それぞれのノードに、同じ 世代のノードより子ノードを優先して付与された整数であるノード識別子を付与するス テツプを含んで!/ゝてもよ ヽ。
[0020] また、好ましい実施態様においては、前記記憶装置に、前記ツリーのノードのノード 識別子の各々に関連付けて、当該ノードの少なくともノード値を格納したノード値格 納配列が記憶され、
前記新規ノード識別子配列を参照して、もとのノード識別子と新たなノード識別子と の関連付けにしたがって、前記ノード値格納配列を更新するステップを備えて 、る。
[0021] 他の好ましい実施態様においては、前記記憶装置に、前記ツリーのノードのノード 識別子の各々に関連付けて、当該ノードの少なくともノード値を格納したノード値格 納配列が記憶され、
前記新規ノード識別子配列を参照して、もとのノード識別子と新たなノード識別子と の関連付けにしたがって、新たなノード識別子の各々と関連付けて、前記ノード値を 格納した、新たなノード値格納配列を生成するステップを備えて 、る。
[0022] より好ましい実施態様においては、前記新規ノード識別子配列を生成するステップ が、
前記親子関係定義配列と同一のサイズの新規ノード識別子配列のための領域を、 前記記憶装置中に確保するステップと、
新たなノード識別子を一時的に記憶するカレントノード識別子領域を、前記記憶装 置中に確保して、その初期値を格納するステップと、
前記消去フラグ配列を参照して、前記消去フラグ配列の値がセットされて 、な 、場 合には、当該新規ノード識別子配列の値として、前記カレントノード識別子領域の値 を格納し、その後、前記カレントノード識別子領域の値を増分し、その一方、消去フラ グ配列の値がセットされて 、る場合には、当該新規ノード識別子配列の値として無効 値を格納するステップと、を備えている。
[0023] 別の好ましい実施態様においては、前記部分ツリー削除後の親子関係定義配列を 生成するステップが、
前記親子関係定義配列と同一サイズの格納アドレス配列のための領域を、前記記 憶装置中に確保するステップと、
前記新規ノード識別子配列中、前記親子関係定義配列の値の格納位置と同じ位 置の値を参照して、値が無効値である場合を除き、前記格納アドレス配列に、前記新 規ノード識別子配列中の値を格納するステップと、 前記親子関係定義配列と同一サイズの親ノード識別子配列のための領域を、前記 記憶装置中に確保するステップと、
前記新規ノード識別子配列中、前記親子関係定義配列の値が示す位置の値を参 照して、前記親ノード識別子配列中、前記親子関係定義配列の値の位置と同じ位置 に、前記新規ノード識別子配列の値を格納するステップと、
前記格納アドレス配列中の値に関連付けて、前記親ノード識別子配列の値を格納 した親子関係定義配列を生成するステップと、を含む。
また、本発明の目的は、ツリー型データ構造を表すために、ルート'ノードを含むノ ードに付与された固有のノード識別子であって、子ノードよりも同じ世代のノードを優 先して付与された連続する整数であるノード識別子を用いて、前記ルート ·ノード以 外のノードである非ルート'ノードの各々に付与されたノード識別子に関連付けて、前 記非ルート'ノードの各々の親ノードに付与されたノード識別子を格納した、記憶装 置中に生成された親子関係定義配列を備えた情報処理装置において、
あるツリーを被挿入側ツリーとして、当該被挿入側ツリーの特定のノードに、他のッリ 一である挿入側ツリーのルート'ノードを連結することにより、当該挿入側ツリーを追加 し、当該挿入後のツリーのツリー型データ構造について、前記記憶装置中に親子関 係定義配列を生成する情報処理方法であって、
被挿入側ツリーの第 1の親子関係定義配列、および、挿入側ツリーの第 2の親子関 係定義配列を記憶装置から読み出すステップと、
前記挿入側ツリーのルート'ノードを、被挿入側ツリーの部分ツリー中、最もルート' ノードに近い位置にある頂点ノードとして、当該頂点ノードが挿入される位置の情報 に基づいて、挿入側ツリーのそれぞれのノードに隣接する、被挿入側ツリーのノード を特定し、当該被挿入側ツリーのノードの情報を、前記記憶装置に記憶するステップ と、
前記被挿入側ツリーのノードの情報を参照して、前記挿入側ツリーの挿入後の前 記被挿入側ツリーについて、それぞれのノードに、子ノードよりも同じ世代のノードを 優先して付与された連続する整数であるノード識別子を付与し、付与された新たなノ ード識別子を、挿入前の被挿入側ツリーのノードのノード識別子と関連付けて格納し た第 1の新規ノード識別子配列を、前記記憶装置に生成するとともに、前記挿入側ッ リーの頂点ノードが挿入される位置の情報に基づいて、前記挿入側ツリーの挿入後 の前記挿入側ツリーについて、それぞれのノードに、子ノードよりも同じ世代のノード を優先して付与された連続する整数であるノード識別子を付与し、付与された新たな ノード識別子を、挿入前の挿入側ツリーのノードのノード識別子と関連付けて格納し た第 2の新規ノード識別子配列を、前記記憶装置に生成するステップと、
前記第 1および第 2の親子関係定義配列、および、前記第 1および第 2の新規ノー ド識別子配列に基づいて、前記新たなノード識別子に関連付けて、当該ノード識別 子をもつノードの親ノードのノード識別子を格納した、挿入後のツリーの親子関係定 義配列を、前記記憶装置に生成するステップと、
を備えたことを特徴とする情報処理方法により達成される。
[0025] 好ま 、実施態様にぉ 、ては、前記記憶装置に、前記被挿入側ツリーのノードのノ ード識別子の各々に関連付けて、当該ノードの少なくともノード値を格納した第 1のノ ード値格納配列が記憶され、前記挿入側ツリーのノードのノード識別子の各々に関 連付けて、当該ノードの少なくともノード値を格納した第 2のノード値格納配列が記憶 され、
前記第 1および第 2の新規ノード識別子配列を参照して、被挿入側ツリーおよび挿 入側ツリーのそれぞれのもとのノード識別子と、挿入後のツリーの新たなノード識別子 との関連付けにしたがって、前記第 1のノード値格納配列および第 2のノード配列の 少なくとも一方を更新するステップを備えて 、る。
[0026] 他の好ま ヽ実施態様にお ヽては、前記記憶装置に、前記被挿入側ツリーのノー ドのノード識別子の各々に関連付けて、当該ノードの少なくともノード値を格納した第 1のノード値格納配列が記憶され、前記挿入側ツリーのノードのノード識別子の各々 に関連付けて、当該ノードの少なくともノード値を格納した第 2のノード値格納配列が
SC fedれ、
前記第 1および第 2の新規ノード識別子配列を参照して、被挿入側ツリーおよび挿 入側ツリーのそれぞれのもとのノード識別子と、挿入後のツリーの新たなノード識別子 との関連付けにしたがって、新たなノード識別子の各々と関連付けて、前記ノード値 を格納した、新たなノード値格納配列を生成するステップを備えて 、る。
[0027] より好ま ヽ実施態様にぉ ヽては、前記被挿入側ツリーのノードの情報を、前記記 憶装置に記憶するステップが、
前記挿入側ツリーの頂点ノードが挿入される位置の情報に基づいて、前記第 1の親 子関係定義配列と同一のサイズの挿入マーク配列中、前記挿入される位置の直後 のノードおよび前記直後のノードを先祖とするノードにっ 、て、当該挿入位置である ことを示す値を格納するステップを含む。
[0028] また、別の好ま 、実施態様にぉ 、ては、さらに、前記被挿入側ツリーの各ノードの 、当該被挿入側ツリーの頂点ノードからの深さのレベルを表すレベル値を格納した第 1のレベル配列を、前記記憶装置に生成するステップと、
前記第 1のレベル配列中、前記挿入側ツリーの頂点ノードの挿入位置に相当する レベル値を参照して、前記挿入側ツリーの各ノードの、前記被挿入側ツリーの頂点ノ ードからの深さのレベルを表すレベル値を格納した第 2のレベル配列を、前記記憶 装置に生成するステップと、を備え、
前記第 1および第 2の新規ノード識別子配列を生成するステップが、
前記第 1および第 2の親子関係定義配列と、それぞれ、同一のサイズの第 1および 第 2の新規ノード識別子配列のための領域を、前記記憶装置中に確保するステップ と、
新たなノード識別子を一時的に記憶するカレントノード識別子領域を、前記記憶装 置中に確保して、その初期値を格納するステップと、を含み、
前記挿入マーク配列中、その値が、挿入位置であることを示す値に変化している位 置以外の位置においては、
(a)前記第 1の新規ノード識別子配列中、当該位置の値として、前記カレントノード識 別子領域の値を格納し、
(b)その後、前記カレントノード識別子領域の値を増分する
ステップをさらに含み、
前記挿入マーク配列中、当該挿入マーク配列の値力 挿入位置であることを示す 値に変化する位置においては、 (a)前記第 1のレベル配列中、当該位置のレベル値を参照し、かつ、前記第 2のレべ ル配列中、同一のレベル値を有する範囲を特定し、
(b)前記第 2の新規ノード識別子配列中、当該範囲の先頭位置力 順次、カレントノ ード識別子領域の値を格納し、
(c)その後、前記カレントノード識別子領域の値を増分し、
(d)前記第 2の新規ノード識別子配列中、前記同一のレベル値を有する範囲への値 の格納が終了すると、第 1の新規ノード識別子配列の値として、前記カレントノード識 別子領域の値を格納し、
(e)その後、前記カレントノード識別子領域の値を増分する
ステップを、さらに含む。
また、より好ましい実施態様においては、前記ツリー挿入後の親子関係定義配列を 生成するステップが、
前記第 1の親子関係定義配列と同一サイズの、第 1の親ノード識別子配列のための 領域を、前記記憶装置中に確保するステップと、
前記第 1の新規ノード識別子配列中、前記第 1の親子関係定義配列の値が示す位 置の値を参照して、前記第 1の親ノード識別子配列中、前記親子関係定義配列の値 の位置と同じ位置に、前記第 1の新規ノード識別子配列の値を格納するステップと、 前記第 1の新規ノード識別子配列の値と、前記第 1の親ノード識別子配列の値とを 関連付けるステップと、
前記第 2の親子関係定義配列と同一サイズの、第 2の親ノード識別配列のための領 域を、前記記憶装置中に確保するステップと、
前記第 2の新規ノード識別子配列中、先頭の値として、前記挿入側ノードの頂点ノ 一ドの親ノードとなるノードのノード識別子を格納するともに、他の値として、前記第 2 の親子関係定義配列の値が示す位置の値を参照して、前記第 2の親ノード識別子 配列中、前記親子関係定義配列の値の位置と同じ位置に、前記第 2の新規ノード識 別子配列の値を格納するステップと、
前記第 2の新規ノード識別子配列の値と、前記第 2の親ノード識別子配列の値とを 関連付けるステップと、 前記第 1の新規ノード識別子配列の値および前記第 2の新規ノード識別子配列の 値のそれぞれに関連付けられた、前記第 1の親ノード識別子配列の値および第 2の 親ノード識別子配列の値を、挿入後の親子関係定義配列に格納するステップと、を 含む。
また、本発明の目的は、ツリー型データ構造を表すために、ルート'ノードを含むノ ードに付与されたノード識別子であって、親子関係にあるノードについて、親ノードの ノード識別子は、子ノードのノード識別子より小さいという関係を満たす、連続する整 数であるノード識別子を用いて、前記ルート ·ノード以外のノードである非ルート'ノー ドの各々に付与されたノード識別子に関連付けて、前記非ルート'ノードの各々の親 ノードに付与されたノード識別子を格納した、記憶装置中に生成された親子関係定 義配列を備え、あるツリーから、特定のノードである頂点ノードおよびその子孫ノード 力 なる部分ツリーを削除し、かつ、当該部分ツリー削除後のツリーのツリー型データ 構造につ 、て、前記記憶装置中に親子関係定義配列を生成するように構成された 情報処理装置において、
前記部分ツリーを削除すべきツリーの親子関係定義配列を、前記記憶装置から読 み出すデータ読み出し手段と、
前記部分ツリーにおいて最もルート'ノードに近い位置にある頂点ノードのノード識 別子、および、前記親子関係定義配列を参照して、記憶装置に生成された、前記親 子関係定義配列と同一サイズの消去フラグ配列中、前記部分ツリーを構成するノード のノード識別子について、当該フラグをセットする消去フラグ配列生成手段と、 前記消去フラグ配列を参照して、前記部分ツリーの削除後のツリーについて、それ ぞれのノードに、親子関係にあるノードについて、親ノードのノード識別子は、子ノー ドのノード識別子より小さ 、と 、う関係を満たす連続する整数であるノード識別子を付 与し、付与された新たなノード識別子を、削除前のツリーのノードのノード識別子と関 連付けて格納した新規ノード識別子配列を、記憶装置に生成する新規ノード識別子 配列生成手段と、
前記親子関係定義配列および前記新規ノード識別子配列に基づいて、前記新た なノード識別子に関連付けて、当該ノード識別子をもつノードの親ノードのノード識別 子を格納した、部分ツリー削除後の親子関係定義配列を、前記記憶装置に生成する 削除後親子関係配列生成手段と、
を備えたことを特徴とする情報処理装置により達成される。
[0031] 好ましい実施態様においては、前記ノード識別子が、子ノードよりも同じ世代のノー ドを優先して付与された連続する整数であり、前記ルート'ノード以外のノードである 非ルート'ノードの各々に付与されたノード識別子に関連付けて、前記非ルート'ノー ドの各々の親ノードに付与されたノード識別子を格納した親子関係定義配列が、前 記記憶装置中に記憶され、
前記新規ノード識別子生成手段が、前記それぞれのノードに、子ノードより同じ世 代のノードを優先して付与された連続する整数であるノード識別子を付与するように 構成されている。
[0032] 或いは、他の好ましい実施態様においては、前記ノード識別子が、同じ世代のノー ドよりも子ノードを優先して付与された連続する整数であり、前記ルート'ノード以外の ノードである非ルート'ノードの各々に付与されたノード識別子に関連付けて、前記非 ルート'ノードの各々の親ノードに付与されたノード識別子を格納した親子関係定義 配列が、前記記憶装置中に記憶され、
前記新規ノード生成手段が、前記それぞれのノードに、同じ世代のノードより子ノー ドを優先して付与された連続する整数であるノード識別子を付与するように構成され ている。
[0033] また、好ましい実施態様においては、前記記憶装置に、前記ツリーのノードのノード 識別子の各々に関連付けて、当該ノードの少なくともノード値を格納したノード値格 納配列が記憶され、
前記新規ノード識別子配列を参照して、もとのノード識別子と新たなノード識別子と の関連付けにしたがって、前記ノード値格納配列を更新するノード値格納配列更新 手段を備えている。
[0034] 他の好ましい実施態様においては、前記記憶装置に、前記ツリーのノードのノード 識別子の各々に関連付けて、当該ノードの少なくともノード値を格納したノード値格 納配列が記憶され、 前記新規ノード識別子配列を参照して、もとのノード識別子と新たなノード識別子と の関連付けにしたがって、新たなノード識別子の各々と関連付けて、前記ノード値を 格納した、新たなノード値格納配列を生成するノード値格納配列生成手段を備えて いる。
[0035] より好まし 、実施態様にぉ 、ては、前記新規ノード識別子配列生成手段が、
前記親子関係定義配列と同一のサイズの新規ノード識別子配列のための領域を、 前記記憶装置中に確保し、
新たなノード識別子を一時的に記憶するカレントノード識別子領域を、前記記憶装 置中に確保して、その初期値を格納し、
前記消去フラグ配列を参照して、前記消去フラグ配列の値がセットされて 、な 、場 合には、当該新規ノード識別子配列の値として、前記カレントノード識別子領域の値 を格納し、その後、前記カレントノード識別子領域の値を増分し、その一方、消去フラ グ配列の値がセットされて 、る場合には、当該新規ノード識別子配列の値として無効 値を格納するように構成されて 、る。
[0036] 別の好ましい実施態様においては、前記削除後親子関係定義配列生成手段が、 前記親子関係定義配列と同一サイズの格納アドレス配列のための領域を、前記記 憶装置中に確保し、
前記新規ノード識別子配列中、前記親子関係定義配列の値の格納位置と同じ位 置の値を参照して、値が無効値である場合を除き、前記格納アドレス配列に、前記新 規ノード識別子配列中の値を格納し、
前記親子関係定義配列と同一サイズの親ノード識別子配列のための領域を、前記 記憶装置中に確保し、
前記新規ノード識別子配列中、前記親子関係定義配列の値が示す位置の値を参 照して、前記親ノード識別子配列中、前記親子関係定義配列の値の位置と同じ位置 に、前記新規ノード識別子配列の値を格納し、
前記格納アドレス配列中の値に関連付けて、前記親ノード識別子配列の値を格納 した親子関係定義配列を生成するように構成されて 、る。
[0037] また、本発明の目的は、ツリー型データ構造を表すために、ルート'ノードを含むノ ードに付与された固有のノード識別子であって、子ノードよりも同じ世代のノードを優 先して付与された連続する整数であるノード識別子を用いて、前記ルート ·ノード以 外のノードである非ルート'ノードの各々に付与されたノード識別子に関連付けて、前 記非ルート'ノードの各々の親ノードに付与されたノード識別子を格納した、記憶装 置中に生成された親子関係定義配列を備えた情報処理装置であって、あるツリーを 被挿入側ツリーとして、当該被挿入側ツリーの特定のノードに、他のツリーである挿入 側ツリーのルート'ノードを連結することにより、当該挿入側ツリーを追加し、当該挿入 後のツリーのツリー型データ構造について、前記記憶装置中に親子関係定義配列を 生成するように構成された情報処理装置にお!、て、
被挿入側ツリーの第 1の親子関係定義配列、および、挿入側ツリーの第 2の親子関 係定義配列を記憶装置から読み出すデータ読み出し手段と、
前記挿入側ツリーのルート'ノードを、被挿入側ツリーの部分ツリー中、最もルート' ノードに近い位置にある頂点ノードとして、当該頂点ノードが挿入される位置の情報 に基づいて、挿入側ツリーのそれぞれのノードに隣接する、被挿入側ツリーのノード を特定し、当該被挿入側ツリーのノードの情報を、前記記憶装置に記憶する挿入位 置情報生成手段と、
前記被挿入側ツリーのノードの情報を参照して、前記挿入側ツリーの挿入後の前 記被挿入側ツリーについて、それぞれのノードに、子ノードよりも同じ世代のノードを 優先して付与された連続する整数であるノード識別子を付与し、付与された新たなノ ード識別子を、挿入前の被挿入側ツリーのノードのノード識別子と関連付けて格納し た第 1の新規ノード識別子配列を、前記記憶装置に生成するとともに、前記挿入側ッ リーの頂点ノードが挿入される位置の情報に基づいて、前記挿入側ツリーの挿入後 の前記挿入側ツリーについて、それぞれのノードに、子ノードよりも同じ世代のノード を優先して付与された連続する整数であるノード識別子を付与し、付与された新たな ノード識別子を、挿入前の挿入側ツリーのノードのノード識別子と関連付けて格納し た第 2の新規ノード識別子配列を、前記記憶装置に生成する新規ノード識別子配列 生成手段と、
前記第 1および第 2の親子関係定義配列、および、前記第 1および第 2の新規ノー ド識別子配列に基づいて、前記新たなノード識別子に関連付けて、当該ノード識別 子をもつノードの親ノードのノード識別子を格納した、挿入後のツリーの親子関係定 義配列を、前記記憶装置に生成する挿入後親子関係定義配列生成手段と、 を備えたことを特徴とする情報処理装置によっても達成される。
[0038] 好ま 、実施態様にぉ 、ては、前記記憶装置に、前記被挿入側ツリーのノードのノ ード識別子の各々に関連付けて、当該ノードの少なくともノード値を格納した第 1のノ ード値格納配列が記憶され、前記挿入側ツリーのノードのノード識別子の各々に関 連付けて、当該ノードの少なくともノード値を格納した第 2のノード値格納配列が記憶 され、
前記第 1および第 2の新規ノード識別子配列を参照して、被挿入側ツリーおよび挿 入側ツリーのそれぞれのもとのノード識別子と、挿入後のツリーの新たなノード識別子 との関連付けにしたがって、前記第 1のノード値格納配列および第 2のノード配列の 少なくとも一方を更新するノード値格納配列更新手段を備えている。
[0039] 他の好ま ヽ実施態様にお ヽては、前記記憶装置に、前記被挿入側ツリーのノー ドのノード識別子の各々に関連付けて、当該ノードの少なくともノード値を格納した第 1のノード値格納配列が記憶され、前記挿入側ツリーのノードのノード識別子の各々 に関連付けて、当該ノードの少なくともノード値を格納した第 2のノード値格納配列が
SC fedれ、
前記第 1および第 2の新規ノード識別子配列を参照して、被挿入側ツリーおよび挿 入側ツリーのそれぞれのもとのノード識別子と、挿入後のツリーの新たなノード識別子 との関連付けにしたがって、新たなノード識別子の各々と関連付けて、前記ノード値 を格納した、新たなノード値格納配列を生成するノード値格納配列生成手段を備え ている。
[0040] より好ま ヽ実施態様にお ヽては、前記挿入位置情報生成手段が、
前記挿入側ツリーの頂点ノードが挿入される位置の情報に基づいて、前記第 1の親 子関係定義配列と同一のサイズの挿入マーク配列中、前記挿入される位置の直後 のノードおよび前記直後のノードを先祖とするノードにっ 、て、当該挿入位置である ことを示す値を格納するように構成されて 、る。 また、別の好ましい実施態様においては、さらに、前記被挿入側ツリーの各ノードの 、当該被挿入側ツリーの頂点ノードからの深さのレベルを表すレベル値を格納した第
1のレベル配列を、前記記憶装置に生成する第 1のレベル配列生成手段と、 前記第 1のレベル配列中、前記挿入側ツリーの頂点ノードの挿入位置に相当する レベル値を参照して、前記挿入側ツリーの各ノードの、前記被挿入側ツリーの頂点ノ ードからの深さのレベルを表すレベル値を格納した第 2のレベル配列を、前記記憶 装置に生成する第 2のレベル配列生成手段と、を備え、
前記新規ノード識別子配列生成手段が、
前記第 1および第 2の親子関係定義配列と、それぞれ、同一のサイズの第 1および 第 2の新規ノード識別子配列のための領域を、前記記憶装置中に確保し、
新たなノード識別子を一時的に記憶するカレントノード識別子領域を、前記記憶装 置中に確保して、その初期値を格納するように構成され、
前記挿入マーク配列中、その値が、挿入位置であることを示す値に変化している位 置以外の位置においては、
(a)前記第 1の新規ノード識別子配列中、当該位置の値として、前記カレントノード識 別子領域の値を格納するとともに、
(b)その後、前記カレントノード識別子領域の値を増分するように構成され、 前記挿入マーク配列中、当該挿入マーク配列の値力 挿入位置であることを示す 値に変化する位置においては、
(a)前記第 1のレベル配列中、当該位置のレベル値を参照し、かつ、前記第 2のレべ ル配列中、同一のレベル値を有する範囲を特定し、
(b)前記第 2の新規ノード識別子配列中、当該範囲の先頭位置力 順次、カレントノ ード識別子領域の値を格納し、
(c)その後、前記カレントノード識別子領域の値を増分し、
(d)前記第 2の新規ノード識別子配列中、前記同一のレベル値を有する範囲への値 の格納が終了すると、第 1の新規ノード識別子配列の値として、前記カレントノード識 別子領域の値を格納し、
(e)その後、前記カレントノード識別子領域の値を増分するように構成されて!、る。 [0042] また、さらに別の好ましい実施態様においては、前記挿入後親子関係定義配列生 成手段が、
前記第 1の親子関係定義配列と同一サイズの、第 1の親ノード識別子配列のための 領域を、前記記憶装置中に確保し、
前記第 1の新規ノード識別子配列中、前記第 1の親子関係定義配列の値が示す位 置の値を参照して、前記第 1の親ノード識別子配列中、前記親子関係定義配列の値 の位置と同じ位置に、前記第 1の新規ノード識別子配列の値を格納し、
前記第 1の新規ノード識別子配列の値と、前記第 1の親ノード識別子配列の値とを 関連付け、
前記第 2の親子関係定義配列と同一サイズの、第 2の親ノード識別配列のための領 域を、前記記憶装置中に確保し、
前記第 2の新規ノード識別子配列中、先頭の値として、前記挿入側ノードの頂点ノ 一ドの親ノードとなるノードのノード識別子を格納するともに、他の値として、前記第 2 の親子関係定義配列の値が示す位置の値を参照して、前記第 2の親ノード識別子 配列中、前記親子関係定義配列の値の位置と同じ位置に、前記第 2の新規ノード識 別子配列の値を格納し、
前記第 2の新規ノード識別子配列の値と、前記第 2の親ノード識別子配列の値とを 関連付け、
前記第 1の新規ノード識別子配列の値および前記第 2の新規ノード識別子配列の 値のそれぞれに関連付けられた、前記第 1の親ノード識別子配列の値および第 2の 親ノード識別子配列の値を、挿入後の親子関係定義配列に格納するように構成され ている。
[0043] また、本発明の目的は、ツリー型データ構造を表すために、ルート'ノードを含むノ ードに付与されたノード識別子であって、親子関係にあるノードについて、親ノードの ノード識別子は、子ノードのノード識別子より小さいという関係を満たす、連続する整 数であるノード識別子を用いて、前記ルート ·ノード以外のノードである非ルート'ノー ドの各々に付与されたノード識別子に関連付けて、前記非ルート'ノードの各々の親 ノードに付与されたノード識別子を格納した、記憶装置中に生成された親子関係定 義配列を備えたコンピュータにおいて、
あるツリーから、特定のノードである頂点ノードおよびその子孫ノードからなる部分ッ リーを削除し、かつ、当該部分ツリー削除後のツリーのツリー型データ構造について 、前記記憶装置中に親子関係定義配列を生成するために、前記コンピュータにより 読み出し可能な情報処理プログラムであって、前記コンピュータに、
前記部分ツリーを削除すべきツリーの親子関係定義配列を、前記記憶装置から読 み出すステップと、
前記部分ツリーにおいて最もルート'ノードに近い位置にある頂点ノードのノード識 別子、および、前記親子関係定義配列を参照して、記憶装置に生成された、前記親 子関係定義配列と同一サイズの消去フラグ配列中、前記部分ツリーを構成するノード のノード識別子について、当該フラグをセットするステップと、
前記消去フラグ配列を参照して、前記部分ツリーの削除後のツリーについて、それ ぞれのノードに、親子関係にあるノードについて、親ノードのノード識別子は、子ノー ドのノード識別子より小さ 、と 、う関係を満たす連続する整数であるノード識別子を付 与し、付与された新たなノード識別子を、削除前のツリーのノードのノード識別子と関 連付けて格納した新規ノード識別子配列を、記憶装置に生成するステップと、 前記親子関係定義配列および前記新規ノード識別子配列に基づいて、前記新た なノード識別子に関連付けて、当該ノード識別子をもつノードの親ノードのノード識別 子を格納した、部分ツリー削除後の親子関係定義配列を、前記記憶装置に生成する ステップと、
を実行させることを特徴とする情報処理プログラムにより達成される。
好ましい実施態様においては、前記ノード識別子が、子ノードよりも同じ世代のノー ドを優先して付与された連続する整数であり、前記ルート'ノード以外のノードである 非ルート'ノードの各々に付与されたノード識別子に関連付けて、前記非ルート'ノー ドの各々の親ノードに付与されたノード識別子を格納した親子関係定義配列が、前 記記憶装置中に記憶され、
前記新規ノード識別子配列を生成するステップにお 、て、前記コンピュータに、 前記それぞれのノードに、子ノードより同じ世代のノードを優先して付与された連続 する整数であるノード識別子を付与するステップを実行させる。
[0045] 他の好ましい実施態様においては、前記ノード識別子が、同じ世代のノードよりも子 ノードを優先して付与された連続する整数であり、前記ルート'ノード以外のノードで ある非ルート'ノードの各々に付与されたノード識別子に関連付けて、前記非ルート' ノードの各々の親ノードに付与されたノード識別子を格納した親子関係定義配列が、 前記記憶装置中に記憶され、
前記新規ノード識別子配列を生成するステップにお 、て、前記コンピュータに、 前記それぞれのノードに、同じ世代のノードより子ノードを優先して付与された整数 であるノード識別子を付与するステップを実行させる。
[0046] また、好ま U、実施態様にぉ 、ては、前記記憶装置に、前記ツリーのノードのノード 識別子の各々に関連付けて、当該ノードの少なくともノード値を格納したノード値格 納配列が記憶され、前記コンピュータに、
前記新規ノード識別子配列を参照して、もとのノード識別子と新たなノード識別子と の関連付けにしたがって、前記ノード値格納配列を更新するステップを実行させる。
[0047] 他の好ましい実施態様においては、前記記憶装置に、前記ツリーのノードのノード 識別子の各々に関連付けて、当該ノードの少なくともノード値を格納したノード値格 納配列が記憶され、前記コンピュータに、
前記新規ノード識別子配列を参照して、もとのノード識別子と新たなノード識別子と の関連付けにしたがって、新たなノード識別子の各々と関連付けて、前記ノード値を 格納した、新たなノード値格納配列を生成するステップを実行させる。
[0048] より好ましい実施態様においては、前記新規ノード識別子配列を生成するステップ において、前記コンピュータに、
前記親子関係定義配列と同一のサイズの新規ノード識別子配列のための領域を、 前記記憶装置中に確保するステップと、
新たなノード識別子を一時的に記憶するカレントノード識別子領域を、前記記憶装 置中に確保して、その初期値を格納するステップと、
前記消去フラグ配列を参照して、前記消去フラグ配列の値がセットされて 、な 、場 合には、当該新規ノード識別子配列の値として、前記カレントノード識別子領域の値 を格納し、その後、前記カレントノード識別子領域の値を増分し、その一方、消去フラ グ配列の値がセットされて 、る場合には、当該新規ノード識別子配列の値として無効 値を格納するステップと、を実行させる。
[0049] 別の好ましい実施態様においては、前記部分ツリー削除後の親子関係定義配列を 生成するステップにおいて、前記コンピュータに、
前記親子関係定義配列と同一サイズの格納アドレス配列のための領域を、前記記 憶装置中に確保するステップと、
前記新規ノード識別子配列中、前記親子関係定義配列の値の格納位置と同じ位 置の値を参照して、値が無効値である場合を除き、前記格納アドレス配列に、前記新 規ノード識別子配列中の値を格納するステップと、
前記親子関係定義配列と同一サイズの親ノード識別子配列のための領域を、前記 記憶装置中に確保するステップと、
前記新規ノード識別子配列中、前記親子関係定義配列の値が示す位置の値を参 照して、前記親ノード識別子配列中、前記親子関係定義配列の値の位置と同じ位置 に、前記新規ノード識別子配列の値を格納するステップと、
前記格納アドレス配列中の値に関連付けて、前記親ノード識別子配列の値を格納 した親子関係定義配列を生成するステップと、を実行させる。
[0050] さらに、本発明の目的は、ツリー型データ構造を表すために、ルート'ノードを含む ノードに付与された固有のノード識別子であって、子ノードよりも同じ世代のノードを 優先して付与された連続する整数であるノード識別子を用いて、前記ルート ·ノード 以外のノードである非ルート'ノードの各々に付与されたノード識別子に関連付けて、 前記非ルート'ノードの各々の親ノードに付与されたノード識別子を格納した、記憶 装置中に生成された親子関係定義配列を備えたコンピュータにおいて、
あるツリーを被挿入側ツリーとして、当該被挿入側ツリーの特定のノードに、他のッリ 一である挿入側ツリーのルート'ノードを連結することにより、当該挿入側ツリーを追加 し、当該挿入後のツリーのツリー型データ構造について、前記記憶装置中に親子関 係定義配列を生成するために、前記コンピュータにより読み出し可能な情報処理プ ログラムであって、前記コンピュータに、 被挿入側ツリーの第 1の親子関係定義配列、および、挿入側ツリーの第 2の親子関 係定義配列を記憶装置から読み出すステップと、
前記挿入側ツリーのルート'ノードを、被挿入側ツリーの部分ツリー中、最もルート' ノードに近い位置にある頂点ノードとして、当該頂点ノードが挿入される位置の情報 に基づいて、挿入側ツリーのそれぞれのノードに隣接する、被挿入側ツリーのノード を特定し、当該被挿入側ツリーのノードの情報を、前記記憶装置に記憶するステップ と、
前記被挿入側ツリーのノードの情報を参照して、前記挿入側ツリーの挿入後の前 記被挿入側ツリーについて、それぞれのノードに、子ノードよりも同じ世代のノードを 優先して付与された連続する整数であるノード識別子を付与し、付与された新たなノ ード識別子を、挿入前の被挿入側ツリーのノードのノード識別子と関連付けて格納し た第 1の新規ノード識別子配列を、前記記憶装置に生成するとともに、前記挿入側ッ リーの頂点ノードが挿入される位置の情報に基づいて、前記挿入側ツリーの挿入後 の前記挿入側ツリーについて、それぞれのノードに、子ノードよりも同じ世代のノード を優先して付与された連続する整数であるノード識別子を付与し、付与された新たな ノード識別子を、挿入前の挿入側ツリーのノードのノード識別子と関連付けて格納し た第 2の新規ノード識別子配列を、前記記憶装置に生成するステップと、
前記第 1および第 2の親子関係定義配列、および、前記第 1および第 2の新規ノー ド識別子配列に基づいて、前記新たなノード識別子に関連付けて、当該ノード識別 子をもつノードの親ノードのノード識別子を格納した、挿入後のツリーの親子関係定 義配列を、前記記憶装置に生成するステップと、
を実行させることを特徴とする情報処理プログラムにより達成される。
好ま 、実施態様にぉ 、ては、前記記憶装置に、前記被挿入側ツリーのノードのノ ード識別子の各々に関連付けて、当該ノードの少なくともノード値を格納した第 1のノ ード値格納配列が記憶され、前記挿入側ツリーのノードのノード識別子の各々に関 連付けて、当該ノードの少なくともノード値を格納した第 2のノード値格納配列が記憶 され、前記コンピュータに、
前記第 1および第 2の新規ノード識別子配列を参照して、被挿入側ツリーおよび挿 入側ツリーのそれぞれのもとのノード識別子と、挿入後のツリーの新たなノード識別子 との関連付けにしたがって、前記第 1のノード値格納配列および第 2のノード配列の 少なくとも一方を更新するステップを実行させる。
[0052] 他の好ま ヽ実施態様にお ヽては、前記記憶装置に、前記被挿入側ツリーのノー ドのノード識別子の各々に関連付けて、当該ノードの少なくともノード値を格納した第 1のノード値格納配列が記憶され、前記挿入側ツリーのノードのノード識別子の各々 に関連付けて、当該ノードの少なくともノード値を格納した第 2のノード値格納配列が 記憶され、前記コンピュータに、
前記第 1および第 2の新規ノード識別子配列を参照して、被挿入側ツリーおよび挿 入側ツリーのそれぞれのもとのノード識別子と、挿入後のツリーの新たなノード識別子 との関連付けにしたがって、新たなノード識別子の各々と関連付けて、前記ノード値 を格納した、新たなノード値格納配列を生成するステップを実行させる。
[0053] より好まし 、実施態様にぉ ヽては、前記被挿入側ツリーのノードの情報を、前記記 憶装置に記憶するステップにおいて、前記コンピュータに、
前記挿入側ツリーの頂点ノードが挿入される位置の情報に基づいて、前記第 1の親 子関係定義配列と同一のサイズの挿入マーク配列中、前記挿入される位置の直後 のノードおよび前記直後のノードを先祖とするノードにっ 、て、当該挿入位置である ことを示す値を格納するステップを実行させる。
[0054] 別の好ま 、実施態様にぉ ヽては、さらに、前記コンピュータに、前記被挿入側ッリ 一の各ノードの、当該被挿入側ツリーの頂点ノードからの深さのレベルを表すレベル 値を格納した第 1のレベル配列を、前記記憶装置に生成するステップと、
前記第 1のレベル配列中、前記挿入側ツリーの頂点ノードの挿入位置に相当する レベル値を参照して、前記挿入側ツリーの各ノードの、前記被挿入側ツリーの頂点ノ ードからの深さのレベルを表すレベル値を格納した第 2のレベル配列を、前記記憶 装置に生成するステップと、を実行させ、
前記第 1および第 2の新規ノード識別子配列を生成するステップにおいて、前記コ ンピュータに、
前記第 1および第 2の親子関係定義配列と、それぞれ、同一のサイズの第 1および 第 2の新規ノード識別子配列のための領域を、前記記憶装置中に確保するステップ と、
新たなノード識別子を一時的に記憶するカレントノード識別子領域を、前記記憶装 置中に確保して、その初期値を格納するステップと、を実行させ、
前記挿入マーク配列中、その値が、挿入位置であることを示す値に変化している位 置以外の位置においては、前記コンピュータに、
(a)前記第 1の新規ノード識別子配列中、当該位置の値として、前記カレントノード識 別子領域の値を格納し、
(b)その後、前記カレントノード識別子領域の値を増分する
ステップを、さら〖こ実行させ、
前記挿入マーク配列中、当該挿入マーク配列の値力 挿入位置であることを示す 値に変化する位置においては、前記コンピュータに、
(a)前記第 1のレベル配列中、当該位置のレベル値を参照し、かつ、前記第 2のレべ ル配列中、同一のレベル値を有する範囲を特定し、
(b)前記第 2の新規ノード識別子配列中、当該範囲の先頭位置力 順次、カレントノ ード識別子領域の値を格納し、
(c)その後、前記カレントノード識別子領域の値を増分し、
(d)前記第 2の新規ノード識別子配列中、前記同一のレベル値を有する範囲への値 の格納が終了すると、第 1の新規ノード識別子配列の値として、前記カレントノード識 別子領域の値を格納し、
(e)その後、前記カレントノード識別子領域の値を増分するステップを、さらに実行さ せる。
また、別の好ましい実施態様においては、前記ツリー挿入後の親子関係定義配列 を生成するステップにおいて、前記コンピュータに、
前記第 1の親子関係定義配列と同一サイズの、第 1の親ノード識別子配列のための 領域を、前記記憶装置中に確保するステップと、
前記第 1の新規ノード識別子配列中、前記第 1の親子関係定義配列の値が示す位 置の値を参照して、前記第 1の親ノード識別子配列中、前記親子関係定義配列の値 の位置と同じ位置に、前記第 1の新規ノード識別子配列の値を格納するステップと、 前記第 1の新規ノード識別子配列の値と、前記第 1の親ノード識別子配列の値とを 関連付けるステップと、
前記第 2の親子関係定義配列と同一サイズの、第 2の親ノード識別配列のための領 域を、前記記憶装置中に確保するステップと、
前記第 2の新規ノード識別子配列中、先頭の値として、前記挿入側ノードの頂点ノ 一ドの親ノードとなるノードのノード識別子を格納するともに、他の値として、前記第 2 の親子関係定義配列の値が示す位置の値を参照して、前記第 2の親ノード識別子 配列中、前記親子関係定義配列の値の位置と同じ位置に、前記第 2の新規ノード識 別子配列の値を格納するステップと、
前記第 2の新規ノード識別子配列の値と、前記第 2の親ノード識別子配列の値とを 関連付けるステップと、
前記第 1の新規ノード識別子配列の値および前記第 2の新規ノード識別子配列の 値のそれぞれに関連付けられた、前記第 1の親ノード識別子配列の値および第 2の 親ノード識別子配列の値を、挿入後の親子関係定義配列に格納するステップと、を 実行させる。
発明の効果
[0056] 本発明によれば、効率的にツリーから、当該ツリーの一部分である部分ツリーを削 除し、また、あるツリーに他のツリーを挿入する方法、情報処理装置、および、プログ ラムを提供することが可能となる。
発明を実施するための最良の形態
[0057] 以下、添付図面を参照して、本発明の実施の形態につき説明を加える。
[0058] [コンピュータシステム構成]
図 1は、本発明の実施の形態に力かるツリー型データ構造を取り扱う情報処理装置 のハードウェア構成を示すブロックダイヤグラムである。図 1に示すように、この情報処 理装置 10は、通常のコンピュータと同様の構成であり、プログラムを実行することによ り装置全体および個々の構成部分を制御する CPU12、ワークデータなどを記憶する RAM(Random Access Memory) 14、プログラム等を記憶する ROM(Read Only Memo ry)16、ハードディスク装置 18、 CD— ROM19をアクセスするためのドライバ 20、ドラ ィバ 20や外部ネットワーク(図示せず)と接続された外部端子との間に設けられたイン タフエース (IZF) 22、キーボードやマウス力 なる入力装置 24、表示装置 26を備え ている。 CPU12、 RAM 14, ROM16、ハードディスク装置 18、 I/F22,入力装置 2 4および表示装置 26は、ノ ス 28を介して相互に接続されている。上記実施の形態で は、コンピュータシステム 10は、ドライノく 20により、 CD— ROM19に格納されたデー タを読み出すように構成されている力 これに限定されるものではなぐ CD-R/W 、 DVD-ROM, DVD— RAMなどに格納されたデータを読み出し可能に構成して も良い。
[0059] 本実施の形態にかかる、ツリー型データ構造を RAM14などメモリ上に構築するプ ログラム、及び、ツリー型データ構造をメモリ上で変換するプログラムは、 CD—ROM 19に収容され、ドライバ 20に読取られても良いし、 ROM16に予め記憶されていても 良い。また、いったん CD— ROM19から読み出したものを、ハードディスク装置 18の 所定の領域に記憶しておいても良い。或いは、上記プログラムは、ネットワーク(図示 せず)、外部端子および IZF22を経て外部から供給されるものであっても良い。
[0060] また、本発明の実施の形態に力かる情報処理装置は、コンピュータに、ツリー型デ ータ構造をメモリ上に構築するプログラム、および、ツリー型データ構造をメモリ上で 変換するプログラムを実行させること〖こより実現される。このツリー型データ構造をメモ リ上で変換するプログラムに、後述するツリー挿入処理を実現するプログラムやツリー 削除処理を実現するプログラムも含まれる。
[0061] [ツリー型データ構造]
図 2A、 Bは、ツリー型データの一例である POSデータの説明図であり、図 2Aは、こ のツリー型データのデータ構造 (即ち、トポロジー)及びデータ値を視覚的に表現した 一例であり、図 2Bは、同じツリー型データを XML形式で表現した一例である。図 2A 、 Bに示されるようにツリー型データ構造は、ルート'ノード (本例では、 POSデータ) 力も始めて、各ノードで枝分かれしてリーフ'ノード (端点)に至るノードとアークの組 み合わせによって表現される。各ノードには、項目名情報、すなわち、ノードのタイプ と、項目値情報、すなわち、ノードの値が関連付けられ、図 2Bの例では、 XML形式 の
く shopName〉フランス店く/ shopName〉
に対応したノードは、「shopName ( =店名)」と 、うノードタイプと「フランス店」と 、ぅノ ード値が関連付けられている。この関連付けは、例えば、ノードタイプ及びノード値を 記述する情報が格納されたノード情報格納領域へのポインタを、ノード識別子に随伴 させること〖こよって実現することができる。しかし、本発明は、ツリー型データ構造の実 体的な値の取り扱い方によって限定されないことに注意する必要がある。
[0062] これに対して、ツリー型データ構造のデータの検索、集計、ソートを効率的に実行 するためには、ツリー型データ構造のトポロジーを表現する手法、すなわち、記憶装 置に展開する手法が非常に重要な役割を果たす。そこで、以下では、主として、ッリ 一型データ構造のトポロジーに関して説明する。
[0063] 従来、このようなツリー型データ構造は、データを蓄えたノード間をポインタで接続 すること〖こよって表現されている。しかし、ポインタ表現は、ポインタ値に必然性がな いという欠点がある。即ち、ある場合には特定のノード Aがある番地 (例えば、 100番 地)に格納され、別の場合には同じノード Aが別の番地 (例えば、 200番地)に格納さ れるので、ポインタ値が一定ではなぐポインタ値は、本質的にノードの格納アドレス を表現するに過ぎない。そのため、例えば、ノードが深さ優先の規則に従ってポイン タで接続されて ヽる場合、これらのノードを幅優先の規則に従ってポインタで再接続 することは困難である。
[0064] これに対して、本発明者は、ツリー型データ構造のトポロジーがアークリストによって 記述可能であることに着目した。アークリストとは、ノード間の親子関係を表すアーク のリストである。図 3A〜Cは、アークリストを用いたツリー型データ構造の表現形式の 一例の説明図である。同図の例では、「0」、「10」、「20」、「30」、「40」、「50」、「60」 、「70」、「80」、「90」、「100」及び「110」のノード識別子(ID)が付与された 12個の ノード力 なるツリー型データ構造が示されて 、る。図 3Aはツリー型データ構造の全 体を示している。図 3Aにおいて、(ノードのタイプを表している)丸形、ハート形などの 図形の中央に記載された数字は、ノード IDを表し、矢印と矢印の側に記載されたく 0 , 10>などの数字の対は、アークを表している。尚、ノード IDは、文字列には限られ ず、数値、特に、整数でもよい。図 3Bは、親ノード (From— ID)から子ノード (To— I D)へのアークリストを示し、図 3Cは、ノード IDとノード Typeの対のリストからなるノー ドリストを示す。尚、ツリー型データ構造を表現するだけの目的のためにはノードリスト が無くても構わない。原理的には、このようなアークリストを用いることによって、ノード 間の関係をポインタによらずに直接的に記述することが可能である。
[0065] [「子→親」関係に基づく表現]
図 3A〜Cの例では、アークリストは、親ノードに子ノードを対応付ける「親→子」関 係に基づいて記述されている。そのため、一つの親ノード、例えば、ルート'ノード 0に は、 3個の子ノード 10、 60及び 80が存在するため、アークリストの From— IDには、 同じノード IDの「0」が 3回出現している。つまり、親ノードを特定しても子ノードを特定 することができないので、アークリストは、要素 From— IDの配列と要素 To— IDの配 列により構成される。アークリストを使用する場合、あるノードは、 From— IDの配列と 、 To— IDの配列の両方の配列に出現する。
[0066] これに対して、親子関係は、「子→親」関係によっても表現することが可能である。こ の場合、ノード間の親子関係は、ルート'ノード以外のノードである非ルート'ノードの 各々と、関連付けられた親ノードと、の組の配列によって表現される。この「子→親」 関係によって親子関係を表現する場合、「親→子」関係の場合には得られな力つた 重要な性質がある。即ち、一つの子ノードには必ず唯一の親ノードが対応するので、 子ノードを特定することによって、この子ノードに対応する唯一の親ノードを直ちに特 定することができる。つまり、アークリストは、実際には、要素 To— IDの配列だけを準 備すればよい。この結果として、アークリストを格納するための記憶容量が削減される 。この記憶容量の削減は、メモリへのアクセス回数が低減するという効果があるので、 結果的に、処理の高速ィ匕が実現できる。
[0067] 図 4A〜Cは、本発明の一実施例による「子→親」関係に基づくツリー型データ構造 の表現方法の説明図である。図 4Aはツリー全体の説明図であり、図 4Bは「子→親」 関係に基づくアークリストである。図 4Bのアークリストは、ルート'ノードに対する親ノ ードの格納領域を含んでいるので、ルート'ノードの親ノードとして、便宜的に〃—"が 設定されている。但し、ルート'ノードに対応する親ノードは存在しないので、図 4Cに 示されるように、「子→親」関係に基づくアークリストからルート'ノードに対する親ノー ドの格納領域を除いても構わない。このように本発明の一実施例では、ルート'ノード 以外のノードである非ルート'ノードの各々に対して、非ルート'ノードの親ノードを関 連付けることによりノード間の親子関係を表現する。そして、「子→親」表現された子 のノード力 親のノードのリストを迪ることでツリーのトポロジーを表現することができる
[0068] このような「子→親」関係に基づくツリー型データ構造は、本発明の一実施例によれ ば、図 5に示されるように、図 1に示されたコンピュータシステム 10に、ルート'ノードを 含むノードに固有のノード識別子を付与するノード定義ステップ 501と、前記ルート' ノード以外のノードである非ルート'ノードの各々に付与されたノード識別子に、前記 非ルート'ノードの各々の親ノードに付与されたノード識別子を関連付ける親子関係 定義ステップ 502と、を実行させることによって RAM14上に構築される。このように、 最初に、文字列、浮動小数、整数などの任意の識別情報によってノードにノード識別 子を付与し、次に、「子→親」表現に基づいて親子関係を定義することによって、子ノ ードのノード識別子力 親ノードのノード識別子を引く (ルックアップする)ことでツリー のトポロジーを表現することができる。
[0069] [ノード識別子]
好ま 、一実施例によれば、ノード定義ステップはノード識別子として数値を使用し 、より好ましくは、連続する整数を使用し、更に好ましくは、「0」又は「1」からの整数連 番を使用する。これにより、ノード識別子から、そのノードに対応する親ノードのノード 識別子が格納されて 、るアドレスを簡単に取得することができるので、子ノードのノー ド識別子力も親ノードのノード識別子を引く処理を高速ィ匕することができる。
[0070] ツリー型データ構造のノードにノード識別子として順序付きの番号を付与してノード 間の親子関係を表現する場合、番号の付与順序に規則を定めることによって、その 後のツリー型データ構造の取り扱 、が容易になると 、う利点がある。本発明によれば 、この番号の付与順序の規則として、同じ世代のノードよりも子ノードを優先する深さ 優先モードと、子ノードよりも同じ世代のノードを優先する幅優先モードが利用される [0071] 図 6A〜Cは、本発明の一実施例により ID形式のツリー構造型データを整数連番 形式のツリー構造型データへ変換する処理の説明図である。図 6Aには、各ノードに I D番号が付与されたツリー構造型データが示され、図 6Bには、変換規則が示され、 図 6Cには、各ノードに整数連番が付与されたツリー構造型データが示されている。 本例の変換規則は、深さ優先で連続番号を付与する規則であり、具体的には、複数 の子ノードが存在する場合、長子 (一番上の兄)ノードに最小番号を付与し、末子 (一 番下の弟)ノードに大きい番号を付与し、かつ、兄弟ノードよりも子ノードを優先して 番号を付与する。本例では、昇順に番号付けをしているが、降順に番号付けをしても よい。
[0072] また、図 7A〜Cは、本発明の他の一実施例により ID形式のツリー構造型データを 整数連番形式のツリー構造型データへ変換する処理の説明図である。図 7Aには、 各ノードに ID番号が付与されたツリー構造型データが示され、図 7Bには、変換規則 が示され、図 7Cには、各ノードに整数連番が付与されたツリー構造型データが示さ れている。本例の変換規則は、幅優先で連続番号を付与する規則であり、具体的に は、複数の子ノードが存在する場合、長子(一番上の兄)ノードに最小番号を付与し 、末子(一番下の弟)ノードに大きい番号を付与し、かつ、子ノードよりも兄弟ノードを 優先して番号を付与する。本例では、昇順に番号付けをしているが、降順に番号付 けをしてもよい。
[0073] このようにノード識別子として番号を使用すると、ノード番号から直ちに、即ち、 0 (1
)のオーダーで、そのノードに関する格納値が格納されているアドレスを引くことがで きる。また、親子関係を「子→親」表現することによって、子ノードから親ノードを直ち に、即ち、 O (l)のオーダーで引くことができる。
[0074] [深さ優先モード]
本発明の一実施例によれば、図 6Cに示されるような深さ優先に基づくツリー型デ ータ構造は、図 1に示されたコンピュータシステム 10に、
同じ世代のノードよりも子ノードを優先して、ルート'ノードを含むノードに固有の連 続する整数を付与するノード定義ステップと、
ルート ·ノード以外のノードである非ルート ·ノードの各々に付与された整数の順に、 非ルート'ノードの各々の親ノードに付与された整数を並べることにより形成される配 列を前記記憶装置に格納する親子関係定義ステップと、
を実行させることによって、記憶装置上に構築される。これにより、ノードは深さ優先 で連続整数が付与され、ノード間の親子関係は「子→親」関係の配列によって表現さ れる。
[0075] 図 8は、本発明の一実施例による深さ優先に基づくノード定義処理のフローチヤ一 トである。このノード定義処理は、コンピュータシステム 10に
最初にルート'ノードに番号を付与するステップ 801と、
既に番号が付与されたあるノードに唯一の子ノードが存在する場合には、当該子ノ ードに当該あるノードに付与された前記番号の次の番号を付与するステップ 802と、 既に番号が付与されたあるノードに複数の子ノードが存在する場合には、当該複数 の子ノードの間の兄弟関係に従って、弟ノードは直上の兄ノードの全ての子孫ノード に番号が付与された後に次の番号が付与されるように、一番上の兄ノードから一番 下の弟ノードまで番号を付与するステップ 803と、
を実行させる。これにより、深さ優先モードで同一の親ノードから派生した複数の子ノ ードの間に兄弟関係が定義される。
[0076] 図 9は、本発明の一実施例により図 6Cに示された深さ優先のツリー型データ構造 力も作成された「子→親」表現に基づく親子関係の配列の説明図である。図 9にサブ ツリー 1又はサブツリー 2として示されているように、深さ優先で連続番号が付与され たノードの親子関係を「子→親」関係に基づいて配列表現すると、あるノードの子孫ノ ードが連続領域に出現するという優れた性質が得られる。
[0077] 本発明の一実施例では、深さ優先モードの優れた性質を利用することにより、前記 配列から、あるノードに付与された整数以上の値が格納されて!ヽる連続領域を抽出 することにより、前記あるノードの全ての子孫ノードを特定する。これにより、あるノード の子孫ノードを表すノード群が前記配列内の連続ブロックとして獲得できる。例えば、 連続ブロックのサイズを「m」とすると、あるノードの全ての子孫ノードを特定するため の処理速度は、 O (m)のオーダーになる。
[0078] 既に説明したように、ノード間の親子関係は、「子→親」関係の配列の他に、「親→ 子」関係の配列によっても表現できる。図 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」であ ることがゎカゝる。
[0079] この「親→子」表現に基づく親子関係の配列の求め方を説明する。
(1)ノードの番号が配列 P→Cの最大の添字( = 11)と一致する場合、このノードに属 する子ノードは存在しない。したがって、処理は継続されない。
(2)同図に太字で表された親ノードの番号力も Aggr値を求める。この Aggr値は、配 列 P→Cの開始点を表す。
(3)太字で表された親ノード番号 + 1に対応する Aggr値を求める。この Aggr値 1 が配列 P→Cの終了点である。
[0080] 例えば、ノード 0の子ノードの開始点は、 Aggr[0]、即ち、「0」であり、終了点は、 A ggr[l]— 1、即ち、「3— 1 = 2」である。したがって、ノード 0の子ノードは、配列 P→C の 0〜2番目の要素、即ち、「1」、「6」及び「8」である。
[0081] 或いは、「親→子」表現に基づく親子関係は、より単純に、親ノード番号の配列と、 対応する子ノード番号の配列と、の二つの配列により表現することも可能である。しか し、この配列を利用して親子関係を見つけるためには、親ノードの番号を検索しなけ ればならないので、即ち、 log (n)のアクセス時間を要するので効率が悪い。
[0082] [幅優先モード]
本発明の一実施例によれば、図 7Cに示されるような幅優先に基づくツリー型デー タ構造は、図 1に示されたコンピュータシステム 10に、
子ノードよりも同じ世代のノードを優先して、ルート'ノードを含むノードに固有の連 続する整数を付与するノード定義ステップと、
前記ルート'ノード以外のノードである非ルート'ノードの各々に付与された整数の 順に、前記非ルート'ノードの各々の親ノードに付与された整数を並べることにより形 成される配列を前記記憶装置に格納する親子関係定義ステップと、
を実行させることによって、記憶装置上に構築される。これにより、ノードは幅優先モ ードで連続整数が付与され、ノード間の親子関係は「子→親」関係の配列によって表 現される。
[0083] 図 11は、本発明の一実施例による幅優先に基づくノート定義処理のフローチャート である。このノード定義処理は、コンピュータシステム 10に、
各ノードが前記ルート'ノードから何世代目のノードである力 及び、各世代に含ま れるノード数を算出するステップ 1101と、
最初に前記ルート ·ノードに番号を付与するステップ 1102と、
ある世代に含まれる全てのノードに番号が付与されたならば、当該ある世代の次の 世代にノードが存在しなくなるまで、当該次の世代に含まれる全てのノードに対して、 親ノードが異なる場合には、当該親ノードに番号が付与された順番に当該ノードに番 号を付与し、当該親ノードが同一である場合には、当該親ノードから派生した複数の 子ノードの間に兄弟関係を定義し、一番上の兄ノードから一番下の弟ノードまで直前 に付与された番号の次の番号から連続的に変化する固有の整数を順に付与するス テツプ 1013と、
を実行させる。これにより、幅優先モードで同一の親ノードから派生した複数の子ノー ドの間に兄弟関係が定義される。
[0084] 図 12は、本発明の一実施例により図 7Cに示された幅優先のツリー型データ構造 力も作成された「子→親」表現に基づく親子関係の配列の説明図である。図 12に示 されているように、幅優先で連続番号が付与されたノードの親子関係を「子→親」関 係に基づいて配列表現すると、あるノードの子ノードは連続領域に出現するという優 れた性質が得られる。これは、幅優先モードで連続番号が付与されたノードの親子関 係を「子→親」関係に基づいて配列表現すると、親ノードに付与された番号が前記配 列中に順序付き (昇順又は降順)で出現することによる。 [0085] したがって、本発明の一実施例では、幅優先モードの優れた性質を利用することに より、前記配列から、あるノードに付与された整数と同じ値が格納されている連続領域 を抽出することにより、前記あるノードの全ての子ノードを特定する。これにより、あるノ 一ドの子ノードを、例えば、二分探索などの手法を用いて検索することが可能であり、 即ち、 O (log (n) )のオーダーで検索することが可能になる。
[0086] 既に説明したように、ノード間の親子関係は、「子→親」関係の配列の他に、「親→ 子」関係の配列によっても表現できる。図 13は、図 7Cに示された幅優先のツリー型 データ構造力 作成された「親→子」表現に基づく親子関係の配列の説明図である。 図 13に示されるように、一つの親ノードに対して複数の子ノードが存在し得るので、 親子関係の配列は、各ノードに対する子ノードの番号が格納されている領域を示す ための配列 Aggrと、子ノードの番号が格納されている配列 P→Cの二つの配列により 構成される。例えば、配列 Aggrの先頭から 2番目の要素 Aggr[l]の値は「3」であり、 これは、ノード [1]に対する子ノードの番号は、配列 P→Cの要素 P→C[3]以降に格 納されていることを表している。これにより、ノード [0]、即ち、ルート'ノードに対する 子ノードは、配列 P→Cの先頭から 3個の要素、 P→C[0]の「1」、 P→C[1]の「2」、 及び、 P→C [2]の「3」であることがわ力る。
[0087] この「親→子」表現に基づく親子関係の配列の求め方を説明する。
(1)ノードの番号が配列 P→Cの最大の添字( = 11)と一致する場合、このノードに属 する子ノードは存在しない。したがって、処理は継続されない。
(2)同図に太字で表された親ノードの番号力も Aggr値を求める。この Aggr値は、配 列 P→Cの開始点を表す。
(3)太字で表された「親ノード番号 + 1」に対応する Aggr値を求める。この「Aggr値 1」が配列 P→Cの終了点である。
[0088] 例えば、ノード 0の子ノードの開始点は、 Aggr[0]、即ち、「0」であり、終了点は、 A ggr[l]— 1、即ち、「3— 1 = 2」である。したがって、ノード 0の子ノードは、配列 P→C の 0〜2番目の要素、即ち、「1」、「2」及び「3」である。
[0089] [ツリー型データ構造の表現形式の相互変換]
上述のように、ノードに連続番号を付与するための深さ優先モード及び幅優先モー ドは、それぞれ、固有の優れた性質を備えている。本発明の一実施例による情報処 理装置 10は、詳細な説明は省略するが、図 14に示すように、深さ優先に基づく「子 →親」表現形式と、幅優先に基づく「子→親」表現形式と、「親→子」表現形式と、の 間で相互に表現形式を変換することができる。
[0090] [ツリー削除]
次に、ツリー型データ構造のトポロジーを編集する操作の一つであるツリー削除に ついて説明する。本発明にかかる「ツリー削除」は、ツリー型データ構造において、全 体のツリーから、ある特定のノードおよびそのノードの子孫ノード (つまり、部分ツリー) を取り除くことを意味する。実際には、ツリー型データ構造を表す、メモリ中に格納さ れている「子→親」表現による親子関係定義配列 (以下、「C P配列」と称する。また 、図においては、「C-〉P」、或いは、「C-P」と表記される。)から、部分ツリーに相当す るノードの情報が削除され、かつ、残りのノードに対して、たとえば幅優先モードにし たがって付された新たなノード識別子を格納した C P配列をメモリ中に生成すること である。なお、全体のツリーから削除される部分ツリーには、単一のノードから構成さ れるものも含まれる。また、本明細書において、上記ツリー型データ構造において、あ るノードおよびそのノード力 枝分かれしてリーフ'ノードに至るまでのノード群を、部 分ツリーと称する。また、部分ツリーにおいて、ルート'ノードに最も近いノードを頂点 ノードと称する。
[0091] 以下、本実施の形態において、幅優先モードで、ツリー型データ構造が表され、幅 優先モードにしたがって、ツリーを構成するノードのノード識別子を格納した C P配 列がメモリに記憶されている場合のツリー削除について説明する。
[0092] 図 15は、本実施の形態に力かる幅優先モードで表されたツリー型データ構造の一 例を視覚的に表した図である。このツリー型データ構造において、ノード識別子「2」 のノード (符号 1501参照)を頂点ノードとする部分ツリーを削除することを考える。ッリ 一削除の処理においては、基本的には、ノード識別子「2」を頂点ノードとする部分ッ リーが、全体のツリーから除かれた状態で、幅優先モードにしたがって、残りのノード に、新たにノード識別子が付与され、そのノード識別子に関する配列力^モリなどに
SC fedれる。 [0093] 図 16は、本実施の形態に力かるツリー削除処理を示すフローチャートである。図 16 に示すように、 CPU12は、デリートフラグ配列、新規ノード識別子配列およびカレント ノード番号領域を、 RAM14などのメモリ中に確保する(ステップ 1601)。次いで、 CP U12は、削除対象となる部分ツリーの頂点ノードのノード識別子について、デリートフ ラグ配列のフラグをセットする (ステップ 1602)。なお、削除対象は、オペレータが、た とえば、表示装置 26に表示された、図 15のようなツリー型データ構造のトポロジーを 参照して、入力装置 24を操作して、頂点ノードを指定すればよい (本例では、ノード 1 501)。
[0094] 図 17は、図 15に示すツリー型データ構造の親子関係を表す配列、初期値が格納 されたデリートフラグ配列(図中、「Delete Flag」と表記される。)、新規ノード識別子 配列(図中、「New Node No.」と表記される。)、および、初期値が配置された力 レントノード識別子領域(図中、「Current Node No.」と表記される。)を示す図で ある。
[0095] この例では、ノード識別子「2」のノードを頂点ノードとする部分ツリーが削除されるた め、図 17に示すように、デリートフラグ配列 1701において、ノード識別子「2」に関す る要素が「1」にセットされる(すなわち、フラグがセットされる)。また、カレントノード識 別子領域 1702には、初期値「0」が格納される。
[0096] CPU12は、処理対象とするノードを特定するための処理対象位置を「0」に初期化 する(ステップ 1603)。 CPU12は、デリートフラグ配列中、処理対象位置のフラグを チェックし (ステップ 1604)、フラグがセットされているか否かを判断する(ステップ 160 5)。ステップ 1605でノー (No)の場合に、次いで、 CPU12は、デリートフラグ配列中、 処理対象位置のノードの親ノードについて、そのフラグをチェックし (ステップ 1606) 、フラグがセットされているかを判断する(ステップ 1607)。ステップ 1607においても ノー (No)と判断された場合には、 CPU12は、カレントノード識別子領域の値を、新規 ノード識別子配列中、処理対象位置に格納し、かつ、カレントノード識別子領域の値 をインクリメントする(ステップ 1608)。
[0097] その一方、ステップ 1605でイエス (Yes)或!、はステップ 1607でイエス (Yes)と判断さ れた場合には、 CPU12は、デリートフラグ配列中、処理対象位置の要素を「1」にセ ットし、かつ、新規ノード識別子配列中、処理対象位置に、「—1」を格納する (ステツ プ 1609)。
[0098] あるノード識別子を有するノードが、削除対象の部分ツリーに属する場合には、ステ ップ 1605或いはステップ 1607でイエス (Yes)と判断される。その場合には、デリートフ ラグ配列の対応する要素に「1」がセットされ、そのノードが削除対象であることを明ら カ こする。また、新規ノード識別子配列において、当該ノードが削除対象であること がわかるように、特定の値「—1」を与える。
[0099] その一方、あるノード識別子を有するノードが、削除対象の部分ツリーに属しない場 合には、そのノードについて、削除対象の部分ツリーを構成する 1以上のノードを除 いた新たなノード識別子が付与される。新規ノード識別子配列に、新たなノード識別 子が格納される。
[0100] 図 18A、 B、図 19A、 Bおよび図 20を参照して、図 15に示す例において、ノード識 別子「2」を有する頂点ノードを含む部分ツリーの削除処理にっ 、て説明する。
[0101] 図 18Aに示すように、処理対象位置「0」のときには、ステップ 1605およびステップ 1607でノー (No)と判断される。その結果、カレントノード識別子領域の値「0」が、新 規ノード識別子配列中、処理対象位置「0」に格納され、その後、カレントノード識別 子領域の値力 Sインクリメントされて「1」となる。図 18Bに示すように、処理対象位置「1」 のときにも、ステップ 1605およびステップ 1607でノー(No)と判断される。その結果、 カレントノード識別子領域の値「1」が、新規ノード識別子配列中、処理対象位置「1」 に格納され、その後、カレントノード識別子領域の値力 Sインクリメントされて「2」となる。
[0102] 図 19Aに示すように、処理対象位置「2」のときには、ステップ 1605でイエス (Yes)と 判断される。その結果、デリートフラグ配列中、処理対象位置「2」の値が、(実際には 既にセットされているが)「1」にセットされ、かつ、新規ノード識別子配列中、処理対象 位置「2」の値として「—1」が格納される。図 19Bに示すように、処理対象位置「6」のと きには、ステップ 1607でイエス (Yes)と判断される。その結果、デリートフラグ配列中、 処理対象位置「6」の値が、「1」にセットされ、かつ、新規ノード識別子配列中、処理 対象位置「6」の値として「— 1」が格納される。
[0103] 全てのノード(つまり、ノード識別子「0」〜「11」までのノード)について、図 16に示 す処理が実行されると(図 16のステップ 1610、 1611参照)、図 20に示すような配列 を得ることができる。 CPU12は、新規ノード識別子配列に基づいて、部分ツリーを構 成するノードの削除後のツリーの C P配列を生成する。
[0104] 図 21は、ツリー削除後の C P配列の生成のための処理(ツリー削除処理(2) )を 示すフローチャートである。図 21に示すように、 CPU12は、新たな C— P配列の領域 をメモリ中に確保する (ステップ 2101)。なお、新たな C— P配列のための領域のサイ ズは、ツリー削除の前の C— P配列のサイズより小さくなるため、ツリー削除の前の C —P配列のサイズと同じであれば十分である。次いで、 CPU12は、新たな C— P配列 の格納アドレス(つまり、格納位置番号)を一時的に格納するための格納アドレス配 列の領域、および、ツリー削除後の各ノードの親ノードのノード識別子を一時的に格 納するための親ノード識別子配列の領域を、メモリ中に確保する (ステップ 2102)。こ れら配列のサイズは、 C P配列のサイズと同じであれば良!、。
[0105] CPU12は、処理対象位置を「0」に初期化する(ステップ 2103)。 CPU12は、処理 対象となるノードの各々について、格納アドレスの算出および親ノードのノード識別 子の算出を実行する。格納アドレスの算出において、 CPU12は、新規ノード識別子 配列中、処理対象位置の値を取得する(ステップ 2104)。次いで、 CPU12は、格納 アドレス配列中、処理対象位置に、ステップ 2104にて取得した値を格納する (ステツ プ 2105)。なお、新規ノード識別子配列中の値が「- 1」であるときには、格納アドレ ス配列には、無効値を格納する。
[0106] 図 22A〜Dは、ステップ 2104およびステップ 2105にて実行される処理を具体的に 説明する図である。たとえば、図 22Aに示すように、処理対象位置「0」のときには、新 規ノード識別子配列中、格納位置番号「0」の値「0」が取得され、取得された値「0」が 、格納アドレス配列(図中、「Addr」と表記する)中、格納位置番号「0」の位置に格納 される。また、図 22Bに示すように、処理対象位置「1」のときには、新規ノード識別子 配列中、格納位置番号「1」の値「1」が取得され、取得された値「1」が、格納アドレス 配列中、格納位置番号「 1」の位置に格納される。
[0107] その一方、図 22Cに示すように、処理対象位置「2」のときには、新規ノード識別子 配列中、格納位置番号「2」の値が取得される力 この値は「一 1」である。したがって、 格納アドレス配列中、格納位置番号「2」の位置には、無効値が格納される。このよう な処理が繰り返され、図 22Dに示すように、値が格納された格納アドレス配列を得る ことができる。
[0108] 親ノードのノード識別子の算出においては、 CPU12は、 C— P配列中、処理対象 位置の値 (ノード識別子)を取得し (ステップ 2106)、新規ノード識別子配列中、 C- P配列の値 (ノード識別子)が示す位置の値を取得する (ステップ 2107)。さらに、 CP U12は、親ノード識別子配列中、処理対象位置に、取得した新規ノード識別子配列 の値を格納する(ステップ 2108)。なお、図 21には示していないが、 C— P配列の値( ノード識別子)が「—1」である場合には、例外的に、親ノード識別子配列中、同じ処 理対象位置に、その値「一 1」を格納する。これはルート'ノードに対する例外処理で ある。
[0109] 図 23A〜Dは、ステップ 2106〜2108にて実行される処理を具体的に説明する図 である。たとえば、図 23Aに示すように、処理対象位置「0」のときには、 C— P配列の 値が「一 1」であるため、例外処理として、親ノード識別子配列(図中、「P—Node」と 表記する)中、格納位置番号「0」の値として「一 1」が格納される。図 23Bに示すように 、処理対象位置「1」のときには、 C— P配列の値力「0」であるため、新規ノード識別子 配列中、格納位置番号「0」の値「0」が取得され、この取得された値「0」が、親ノード 識別子配列中、処理対象位置「1」(格納位置番号「1」の位置)に格納される。同様に 、図 23Cに示すように、処理対象位置「2」のときには、 C— P配列の値が「0」であるた め、新規ノード識別子配列中、格納位置番号「0」の値「0」が取得され、この取得され た値「0」が、親ノード識別子配列中、処理対象位置「2」(格納位置番号「2」の位置) に格納される。なお、処理対象位置「2」の親ノード識別子配列の値は、後述するよう に格納アドレスが無効値である力 最終的には利用されない。このような処理が繰り 返され、図 23Dに示すように、値が格納された親ノード識別子配列を得ることができ る。
[0110] 全てのノード識別子について、格納アドレスの算出(ステップ 2104、 2105)、およ び、親ノードのノード識別子の算出 (ステップ 2106〜2108)が実行される (ステップ 2 109、 2110参照)。その後、 CPU12は、新たな C— P配列について、ある格納位置 番号が示す位置の、格納アドレス配列の値が示す位置に、親ノード識別配列中、同 じ格納位置番号が示す位置の値 (ノード識別子)を格納する (ステップ 2111)。ステツ プ 2111の処理も、実際には、処理対象位置を初期化して、それぞれの処理対象位 置について、格納アドレスおよび親ノード識別子を取得して、新たな C P配列に、 親ノード識別子を格納していけばよい。なお、格納アドレス配列の値が無効値であれ ば、新たな C P配列への値の格納は省略される。
[0111] 図 24Aおよび Bは、それぞれ、図 22A〜Dの処理で得られた格納アドレス配列、お よび、図 23A〜Dの処理で得られた親ノード識別子配列の例である。たとえば、格納 アドレス配列中、格納位置番号「0」の値は「0」であるから、新たな C P配列中、格 納アドレス配列の値「0」が示す位置に、親ノード識別子配列中、同じ格納位置番号 である「0」の位置の値「一 1」が格納される。同様に、格納アドレス配列中、格納位置 番号「1」の値は「1」であるから、新たな C P配列中、格納アドレス配列の値「1」が示 す位置に、親ノード配列中、同じ格納位置番号である「1」の位置の値「0」が格納され る。格納位置番号「2」のときには、格納アドレス配列の値が無効値であるから、新た な C P配列への値の格納は省略される。このような処理を繰り返すことにより、図 24 Cに示すような新たな c - P配列を得ることができる。
[0112] 上述したように、ステップ 2111の処理は、格納アドレス配列と親ノード識別子配列 を、格納アドレス配列中の無効値を省略して合成することにより、新たな C P配列を 得ることに相当する。
[0113] 図 25Aは、図 15と同じツリー型データ構造の例を視覚的に表した図であり、このッ リーから、ノード識別子「2」のノードを頂点ノードとする部分ツリーが削除されることを 示している。図 24Cに示す C P配列に基づいて、ツリー型データ構造を視覚的に 表すと、図 25Bに示すようになる。図 25Bを参照すると、ノード識別子「2」のノードお よびその子孫ノードであるノード識別子「6」のノードが削除された状態であり、本実施 の形態に力かるツリー削除が完了したことが示されている。
[0114] [ツリー挿入]
次に、ツリー型データ構造のトポロジーを編集する操作であるツリー挿入について 説明する。本発明にかかる「ツリー挿入」は、ツリーの特定ノードに、あるノードをルー ト 'ノードとする他のツリーを追加すること(つまり、ルート'ノードを頂点ノードとして、頂 点ノードおよびその子孫ノードを追加すること)を意味する。ここで、前者のツリーを被 挿入側ツリー、後者を挿入側ツリーと称する。実際には、被挿入側のツリー型データ 構造を表す、メモリ上に格納された C P配列、および、挿入側のツリー型データ構 造を表す、メモリ上に格納された C— P配列から、挿入側ツリーが挿入された状態で、 それぞれのノードのノード識別子が、幅優先モードにしたがって付されたような C— P 配列をメモリ中に生成することである。なお、被挿入側ツリーおよび Zまたは挿入側ッ リーが、単一のノードのみで構成されていても良い。
[0115] 以下、本実施の形態において、幅優先モードで、ツリー型データ構造が表され、幅 優先モードにしたがって、ツリーを構成するノードのノード識別子を格納した C— P配 列がメモリに記憶されている場合の、ツリーの挿入について説明する。
[0116] 図 26Aは、本実施の形態に力かる幅優先モードで表されたツリー型データ構造の 一例を視覚的に表す図である。図 26Aにおいては、ツリー型データ構造 2600を被 挿入側ツリーとし、当該被挿入側ツリーのノード識別子「1」のノードと、ノード識別子「 2」のノードとの間に、ノード識別子「0」のノード (ルート'ノード:符号 2601参照)を頂 点ノードとするツリーを挿入側ツリー (符号 2610参照)として、挿入することを考える。 すなわち、挿入側ツリーのノード識別子「0」のノードは、被挿入側ツリーのノード識別 子「0」のノードの子ノードとして連結される。本例では、被挿入側ツリーのノード識別 子「0」のノードには、既に、被挿入側ツリーのノード識別子「1」のノード及びノード識 別子「2」のノードが子ノードとして連結されて 、る。挿入側ツリーのノード識別子「0」 のノードは、この被挿入側ツリーのノード識別子「1」のノードより下位であり、ノード識 別子「2」のノードより上位である子ノードとして被挿入側ツリーのノード識別子「0」のノ 一ドの子ノードとして連結される。
[0117] 図 26Bは、ツリー 2600およびツリー 2610を、それぞれ、 C— P配列にて表したもの である。図 26Bに示すように、挿入前の段階では、それぞれのツリーは、幅優先モー ドにしたがって、そのノードに番号 (ノード識別子)が付され、その情報が、配列として メモリ中に記憶されている。たとえば、オペレータが、入力装置 24を操作して、表示 装置 26の画面上に表示された、図 26Aに示すようなツリー型データ構造を参照して 、ツリーの挿入位置 (符号 2602参照)を指定することができる。上記オペレータの指 定により、ツリー 2600に関する C— P配列において、ツリー 2610に関する C— P配列 の挿入位置を見出すことも可能である (符号 2621参照)。
[0118] 図 27は、本実施の形態に力かるツリー挿入の概略を示すフローチャートである。な お、オペレータによる入力装置 24の操作によって、被挿入側ツリーの C— P配列、揷 入側ツリーの C P配列、および、挿入側ツリーの頂点ノードを挿入すべき位置が予 め与えられている。挿入側ツリーの頂点ノードを挿入すべき位置は、たとえば、どのノ ードの子であるのかと!/、う情報 (挿入側ツリーの頂点ノードの親ノードとなる、被挿入 側ツリーのノード識別子)、および、挿入側ツリーの頂点ノードが、親ノードの何番目 の子であるかを示す情報により特定され得る。したがって、 CPU12は、オペレータの 入力にしたがって、これら情報を取得して、メモリ中に一時的に記憶しておけばよい。
[0119] 図 27に示すように、 CPU12は、まず、被挿入側ツリーに関して、挿入マーク配列を 生成する(ステップ 2701)。図 28は、挿入マーク配列の生成処理をより詳細に示すフ ローチャートである。図 28に示すように、 CPU12は、まず、被挿入側ツリーの C— P 配列と同じサイズの挿入マーク配列の領域をメモリ中に確保し (ステップ 2801)、それ ぞれの要素として初期値「0」を格納する(ステップ 2802)。 CPU12は、処理対象位 置を「0」に初期化して (ステップ 2803)、処理対象位置の値が、挿入位置直後のノー ド識別子と同じである力否かを判断する(ステップ 2804)。ステップ 2804でノー (No)と 判断された場合には、 CPU12は、被挿入側ツリーの C— P配列中、処理対象位置の 値、つまり、親ノードのノード識別子を参照し、挿入マーク配列中、当該親ノードのノ ード識別子の示す位置の要素がマークされて 、るか否か(つまり、値が「 1」であるか 否力 を判断する (ステップ 2805)。
[0120] ステップ 2804でイエス (Yes)と判断された場合、或!、は、ステップ 2805でイエス (Yes )と判断された場合には、 CPU12は、挿入マーク配列中、処理対象位置の値を「1」 にする(ステップ 2806)。 CPU12は、このような処理を、被挿入側ツリーの全てのノー ド識別子について実行する (ステップ 2807、 2808参照)。
[0121] 図 29は、被挿入側ツリーの C P配列、および、生成される挿入マーク配列(図中、 rinsert MarkJと表記して ヽる。)の例を示す図である。この例では、被挿入側ッリ 一において、ノード識別子「1」のノードと、ノード識別子「2」のノードとの間に、挿入側 ツリーが挿入されると考えている。図 29の挿入マーク配列に示すように、処理対象位 置が「0」、「1」であるときには、ステップ 2804およびステップ 2805でノー (No)と判断 される。その一方、処理対象位置が「2」であるときには、「2」という値は、挿入位置直 後のノード識別子と一致するため、ステップ 2804でイエス (Yes)と判断され、挿入マー ク配列中、格納位置番号「2」の値が「1」にセットされる(符号 2901参照)。
[0122] 処理対象位置が「3」、「4」のときには、ステップ 2804およびステップ 2805でノー (N 0)と判断される。処理対象位置が「5」のときには、 C P配列中、対応する格納位置 番号「5」の値が「2」であり、親ノードのノード識別子力「2」であることがわかる。 CPU1 2は、挿入マーク配列中、格納位置番号「2」の値力「l」であることから、ステップ 280 5でイエス (Yes)と判断される。したがって、挿入マーク配列中、格納位置番号「5」の 値が「1」にセットされる(符号 2902参照)。処理対象位置「6」〜「9」につ 、ても同様 の処理が実行されることで、最終的な挿入マーク配列を得ることができる。
[0123] CPU12は、被挿入側ツリー、挿入側ツリーのそれぞれにおいて、ツリーを構成する 各ノードの深さを示すレベル値を格納するレベル配列を、メモリ中に生成する(ステツ プ 2702)。同じ世代のノードは、同じレベル値を有する。たとえば、被挿入側ツリーに おいて、 C— P配列の先頭のノード(ルート'ノード)については、 CPU12は、レベル 配列中、レベル値「0」を格納する。それ以外のノードについては、 CPU12は、 C-P 配列を参照して、親ノードを特定し、当該親ノードのレベル値を参照して、そのレベル 値に「1」をカ卩えて、そのノードのレベル値を算出する。次いで、 CPU12は、レベル配 列中の対応する位置に、算出されたレベル値を格納する。
[0124] 挿入側ツリーについては、まず、 CPU12は、同様の処理を実行してレベル配列に 値を格納する。次いで、 CPU12は、メモリに一時的に記憶された、挿入側ツリーの頂 点ノードを挿入すべき位置を示す情報のうち、挿入側ツリーの頂点ノードの親ノードと なる、被挿入側ツリーのノードのノード識別子を参照して、当該ノード識別子に対応 するレベル配列の値 (これを親ノードのレベル値と称する)を取得する。さらに、 CPU 12は、挿入側ツリーのレベル配列の値のそれぞれに、「親ノードのレベル値 + 1」を 加算する。加算後のレベル値を格納したレベル配列力 挿入側ツリーのレベル配列 となる。
[0125] 図 30Aは被挿入側ツリーのレベル配列を説明する図である。図 30A、 Bにおいて は、レベル配列は、「Levels」と表記されている。先頭のノード(ノード識別子「0」のル ート 'ノード)については、レベル配列中のレベル値として「0」が格納される。引き続く 2つのノード (ノード識別子「1」、「2」のノード)については、それぞれ親ノードのノード 識別子が「0」であるため、「0」に「1」を加えた値「1」が、レベル値として、レベル配列 に格納されている。図 30Bは、挿入側ツリーのレベル配列を説明する図である。符号 3010に示す配列は、被挿入側ツリーと同様の処理が実行された状態の配列、符号 3020に示す配列は、さらに、それぞれのレベル値に、「親ノードのレベル値 + 1 = 1」 を加えた、最終的な配列の状態を示す。
[0126] CPU12は、被挿入側ツリーの C P配列、レベル配列および挿入マーク配列、並 びに、挿入側ツリーの C P配列およびレベル配列を参照して、それぞれのツリーに ついて、新規ノード識別子配列を生成する (ステップ 2703)。図 31および図 32は、 新規ノード識別子の生成をより詳細に示すフローチャートである。図 31に示すように 、 CPU12は、挿入側ツリーおよび被挿入側ツリーの双方に関して、それぞれの C— P配列と同じサイズの、新規ノード識別子配列の領域をメモリ中に確保する (ステップ 3101)。また、 CPU12は、カレントノード識別子領域(図中、「Current Node No .」と表記する。)をメモリ中に確保して、初期値「0」を格納し (ステップ 3102)、被挿 入側ツリー、挿入側ツリーの双方の処理対象位置を「0」に初期化する (ステップ 310 3)。
[0127] CPU12は、挿入マーク配列中、被挿入側の処理対象位置の値を参照し (ステップ 3104)、先の処理対象位置の値が「0」でかつ今回の処理対象位置の値力 「l」であ るかどうかを判断する (ステップ 3105)。なお、最初の処理では、挿入マーク配列の 値が「1」であれば、ステップ 3105でイエス (Yes)と判断される。ステップ 3105でノー (N 0)と判断された場合には、被挿入側の新規ノード識別子配列中、被挿入側処理対象 位置の値として、カレントノード識別子領域の値を格納する(ステップ 3106)。
[0128] その一方、ステップ 3105でイエス (Yes)と判断された場合には、処理対象が挿入側 ツリーに移行する。なお、この挿入側処理対象位置における挿入側ツリーのレベル 配列中のレベル値は、被挿入側処理対象位置における被挿入側ツリーのレベル配 列中のレベル値と同一となる。
[0129] より詳細には、図 32に示すように、 CPU12は、挿入側の新規ノード識別子配列中 、挿入側処理対象位置の値として、カレントノード識別子領域の値を格納する (ステツ プ 3201)。次いで、 CPU12は、カレントノード識別子領域の値をインクリメントすると ともに、挿入側処理対象位置もインクリメントする (ステップ 3202)。 CPU12は、新た な挿入側処理対象位置について、レベル配列の値を参照して、レベル配列の値が 変化したカゝ否かを判断する (ステップ 3203)。インクリメント前の挿入側処理対象位置 の、レベル配列の値と、インクリメント後の挿入側処理対象位置の、レベル配列の値と がー致していれば、ステップ 3203でノー (No)と判断されて、ステップ 3201に戻り、処 理が進められる。その一方、ステップ 3203でイエス (Yes)と判断された場合には、ステ ップ 3106に進む。
[0130] 被挿入側ツリーおよび挿入側ツリーにっ 、て、処理が終了したとき、つまり、それぞ れ新規ノード識別子配列への格納が完了したときに、ステップ 3107でイエス (Yes)と 判断される。それ以外の場合には、 CPU12は、カレントノード識別子領域の値をイン クリメントするとともに、被挿入側の処理対象位置をインクリメントする (ステップ 3108)
[0131] 図 33〜図 37Bを参照して、上記図 31および図 32の処理をより具体的に説明する 。図 33は、新規ノード識別子配列の領域や、初期値「0」が格納されたカレントノード 識別子領域が、メモリ中に確保された状態を示す。また、被挿入側ツリー、挿入側ッリ 一ともに、処理対象位置は「0」である。
[0132] 図 34Aに示すように、被挿入側の処理対象位置が「0」のときには、挿入マーク配列 中、その位置の値力 「0」であり、被挿入側の新規ノード識別子配列中、その格納位 置番号「0」の値として、カレントノード識別子領域の値「0」が格納される。その後、力 レントノード識別子領域の値力 Sインクリメントされて「1」になる。
[0133] 図 34Bに示すように、被挿入側の処理対象位置が「1」のときにも、挿入マーク配列 中、その位置の値が「0」であり、図 34Aに示すときの挿入マーク配列の値「0」と同じ く変化が無い。したがって、被挿入側の新規ノード識別子配列中、その格納位置番 号「1」の値として、カレントノード識別子領域の値「1」が格納される。その後、カレント ノード識別子領域の値力 Sインクリメントされて「2」になる。
[0134] 図 35Aに示すように、被挿入側の処理対象位置が「2」のときには、挿入マーク配列 中、その位置の値が「1」であり、図 34Bに示すときの挿入マーク配列の値「0」から変 化している。そこで、ステップ 3105でイエス (Yes)と判断される。したがって、挿入側ッ リーに関する処理に移り、挿入側の新規ノード識別子配列中、その格納位置番号「0 」の値として、カレントノード識別子領域の値「2」が格納される。その後、カレントノード 識別子領域の値力 Sインクリメントされて「3」になるとともに、挿入側の処理対象位置が インクリメントされて「1」となる。ここで、レベル配列中、挿入側の処理対象位置「1」の 値は「2」であり、インクリメント前の処理対象位置「0」のレベル配列の値「1」と同一で はない。したがって、図 31のステップ 3106の処理に移行し、新規ノード識別子配列 中、被挿入側の処理対象位置「2」の値として、カレントノード識別子領域の値「3」を 格納する。その後、カレントノード識別子領域の値はインクリメントされて「4」となる(図 35B参照)。
[0135] 図 36A、 Bに示すように、被挿入側の処理対象位置が「3」、「4」のときには、被挿入 側の新規ノード識別子配列に値が格納される。図 37Aに示すように、被挿入側の処 理対象位置が「5」のときには、挿入マーク配列の値が「1」に変化しているので、挿入 側の新規ノード識別子配列に値が格納され、その後、被挿入側の新規ノード識別子 配列に値が格納される。
[0136] このような処理を繰り返すことにより、図 37Bに示すように、被挿入側、挿入側のそ れぞれにお ヽて、ツリーの挿入による新たなノード識別子を格納した新規ノード識別 子配列を得ることができる。
[0137] 次 、で、 CPU12は、新規ノード識別子配列に基づ!/、て、被挿入側ツリーおよび挿 入側ツリーの C— P配列を、メモリ中に生成する(ステップ 2704)。それぞれの C— P 配列を取得するためには、被挿入側ツリーおよび挿入側ツリーのそれぞれにつ 、て 、図 21に示す処理と同様の処理を実行すればよい。実際には、格納アドレス算出処 理を実行する必要はなぐ CPU12は、親ノードのノード識別子の算出(図 21のステツ プ 2106〜2108)を実行すれば、被挿入側ツリーおよび挿入側ツリーのそれぞれの C P配列を求めることができる。なお、ここで、親ノード識別子配列のそれぞれの値 と、新規ノード識別子配列の同じ格納位置の値とを関連付けておく。
[0138] 図 38Aは、被挿入側について、新たな C— P配列が得られた状態を示す図、図 38 Bは、挿入側について新たな C— P配列が得られた状態を示す図である。なお、図 38 Bにおいて、挿入側については、 CPU12は、図 21のステップ 2106〜2108に示す 処理を実行して、新たな C— P配列 (符号 3801参照)を得て、その後、 CPU12は、 ルート'ノード (C— P配列の値が「一1」のノード)については、挿入したときに親ノード となるノードのノード識別子 (この例では「0」 )を格納する(符号 3802参照)。
[0139] さらに、 CPU12は、被挿入側ツリーおよび挿入側ツリーの新たな C— P配列をマー ジして、挿入後の C— P配列を生成する(ステップ 2705)。図 39に示すように、被揷 入側の新たな C— P配列 (符号 3901参照)においては、挿入側ツリーの親ノードのノ ード識別子が入るべき部分の値が存在せず、その一方、挿入側の新たな C P配列 (符号 3902参照)においても、被挿入側ツリーの親ノードのノード識別子が入るべき 部分の値が存在しない。したがって、無効値以外が格納されている部分を相互に利 用して配列を生成すれば、挿入後の C P配列となる (符号 3910参照)。
[0140] 図 40Aは、挿入側ツリー挿入前の、被挿入側ツリーを表す図である。図 39の符号 3 910に示す C— P配列によれば、図 40Aのツリーに、挿入側ツリーを挿入することに より、模式的には、図 40Bに示すようなトポロジーが得られる。これは、先に述べた幅 優先モードにしたがって 、ることは言うまでも無 、。
[0141] [実際のデータ管理]
上述したように、本実施の形態によれば、幅優先モードの下で、ツリー型データ構 造が表現されて!ヽる場合に、被挿入側ツリーに挿入側ツリーを挿入した状態にぉ ヽ ても、幅優先モードの下で、ツリー型データ構造が表現されるように、 C P配列を生 成している。この処理では、それぞれのノードのノード識別子が変更される。実際に は、図 2A、 Bを参照して説明したように、ツリー型データ構造においては、一つのッリ 一を構成するノードのそれぞれにノードタイプおよびノード値が関連付けられている。 ノードタイプは必須ではないが、当該ノードの値の意味を表すため(たとえば、図 2B においては、値「フランス店」が、「店名」であることを表している。)に存在する。 [0142] 図 41Aは、図 26Aなどで例示した、被挿入側ツリーを模式的に表す図である。図 4 1Bは、当該被挿入側ツリーを表す、メモリ中に記憶された C P配列、および、それ ぞれのノード識別子に関連付けられてメモリ中に記憶された、ノード値の格納配列の 例を示す図である。図 41Bに示すように、この例では、ノードには、「パーツ名」(図中 、「PARTS— NAME」と表記している)というノード値のみが格納され、ノードタイプ は設けられていない。図 41 Aにおいても、ノード識別子とともに、そのノード値を記載 している。例示したツリーは、模型飛行機 (TOY PLANE)の部品を示し、それぞれ のノードが、部品名を表している。
[0143] 図 42Aは、同様に、図 26Aなどで例示した、挿入側ツリーを模式的に表す図であ る。図 42Bは、当該挿入側ツリーを表す、メモリ中に記憶された C— P配列、および、 それぞれのノード識別子に関連付けられてメモリ中に記憶された、ノード値の格納配 列の例を示す図である。図 42Aにおいても、ノード識別子とともにそのノード値を記 載している。
[0144] 本実施の形態におけるツリー挿入処理によって、新たな C P配列が生成される。
CPU12は、図 38A、 Bにそれぞれ示す、被挿入側および挿入側新規ノード識別子 配列を参照することで、被挿入側ツリーのノード識別子が、挿入後のツリー構造にお いて、新たにどのようなノード識別子が与えられた力、或いは、挿入側ツリーのノード 識別子が、挿入後のツリー構造において、新たにどのようなノード識別子が与えられ たかを把握することができる。したがって、 CPU12は、新たな C— P配列の生成ととも に、新たなノード識別子に関連付けられたノード値を格納した格納配列を生成する。 図 43Aは、挿入後のツリーを模式的に示す図、図 43Bは、メモリに記憶された新たな C— P配列、および、メモリに記憶された新たなノード値の格納配列を示す図である。
[0145] 図 43Bに示すように、新たなノード値の格納配列を生成する際に、 CPU12は、被 挿入側ツリーのノード値の格納配列の挿入位置を特定し、当該挿入位置に、挿入側 ツリーのノード値の格納配列の挿入すべき値を挿入しても良い。或いは、 CPU12は 、新たに、ノード値の格納配列のための領域をメモリ中に確保し、新たなノード識別 子に対応する位置に、被挿入側ツリーのノード値の格納配列の値或 、は挿入側ッリ 一のノード値の格納配列の値の何れかを格納するような処理を実行しても良い。 [0146] 部分ツリーの削除の際にも、 CPU12は、同様に、新規ノード識別子配列(図 20参 照)を参照することで、部分ツリーの削除後に、削除によって残ったノードのそれぞれ に与えられた新たなノード識別子を知ることができる。したがって、 CPU12は、ノード 値の格納配列から削除位置の値を削除することが可能である。或いは、 CPU12は、 新たに、格納配列のための領域をメモリ中に確保し、新たなノード識別子に対応する 位置に、元の格納配列の値を格納するような処理を実行しても良 、。
[0147] [機能ブロックダイヤグラム]
図 44は、本発明の実施の形態に力かるツリー型データ構造を構築する情報処理装 置の機能ブロックダイヤグラムであるである。図 44に示すように、情報処理装置 4400 は、ツリー型データ構造を表現するデータを記憶する記憶部 4401と、本実施の形態 にかかる、ツリー型データ構造を表現するためのじ P配列を生成して記憶装置中に 記憶するツリー定義部 4402、ツリー挿入処理部 4403と、ツリー削除処理部 4404と 、を有する。
[0148] ツリー挿入処理部 4403は、オペレータが入力装置(図 44では図示せず)を操作し て入力した被挿入側ツリーおよび挿入側ツリーを特定する情報や、その挿入位置を 特定する情報に基づいて、記憶部 4401から処理対象となるツリーの C P配列など を読み出して、挿入後のツリー型データ構造を表現する C— P配列を生成して、当該 C— P配列を記憶部 4401に記憶する。また、ツリー挿入処理部 4403は、ノード値の 格納配列を、ツリーの挿入にしたがって更新し、或いは、ツリーの挿入に従った新た な格納配列を生成する。
[0149] ツリー削除処理部 4404は、オペレータが入力装置を操作して入力した削除対象と なる部分ツリーの頂点ノードのノード識別子に基づいて、記憶部 4401から、処理対 象となるツリーの C P配列などを読み出して、部分ツリーの削除後のツリー型データ 構造を表現する C— P配列を生成して、当該 C— P配列を記憶部 4401に記憶する。 また、ツリー削除処理部 4404は、ノード値の格納配列を、部分ツリーの削除にしたが つて更新し、或いは、部分ツリーの削除にしたがった新たな格納配列を生成する。
[0150] 本実施の形態においては、ノードに付与された固有のノード識別子は、子ノードより も同じ世代のノードを優先して付与された連続する整数である。また、被挿入側ッリ 一、挿入側ツリーのそれぞれにおいて、ノード間の親子関係は、非ルート'ノードの各 々に付与されたノード識別子の順に関連付けられた非ルート'ノードの各々の親ノー ドに付与されたノード識別子力 なる配列 C— P配列)によって表現される。ツリー定 義部 4402は、たとえば、記憶部 4401や他の記憶装置に記憶された、 XML形式で 与えられたツリーのデータを読み出して、ツリーを構成するノードについて、ノード識 別子を付与して、そのノード識別子ごとに、そのノードの親ノードのノード識別子を格 納した C— P配列を記憶部 4401に記憶する。また、ツリー定義部 4402は、 XML形 式で与えられたツリーのデータのうち、それぞれのノードに関連付けられた実データ( ノードタイプおよびノード値)を、ノード識別子と関連付けて格納した格納配列を生成 して、これを、記憶部 4401に記憶する。
[0151] 本発明は、以上の実施の形態に限定されることなぐ特許請求の範囲に記載された 発明の範囲内で、種々の変更が可能であり、それらも本発明の範囲内に包含される ものであることは言うまでもない。
[0152] たとえば、本実施の形態においては、ツリー削除を、子ノードよりも同じ世代のノード を優先する幅優先モードにしたがってツリー型データ構造を表現した構成に適用し ている。つまり、幅優先モードに基づいてノードの各々に付与されたノード識別子に 関する親子関係定義配列 (C— P配列)から、部分ツリー削除後の、幅優先モードに したがった新たな C— P配列を生成している。し力しながら、本発明に力かるツリー削 除は、同じ世代のノードよりも子ノードを優先する深さ優先モードにしたがってツリー 型データ構造を表現した構成にも適用可能である。
[0153] 図 45は、深さ優先モードで表されたツリー型データ構造の一例を示す図である。こ れは、図 15に示すツリー型データ構造のトポロジーと同一である。以下、図 45のッリ 一型データ構造において、符号 4501に示すノードを頂点ノードとする部分ツリーを 削除する場合を考える。
[0154] 図 46は、図 45に示すツリー型データ構造の親子関係を表す配列(C P配列)、初 期値が格納されたデリートフラグ配列、新規ノード識別子配列、および、初期値が配 置されたカレントノード識別子領域を示す図である。これは、幅優先モードにおける 図 17に対応する。図 46中のデリートフラグ配列は、図 16のステップ 1602が実行され た時点のものである。
[0155] 図 47は、深さ優先モードにおけるツリー削除処理を説明する図であり、図 16に示 す処理が終了した時点の、デリートフラグ配列、新規ノード識別子配列、カレントノー ド番号領域の状態を示して!/ヽる。
[0156] 図 48A、 Bは、それぞれ、図 21の処理を実行した場合の格納アドレス配列および親 ノード識別子配列を示し、図 48Cは、図 21のステップ 2111が実行されることにより得 られた、部分ツリー削除後の、深さ優先モードにしたがった新たな C— P配列を示す 図である。この C P配列に基づくツリー型データ構造のトポロジーは、図 49Bに示す ものとなる。部分ツリー削除前のツリー型データ構造を表す図 49Aと比較すると、符 号 4501に示すノードを頂点ノードとする部分ツリーが削除されていることがわかる。
[0157] なお、本発明にかかるツリー削除方法は、上記幅優先モード或いは深さ優先モード 以外にも適用可能である。実際には、
(1)初期値より連続する整数であり、
(2)親子関係のあるノードにっ 、て、親ノードのノード識別子は子ノードのノード識別 子より小さいように、
ノードにノード識別子が付与され、記憶装置に、各ノードの親ノードのノード識別子 を格納した親子関係定義配列 (C— P配列)を保持しておけば、本発明にかかるッリ 一削除方法を適用することができる。
図面の簡単な説明
[0158] [図 1]図 1は、本発明の実施の形態に力かるツリー型データ構造を取り扱う情報処理 装置のハードウェア構成を示すブロックダイヤグラムである。
[図 2]図 2A、 Bは、ツリー型データの一例である POSデータの説明図であり、図 2Aは 、このツリー型データのデータ構造 (即ち、トポロジー)及びデータ値を視覚的に表現 した例であり、図 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]図 14は、本発明の実施の形態にかかる、三つの表現形式の相互変換の関係 を示す図である。
[図 15]図 15は、本実施の形態に力かる幅優先モードで表されたツリー型データ構造 の一例を模式的に表す図である。
[図 16]図 16は、本実施の形態に力かるツリー削除処理の前半 (ツリー削除処理(1) ) を示すフローチャートである。
[図 17]図 17は、図 15に示すツリー型データ構造の親子関係を表す配列、初期値が 格納されたデリートフラグ配列、新規ノード識別子配列、および、初期値が配置され たカレントノード識別子領域を示す図である。
[図 18]図 18A、 Bは、本実施の形態に力かるツリー削除処理を説明する図である。 [図 19]図 19A、 Bは、本実施の形態に力かるツリー削除処理を説明する図である。
[図 20]図 20は、本実施の形態に力かるツリー削除処理を説明する図である。
[図 21]図 21は、ツリー削除後の C— P配列の生成のための処理 (ツリー削除処理(2) )を示すフローチャートである。
[図 22]図 22A〜Dは、ステップ 2103およびステップ 2104にて実行される処理を具体 的に説明する図である。
[図 23]図 23A〜Dは、ステップ 2106〜2108にて実行される処理を具体的に説明す る図である。
[図 24]図 24Aおよび Bは、それぞれ、図 22A〜Dの処理で得られた格納アドレス配 列、および、図 23A〜Dの処理で得られた親ノード識別子配列の例、図 24Cは、格 納アドレス配列および親ノード識別子配列に基づ!/、て得られた新たな C P配列で ある。
[図 25]図 25Aは、図 15と同じツリー型データ構造の例を視覚的に表した図、図 25B は、図 24Cに示す C— P配列に基づいて、ツリー型データ構造を視覚的に表した図 である。
[図 26]図 26A、 Bは、本実施の形態にかかる、被挿入側ツリーおよび挿入側ツリーの 例を示す図である。
[図 27]図 27は、本実施の形態に力かるツリー挿入の概略を示すフローチャートであ る。
[図 28]図 28は、挿入マーク配列の生成処理をより詳細に示すフローチャートである。
[図 29]図 29は、被挿入側ツリーの C P配列、および、生成される挿入マーク配列の 例を示す図である。
[図 30]図 30A、 Bは、それぞれ、被挿入側ツリーおよび挿入側ツリーのレベル配列を 説明する図である。
圆 31]図 31は、新規ノード識別子の生成をより詳細に示すフローチャートである。 圆 32]図 32は、新規ノード識別子の生成をより詳細に示すフローチャートである。 圆 33]図 33は、新規ノード識別子の生成を具体的に説明する図である。
[図 34]図 34A、 Bは、新規ノード識別子の生成を具体的に説明する図である。 [図 35]図 35A、 Bは、新規ノード識別子の生成を具体的に説明する図である。
[図 36]図 36A、 Bは、新規ノード識別子の生成を具体的に説明する図である。
[図 37]図 37A、 Bは、新規ノード識別子の生成を具体的に説明する図である。
[図 38]図 38Aは、被挿入側について、新たな C— P配列が得られた状態を示す図、 図 38Bは、挿入側につ!、て新たな C— P配列が得られた状態を示す図である。
[図 39]図 39は、挿入側ツリーの挿入後の C P配列を示す図である。
[図 40]図 40Aは、挿入側ツリー挿入前の、被挿入側ツリーを視覚的に表す図、図 40
Bは、挿入側ツリーの挿入後のツリーを視覚的に表す図である。
[図 41]図 41Aは、被挿入側ツリーを模式的に表す図、図 41Bは、当該被挿入側ッリ 一を表す、メモリ中に記憶された C P配列、および、それぞれのノード識別子に関 連付けられてメモリ中に記憶された、ノード値の格納配列の例を示す図である。
[図 42]図 42Aは、挿入側ツリーを模式的に表す図である。図 42Bは、当該挿入側ッリ 一を表す、メモリ中に記憶された C P配列、および、それぞれのノード識別子に関 連付けられてメモリ中に記憶された、ノード値の格納配列の例を示す図である。
[図 43]図 43Aは、挿入後のツリーを模式的に示す図、図 43Bは、メモリに記憶された 新たな C P配列、および、メモリに記憶された新たなノード値の格納配列を示す図 である。
[図 44]図 44は、本発明の実施の形態に力かるツリー型データ構造を構築する情報処 理装置の機能ブロックダイヤグラムであるである。
[図 45]図 45は、本実施の形態に力かる深さ優先モードで表されたツリー型データ構 造の一例を示す図である。
[図 46]図 46は、図 45に示すツリー型データ構造の親子関係を表す配列、初期値が 格納されたデリートフラグ配列、新規ノード識別子配列、および、初期値が配置され たカレントノード識別子領域を示す図である。
圆 47]図 47は、深さ優先モードにおけるツリー削除処理を説明する図である。
[図 48]図 48Aおよび Bは、それぞれ、図 22A〜Dの処理で得られた格納アドレス配 列、および、図 23A〜Dの処理で得られた親ノード識別子配列の例、図 48Cは、部 分ツリー削除後の C— P配列を示す図である。 [図 49]図 49A、 Bは、深さ優先モードにおけるツリー削除処理を説明する図である 符号 〇の説明
情報処理装置
12 CPU
14 RAM
16 ROM
18 固定記憶装置
20 ドライ/く
22 I/F
24 入力装置
26 表示装置
4400 情報処理装置
4401
4402 ツリー定義部
4403 ツリー挿入処理部
4404 ツリー削除処理部

Claims

請求の範囲
[1] ツリー型データ構造を形成するすべてのノードに固有のノード識別子が付与され、 前記ノード識別子が、ルート'ノードから始めて、親子関係のある親ノードと子ノードと の間では前記親ノードのノード識別子が前記子ノードのノード識別子より小さいという 関係を満たす連続する整数であり、前記ルート'ノード以外の非ルート'ノードの各々 のノード識別子に関連付けられた親ノードのノード識別子が格納された親子関係定 義配列を記憶する記憶装置を備えた情報処理装置において、
第 1のツリーから、前記第 1のツリーの特定のノードと当該特定のノードの子孫ノード とからなる部分ツリーを削除する情報処理方法であって、
前記第 1のツリーの親子関係定義配列を前記記憶装置から読み出すステップと、 初期値がセットされた消去フラグ配列を前記記憶装置に格納し、前記特定のノード のノード識別子および前記親子関係定義配列と前記消去フラグ配列とを参照して、 前記部分ツリーの前記特定のノードおよびその子孫のノードに付与されたノード識別 子に対応する前記消去フラグ配列中のフラグをセットするステップと、
前記第 1のツリー力 前記部分ツリーを削除したツリーである第 2のツリーのすべて のノードに新たなノード識別子を付与し、前記新たなノード識別子が前記第 1のッリ 一の前記ノード識別子に関連付けて格納された新規ノード識別子配列を前記記憶 装置に生成するステップと、
前記親子関係定義配列および前記新規ノード識別子配列に基づいて、前記第 2の ツリーの非ルート'ノードの各々の前記新たなノード識別子に関連付けられた親ノード の各々の前記新たなノード識別子が格納された前記第 2のツリーの新たな親子関係 定義配列を前記記憶装置に生成するステップと、
を備えることを特徴とする情報処理方法。
[2] 前記記憶装置に、前記ツリーのノードのノード識別子の各々に関連付けて、当該ノ ードの少なくともノード値を格納したノード値格納配列が記憶され、
前記新規ノード識別子配列を参照して、もとのノード識別子と新たなノード識別子と の関連付けにしたがって、前記ノード値格納配列を更新するステップを備えたことを 特徴とする請求項 1に記載の情報処理方法。 [3] 前記記憶装置に、前記ツリーのノードのノード識別子の各々に関連付けて、当該ノ ードの少なくともノード値を格納したノード値格納配列が記憶され、
前記新規ノード識別子配列を参照して、もとのノード識別子と新たなノード識別子と の関連付けにしたがって、新たなノード識別子の各々と関連付けて、前記ノード値を 格納した、新たなノード値格納配列を生成するステップを備えたことを特徴とする請 求項 1に記載の情報処理方法。
[4] 前記新規ノード識別子配列を生成するステップが、
前記親子関係定義配列と同一のサイズの新規ノード識別子配列のための領域を、 前記記憶装置中に確保するステップと、
新たなノード識別子を一時的に記憶するカレントノード識別子領域を、前記記憶装 置中に確保して、その初期値を格納するステップと、
前記消去フラグ配列を参照して、前記消去フラグ配列のフラグがセットされて 、な 、 場合には、当該新規ノード識別子配列の値として、前記カレントノード識別子領域の 値を格納し、その後、前記カレントノード識別子領域の値を増分し、その一方、消去 フラグ配列のフラグがセットされている場合には、当該新規ノード識別子配列の値とし て無効値を格納するステップと、を備えたことを特徴とする請求項 1な 、し 3の何れか 一項に記載の情報処理方法。
[5] 前記部分ツリー削除後の親子関係定義配列を生成するステップが、
前記親子関係定義配列と同一サイズの格納アドレス配列のための領域を、前記記 憶装置中に確保するステップと、
前記新規ノード識別子配列中、前記親子関係定義配列の値の格納位置と同じ位 置の値を参照して、値が無効値である場合を除き、前記格納アドレス配列に、前記新 規ノード識別子配列中の値を格納するステップと、
前記親子関係定義配列と同一サイズの親ノード識別子配列のための領域を、前記 記憶装置中に確保するステップと、
前記新規ノード識別子配列中、前記親子関係定義配列の値が示す位置の値を参 照して、前記親ノード識別子配列中、前記親子関係定義配列の値の位置と同じ位置 に、前記新規ノード識別子配列の値を格納するステップと、 前記格納アドレス配列中の値に関連付けて、前記親ノード識別子配列の値を格納 した親子関係定義配列を生成するステップと、を含むことを特徴とする請求項 1な ヽ し 4の何れか一項に記載の情報処理方法。
ツリー型データ構造を形成するすべてのノードに固有のノード識別子が付与され、 前記ノード識別子が、ルート'ノードから始めて、子ノードよりも同じ世代のノードを優 先して付与された連続する整数であり、前記ルート'ノード以外の非ルート ·ノードの 各々のノード識別子に関連付けられた親ノードのノード識別子が格納された親子関 係定義配列を記憶する記憶装置を備えた情報処理装置において、
第 1のツリーの所定のノードの子孫ノード群として第 2のツリーを挿入することにより 形成された第 3のツリーのツリー型データ構造について、前記記憶装置中に新たな 親子関係定義配列を生成する情報処理方法であって、
前記第 1のツリーの第 1の親子関係定義配列および前記第 2のツリーの第 2の親子 関係定義配列を前記記憶装置から読み出すステップと、
前記第 2のツリーのルート'ノードを前記第 1のツリーの前記所定のノードの所定の 順位の子ノードとして連結することにより形成される前記第 3のツリーの世代毎に、前 記第 2のツリーに属するノードに隣接する前記第 1のツリーに属するノードを特定し、 前記第 1のツリーに属する前記特定されたノードの情報を前記記憶装置に記憶する ステップと、
前記記憶装置に記憶された前記第 1のツリーに属する前記特定されたノードの情 報を参照して、前記第 3のツリーのすべてのノードに、ルート'ノード力 始めて、子ノ ードよりも同じ世代のノードを優先して連続する整数である新たなノード識別子を付 与し、前記第 1のツリーに属するノードに付与された前記新たなノード識別子を前記 第 1のツリーのノードのノード識別子に関連付けて格納した第 1の新規ノード識別子 配列、および、前記第 2のツリーに属するノードに付与された前記新たなノード識別 子を前記第 2のツリーのノード識別子に関連付けて格納した第 2の新規ノード識別子 配列を前記記憶装置に生成するステップと、
前記第 1の親子関係定義配列および第 2の親子関係定義配列と前記第 1の新規ノ ード識別子配列および前記第 2の新規ノード識別子配列に基づいて、前記第 3のッ リーの非ルート'ノードの前記新たなノード識別子に関連付けて前記第 3のツリーの前 記非ルート'ノードのノード識別子を格納することにより、前記新たな親子関係定義配 列を前記記憶装置に生成するステップと、
を備えたことを特徴とする情報処理方法。
[7] 前記記憶装置に、前記第 1のツリーのノードのノード識別子の各々に関連付けて、 当該ノードの少なくともノード値を格納した第 1のノード値格納配列が記憶され、前記 第 2のツリーのノードのノード識別子の各々に関連付けて、当該ノードの少なくともノ 一ド値を格納した第 2のノード値格納配列が記憶され、
前記第 1および第 2の新規ノード識別子配列を参照して、前記第 1のツリーおよび 前記第 2のツリーのそれぞれのノード識別子と、前記第 3のツリーの新たなノード識別 子との関連付けにしたがって、前記第 1のノード値格納配列および第 2のノード配列 の少なくとも一方を更新するステップを備えたことを特徴とする請求項 6に記載の情 報処理方法。
[8] 前記記憶装置に、前記第 1のツリーのノードのノード識別子の各々に関連付けて、 当該ノードの少なくともノード値を格納した第 1のノード値格納配列が記憶され、前記 第 2のツリーのノードのノード識別子の各々に関連付けて、当該ノードの少なくともノ 一ド値を格納した第 2のノード値格納配列が記憶され、
前記第 1および第 2の新規ノード識別子配列を参照して、前記第 1のツリーおよび 前記第 2のツリーのそれぞれのノード識別子と、前記第 3のツリーの新たなノード識別 子との関連付けにしたがって、前記新たなノード識別子の各々と関連付けて前記ノー ド値を格納した新たなノード値格納配列を生成するステップをさらに備えたことを特徴 とする請求項 6に記載の情報処理方法。
[9] 前記第 1のツリーに属する前記特定されたノードの情報を前記記憶装置に記憶す るステップが、
前記第 2のツリーの前記ルート'ノードが挿入される位置の情報に基づいて、前記 第 1の親子関係定義配列と同一のサイズの挿入マーク配列中、前記挿入される位置 の直後のノードおよび前記直後のノードを先祖とするノードについて、当該挿入位置 であることを示す値を格納するステップを含むことを特徴とする請求項 6ないし 8の何 れか一項に記載の情報処理方法。
さらに、前記第 1のツリーの各ノードの、当該第 1のツリーのルート'ノード力 の深さ のレベルを表すレベル値を格納した第 1のレベル配列を、前記記憶装置に生成する ステップと、
前記第 1のレベル配列中、前記第 2のツリーのルート'ノードの挿入位置に相当する レベル値を参照して、前記第 2のツリーの各ノードの、前記第 1のツリーのルート'ノー ドカゝらの深さのレベルを表すレベル値を格納した第 2のレベル配列を、前記記憶装 置に生成するステップと、を備え、
前記第 1の新規ノード識別子配列および前記第 2の新規ノード識別子配列を生成 するステップが、
前記第 1の親子関係定義配列および前記第 2の親子関係定義配列と、それぞれ、 同一のサイズである前記第 1の新規ノード識別子配列および前記第 2の新規ノード識 別子配列のための領域を、前記記憶装置中に確保するステップと、
新たなノード識別子を一時的に記憶するカレントノード識別子領域を、前記記憶装 置中に確保して、その初期値を格納するステップと、を含み、
前記挿入マーク配列中、その値が、挿入位置であることを示す値に変化している位 置以外の位置においては、
(a)前記第 1の新規ノード識別子配列中、当該位置の値として、前記カレントノード識 別子領域の値を格納し、
(b)その後、前記カレントノード識別子領域の値を増分する
ステップを、さらに含み、
前記挿入マーク配列中、当該挿入マーク配列の値力 挿入位置であることを示す 値に変化する位置においては、
(a)前記第 1のレベル配列中、当該位置のレベル値を参照し、かつ、前記第 2のレべ ル配列中、同一のレベル値を有する範囲を特定し、
(b)前記第 2の新規ノード識別子配列中、当該範囲の先頭位置力 順次、カレントノ ード識別子領域の値を格納し、
(c)その後、前記カレントノード識別子領域の値を増分し、 (d)前記第 2の新規ノード識別子配列中、前記同一のレベル値を有する範囲への値 の格納が終了すると、第 1の新規ノード識別子配列の値として、前記カレントノード識 別子領域の値を格納し、
(e)その後、前記カレントノード識別子領域の値を増分する
ステップを、さらに含むことを特徴とする請求項 9に記載の情報処理方法。
[11] 前記新たな親子関係定義配列を生成するステップが、
前記新たな親子関係定義配列と少なくとも同一サイズである第 1の親ノード識別子 配列のための領域および第 2の親ノード識別子配列のための領域を前記記憶装置 中に確保するステップと、
前記第 1の親子関係定義配列によって関連付けられている子ノードのノード識別子 および親ノードのノード識別子を、前記第 1の新規ノード識別子配列を用いて、前記 子ノードの新たなノード識別子及び前記親ノードの新たなノード識別子に変換するス テツプと、
前記第 1の親ノード識別子配列中の前記子ノードの新たなノード識別子の値に対 応する位置に前記親ノードの新たなノード識別子を格納するステップと、
前記第 2の親子関係定義配列によって関連付けられている子ノードのノード識別子 および親ノードのノード識別子を、前記第 2の新規ノード識別子配列を用いて、前記 子ノードの新たなノード識別子及び前記親ノードの新たなノード識別子に変換するス テツプと、
前記第 2の親ノード識別子配列中の前記子ノードの新たなノード識別子の値に対 応する位置に前記親ノードの新たなノード識別子を格納するステップと、
前記第 1の親ノード識別子配列および前記第 2の親ノード識別子配列を重ね合わ せることにより前記新たな親子関係定義配列を生成するステップと、を含むことを特 徴とする請求項 6ないし 10の何れか一項に記載の情報処理方法。
[12] ツリー型データ構造を形成するすべてのノードに固有のノード識別子が付与され、 前記ノード識別子が、ルート'ノードから始めて、親子関係のある親ノードと子ノードと の間では前記親ノードのノード識別子が前記子ノードのノード識別子より小さいという 関係を満たす連続する整数であり、前記ルート'ノード以外の非ルート'ノードの各々 のノード識別子に関連付けられた親ノードのノード識別子が格納された親子関係定 義配列を記憶する記憶装置を備え、
第 1のツリーから、前記第 1のツリーの特定のノードと当該特定のノードの子孫ノード とからなる部分ツリーを削除するように構成された情報処理装置であって、
前記第 1のツリーの親子関係定義配列を前記記憶装置から読み出すデータ読み 出し手段と、
初期値がセットされた消去フラグ配列を前記記憶装置に格納し、前記特定のノード のノード識別子および前記親子関係定義配列と前記消去フラグ配列とを参照して、 前記部分ツリーの前記特定のノードおよびその子孫のノードに付与されたノード識別 子に対応する前記消去フラグ配列中のフラグをセットする消去フラグ配列生成手段と 前記第 1のツリー力 前記部分ツリーを削除したツリーである第 2のツリーのすべて のノードに新たなノード識別子を付与し、前記新たなノード識別子が前記第 1のッリ 一の前記ノード識別子に関連付けて格納された新規ノード識別子配列を前記記憶 装置に生成する新規ノード識別子配列生成手段と、
前記親子関係定義配列および前記新規ノード識別子配列に基づいて、前記第 2の ツリーの非ルート'ノードの各々の前記新たなノード識別子に関連付けられた親ノード の各々の前記新たなノード識別子が格納された前記第 2のツリーの新たな親子関係 定義配列を前記記憶装置に生成する親子関係配列生成手段と、
を備えたことを特徴とする情報処理装置。
[13] 前記記憶装置に、前記ツリーのノードのノード識別子の各々に関連付けて、当該ノ ードの少なくともノード値を格納したノード値格納配列が記憶され、
前記新規ノード識別子配列を参照して、もとのノード識別子と新たなノード識別子と の関連付けにしたがって、前記ノード値格納配列を更新するノード値格納配列更新 手段を備えたことを特徴とする請求項 12に記載の情報処理装置。
[14] 前記記憶装置に、前記ツリーのノードのノード識別子の各々に関連付けて、当該ノ ードの少なくともノード値を格納したノード値格納配列が記憶され、
前記新規ノード識別子配列を参照して、もとのノード識別子と新たなノード識別子と の関連付けにしたがって、新たなノード識別子の各々と関連付けて、前記ノード値を 格納した、新たなノード値格納配列を生成するノード値格納配列生成手段を備えた ことを特徴とする請求項 12に記載の情報処理装置。
[15] 前記新規ノード識別子配列生成手段が、
前記親子関係定義配列と同一のサイズの新規ノード識別子配列のための領域を、 前記記憶装置中に確保し、
新たなノード識別子を一時的に記憶するカレントノード識別子領域を、前記記憶装 置中に確保して、その初期値を格納し、
前記消去フラグ配列を参照して、前記消去フラグ配列のフラグがセットされて 、な 、 場合には、当該新規ノード識別子配列の値として、前記カレントノード識別子領域の 値を格納し、その後、前記カレントノード識別子領域の値を増分し、その一方、消去 フラグ配列のフラグがセットされている場合には、当該新規ノード識別子配列の値とし て無効値を格納するように構成されたことを特徴とする請求項 14ないし 18の何れか 一項に記載の情報処理装置。
[16] 前記削除後親子関係定義配列生成手段が、
前記親子関係定義配列と同一サイズの格納アドレス配列のための領域を、前記記 憶装置中に確保し、
前記新規ノード識別子配列中、前記親子関係定義配列の値の格納位置と同じ位 置の値を参照して、値が無効値である場合を除き、前記格納アドレス配列に、前記新 規ノード識別子配列中の値を格納し、
前記親子関係定義配列と同一サイズの親ノード識別子配列のための領域を、前記 記憶装置中に確保し、
前記新規ノード識別子配列中、前記親子関係定義配列の値が示す位置の値を参 照して、前記親ノード識別子配列中、前記親子関係定義配列の値の位置と同じ位置 に、前記新規ノード識別子配列の値を格納し、
前記格納アドレス配列中の値に関連付けて、前記親ノード識別子配列の値を格納 した親子関係定義配列を生成するように構成されたことを特徴とする請求項 12ない し 15の何れか一項に記載の情報処理装置。 ツリー型データ構造を形成するすべてのノードに固有のノード識別子が付与され、 前記ノード識別子が、ルート'ノードから始めて、子ノードよりも同じ世代のノードを優 先して付与された連続する整数であり、前記ルート'ノード以外の非ルート ·ノードの 各々のノード識別子に関連付けられた親ノードのノード識別子が格納された親子関 係定義配列を記憶する記憶装置を備え、
第 1のツリーの所定のノードの子孫ノード群として第 2のツリーを挿入することにより 形成された第 3のツリーのツリー型データ構造について、前記記憶装置中に新たな 親子関係定義配列を生成するように構成された情報処理装置であって、
前記第 1のツリーの第 1の親子関係定義配列および前記第 2のツリーの第 2の親子 関係定義配列を前記記憶装置から読み出すデータ読み出し手段と、
前記第 2のツリーのルート'ノードを前記第 1のツリーの前記所定のノードの所定の 順位の子ノードとして連結することにより形成される前記第 3のツリーの世代毎に、前 記第 2のツリーに属するノードに隣接する前記第 1のツリーに属するノードを特定し、 前記第 1のツリーに属する前記特定されたノードの情報を前記記憶装置に記憶する 挿入位置情報生成手段と、
前記記憶装置に記憶された前記第 1のツリーに属する前記特定されたノードの情 報を参照して、前記第 3のツリーのすべてのノードに、ルート'ノード力 始めて、子ノ ードよりも同じ世代のノードを優先して連続する整数である新たなノード識別子を付 与し、前記第 1のツリーに属するノードに付与された前記新たなノード識別子を前記 第 1のツリーのノードのノード識別子に関連付けて格納した第 1の新規ノード識別子 配列、および、前記第 2のツリーに属するノードに付与された前記新たなノード識別 子を前記第 2のツリーのノード識別子に関連付けて格納した第 2の新規ノード識別子 配列を前記記憶装置に生成する新規ノード識別子配列生成手段と、
前記第 1の親子関係定義配列および第 2の親子関係定義配列と前記第 1の新規ノ ード識別子配列および前記第 2の新規ノード識別子配列に基づいて、前記第 3のッ リーの非ルート'ノードの前記新たなノード識別子に関連付けて前記第 3のツリーの前 記非ルート'ノードのノード識別子を格納することにより、前記新たな親子関係定義配 列を前記記憶装置に生成する親子関係定義配列生成手段と、 を備えたことを特徴とする情報処理装置。
[18] 前記記憶装置に、前記第 1のツリーのノードのノード識別子の各々に関連付けて、 当該ノードの少なくともノード値を格納した第 1のノード値格納配列が記憶され、前記 第 2のツリーのノードのノード識別子の各々に関連付けて、当該ノードの少なくともノ 一ド値を格納した第 2のノード値格納配列が記憶され、
前記第 1および第 2の新規ノード識別子配列を参照して、前記第 1のツリーおよび 前記第 2のツリーのそれぞれのノード識別子と、前記第 3のツリーの新たなノード識別 子との関連付けにしたがって、前記第 1のノード値格納配列および第 2のノード配列 の少なくとも一方を更新するノード値格納配列更新手段を備えたことを特徴とする請 求項 17に記載の情報処理装置。
[19] 前記記憶装置に、前記第 1のツリーのノードのノード識別子の各々に関連付けて、 当該ノードの少なくともノード値を格納した第 1のノード値格納配列が記憶され、前記 第 2のツリーのノードのノード識別子の各々に関連付けて、当該ノードの少なくともノ 一ド値を格納した第 2のノード値格納配列が記憶され、
前記第 1および第 2の新規ノード識別子配列を参照して、前記第 1のツリーおよび 前記第 2のツリーのそれぞれのノード識別子と、前記第 3のツリーの新たなノード識別 子との関連付けにしたがって、前記新たなノード識別子の各々と関連付けて前記ノー ド値を格納した新たなノード値格納配列を生成するノード値格納配列生成手段をさら に備えたことを特徴とする請求項 17に記載の情報処理装置。
[20] 前記挿入位置情報生成手段が、
前記第 2のツリーのルート'ノードが挿入される位置の情報に基づいて、前記第 1の 親子関係定義配列と同一のサイズの挿入マーク配列中、前記挿入される位置の直 後のノードおよび前記直後のノードを先祖とするノードにっ 、て、当該挿入位置であ ることを示す値を格納するように構成されたことを特徴とする請求項 17ないし 19の何 れか一項に記載の情報処理装置。
[21] さらに、前記第 1のツリーの各ノードの、当該第 1のツリーのルート'ノード力もの深さ のレベルを表すレベル値を格納した第 1のレベル配列を、前記記憶装置に生成する 第 1のレベル配列生成手段と、 前記第 1のレベル配列中、前記第 2のツリーの頂点ノードの挿入位置に相当するレ ベル値を参照して、前記第 2のツリーの各ノードの、前記第 1のツリーのルート'ノード からの深さのレベルを表すレベル値を格納した第 2のレベル配列を、前記記憶装置 に生成する第 2のレベル配列生成手段と、を備え、
前記新規ノード識別子配列生成手段が、
前記第 1の親子関係配列および前記第 2の親子関係定義配列と、それぞれ、同一 のサイズである前記第 1の新規ノード識別子配列および前記第 2の新規ノード識別子 配列のための領域を、前記記憶装置中に確保し、
新たなノード識別子を一時的に記憶するカレントノード識別子領域を、前記記憶装 置中に確保して、その初期値を格納するように構成され、
前記挿入マーク配列中、その値が、挿入位置であることを示す値に変化している位 置以外の位置においては、
(a)前記第 1の新規ノード識別子配列中、当該位置の値として、前記カレントノード識 別子領域の値を格納するとともに、
(b)その後、前記カレントノード識別子領域の値を増分するように構成され、 前記挿入マーク配列中、当該挿入マーク配列の値力 挿入位置であることを示す 値に変化する位置においては、
(a)前記第 1のレベル配列中、当該位置のレベル値を参照し、かつ、前記第 2のレべ ル配列中、同一のレベル値を有する範囲を特定し、
(b)前記第 2の新規ノード識別子配列中、当該範囲の先頭位置力 順次、カレントノ ード識別子領域の値を格納し、
(c)その後、前記カレントノード識別子領域の値を増分し、
(d)前記第 2の新規ノード識別子配列中、前記同一のレベル値を有する範囲への値 の格納が終了すると、第 1の新規ノード識別子配列の値として、前記カレントノード識 別子領域の値を格納し、
(e)その後、前記カレントノード識別子領域の値を増分するように構成されたことを特 徴とする請求項 20に記載の情報処理装置。
前記挿入後親子関係定義配列生成手段が、 前記新たな親子関係定義配列と少なくとも同一サイズである第 1の親ノード識別子 配列のための領域および第 2の親ノード識別子配列のための領域を前記記憶装置 中に確保し、
前記第 1の親子関係定義配列によって関連付けられている子ノードのノード識別子 および親ノードのノード識別子を、前記第 1の新規ノード識別子配列を用いて、前記 子ノードの新たなノード識別子及び前記親ノードの新たなノード識別子に変換し、 前記第 1の親ノード識別子配列中の前記子ノードの新たなノード識別子の値に対 応する位置に前記親ノードの新たなノード識別子を格納し、
前記第 2の親子関係定義配列によって関連付けられている子ノードのノード識別子 および親ノードのノード識別子を、前記第 2の新規ノード識別子配列を用いて、前記 子ノードの新たなノード識別子及び前記親ノードの新たなノード識別子に変換し、 前記第 2の親ノード識別子配列中の前記子ノードの新たなノード識別子の値に対 応する位置に前記親ノードの新たなノード識別子を格納し、
前記第 1の新規ノード識別子配列の値および前記第 2の新規ノード識別子配列の 値のそれぞれに関連付けられた、前記第 1の親ノード識別子配列の値および前記第 2の親ノード識別子配列の値を重ね合わせることにより前記新たな、挿入後の親子関 係定義配列を生成に格納するように構成されたことを特徴とする請求項 17ないし 21 の何れか一項に記載の情報処理装置。
ツリー型データ構造を形成するすべてのノードに固有のノード識別子が付与され、 前記ノード識別子が、ルート'ノードから始めて、親子関係のある親ノードと子ノードと の間では前記親ノードのノード識別子が前記子ノードのノード識別子より小さいという 関係を満たす連続する整数であり、前記ルート'ノード以外の非ルート'ノードの各々 のノード識別子に関連付けられた親ノードのノード識別子が格納された親子関係定 義配列を記憶する記憶装置を備えたコンピュータにおいて、
第 1のツリーから、前記第 1のツリーの特定のノードと当該特定のノードの子孫ノード とからなる部分ツリーを削除するために、前記コンピュータにより読み出し可能な情報 処理プログラムであって、前記コンピュータに、
前記第 1のツリーの親子関係定義配列を前記記憶装置から読み出すステップと、 初期値がセットされた消去フラグ配列を前記記憶装置に格納し、前記特定のノード のノード識別子および前記親子関係定義配列と前記消去フラグ配列とを参照して、 前記部分ツリーの前記特定のノードおよびその子孫のノードに付与されたノード識別 子に対応する前記消去フラグ配列中のフラグをセットするステップと、
前記第 1のツリー力 前記部分ツリーを削除したツリーである第 2のツリーのすべて のノードに新たなノード識別子を付与し、前記新たなノード識別子が前記第 1のッリ 一の前記ノード識別子に関連付けて格納された新規ノード識別子配列を前記記憶 装置に生成するステップと、
前記親子関係定義配列および前記新規ノード識別子配列に基づいて、前記第 2の ツリーの非ルート'ノードの各々の前記新たなノード識別子に関連付けられた親ノード の各々の前記新たなノード識別子が格納された前記第 2のツリーの新たな親子関係 定義配列を前記記憶装置に生成するステップと、
を実行させることを特徴とする情報処理プログラム。
[24] 前記記憶装置に、前記ツリーのノードのノード識別子の各々に関連付けて、当該ノ ードの少なくともノード値を格納したノード値格納配列が記憶され、前記コンピュータ に、
前記新規ノード識別子配列を参照して、もとのノード識別子と新たなノード識別子と の関連付けにしたがって、前記ノード値格納配列を更新するステップを実行させるこ とを特徴とする請求項 23に記載の情報処理プログラム。
[25] 前記記憶装置に、前記ツリーのノードのノード識別子の各々に関連付けて、当該ノ ードの少なくともノード値を格納したノード値格納配列が記憶され、前記コンピュータ に、
前記新規ノード識別子配列を参照して、もとのノード識別子と新たなノード識別子と の関連付けにしたがって、新たなノード識別子の各々と関連付けて、前記ノード値を 格納した、新たなノード値格納配列を生成するステップを実行させることを特徴とする 請求項 23に記載の情報処理プログラム。
[26] 前記新規ノード識別子配列を生成するステップにおいて、前記コンピュータに、 前記親子関係定義配列と同一のサイズの新規ノード識別子配列のための領域を、 前記記憶装置中に確保するステップと、
新たなノード識別子を一時的に記憶するカレントノード識別子領域を、前記記憶装 置中に確保して、その初期値を格納するステップと、
前記消去フラグ配列を参照して、前記消去フラグ配列のフラグがセットされて 、な 、 場合には、当該新規ノード識別子配列の値として、前記カレントノード識別子領域の 値を格納し、その後、前記カレントノード識別子領域の値を増分し、その一方、消去 フラグ配列のフラグがセットされている場合には、当該新規ノード識別子配列の値とし て無効値を格納するステップと、を実行させることを特徴とする請求項 23な 、し 25の 何れか一項に記載の情報処理プログラム。
[27] 前記部分ツリー削除後の親子関係定義配列を生成するステップにおいて、前記コ ンピュータに、
前記親子関係定義配列と同一サイズの格納アドレス配列のための領域を、前記記 憶装置中に確保するステップと、
前記新規ノード識別子配列中、前記親子関係定義配列の値の格納位置と同じ位 置の値を参照して、値が無効値である場合を除き、前記格納アドレス配列に、前記新 規ノード識別子配列中の値を格納するステップと、
前記親子関係定義配列と同一サイズの親ノード識別子配列のための領域を、前記 記憶装置中に確保するステップと、
前記新規ノード識別子配列中、前記親子関係定義配列の値が示す位置の値を参 照して、前記親ノード識別子配列中、前記親子関係定義配列の値の位置と同じ位置 に、前記新規ノード識別子配列の値を格納するステップと、
前記格納アドレス配列中の値に関連付けて、前記親ノード識別子配列の値を格納 した親子関係定義配列を生成するステップと、を実行させることを特徴とする請求項 2 3ないし 26の何れか一項に記載の情報処理プログラム。
[28] ツリー型データ構造を形成するすべてのノードに固有のノード識別子が付与され、 前記ノード識別子が、ルート'ノードから始めて、子ノードよりも同じ世代のノードを優 先して付与された連続する整数であり、前記ルート'ノード以外の非ルート ·ノードの 各々のノード識別子に関連付けられた親ノードのノード識別子が格納された親子関 係定義配列を記憶する記憶装置を備えたコンピュータにおいて、
第 1のツリーの所定のノードの子孫ノード群として第 2のツリーを挿入することにより 形成された第 3のツリーのツリー型データ構造について、前記記憶装置中に新たな 親子関係定義配列を生成するために、前記コンピュータにより読み取り可能な情報 処理プログラムであって、前記コンピュータに、
前記第 1のツリーの第 1の親子関係定義配列および前記第 2のツリーの第 2の親子 関係定義配列を前記記憶装置から読み出すステップと、
前記第 2のツリーのルート'ノードを前記第 1のツリーの前記所定のノードの所定の 順位の子ノードとして連結することにより形成される前記第 3のツリーの世代毎に、前 記第 2のツリーに属するノードに隣接する前記第 1のツリーに属するノードを特定し、 前記第 1のツリーに属する前記特定されたノードの情報を前記記憶装置に記憶する ステップと、
前記記憶装置に記憶された前記第 1のツリーに属する前記特定されたノードの情 報を参照して、前記第 3のツリーのすべてのノードに、ルート'ノード力 始めて、子ノ ードよりも同じ世代のノードを優先して連続する整数である新たなノード識別子を付 与し、前記第 1のツリーに属するノードに付与された前記新たなノード識別子を前記 第 1のツリーのノードのノード識別子に関連付けて格納した第 1の新規ノード識別子 配列、および、前記第 2のツリーに属するノードに付与された前記新たなノード識別 子を前記第 2のツリーのノード識別子に関連付けて格納した第 2の新規ノード識別子 配列を前記記憶装置に生成するステップと、
前記第 1の親子関係定義配列および第 2の親子関係定義配列と前記第 1の新規ノ ード識別子配列および前記第 2の新規ノード識別子配列に基づいて、前記第 3のッ リーの非ルート'ノードの前記新たなノード識別子に関連付けて前記第 3のツリーの前 記非ルート'ノードのノード識別子を格納することにより、前記新たな親子関係定義配 列を前記記憶装置に生成するステップと、
を実行させることを特徴とする情報処理プログラム。
前記記憶装置に、前記第 1のツリーのノードのノード識別子の各々に関連付けて、 当該ノードの少なくともノード値を格納した第 1のノード値格納配列が記憶され、前記 第 2のツリーのノードのノード識別子の各々に関連付けて、当該ノードの少なくともノ 一ド値を格納した第 2のノード値格納配列が記憶され、前記コンピュータに、
前記第 1および第 2の新規ノード識別子配列を参照して、前記第 1のツリーおよび 前記第 2のツリーのそれぞれのノード識別子と、前記第 3のツリーの新たなノード識別 子との関連付けにしたがって、前記第 1のノード値格納配列および第 2のノード配列 の少なくとも一方を更新するステップを実行させることを特徴とする請求項 28に記載 の情報処理プログラム。
[30] 前記記憶装置に、前記第 1のツリーのノードのノード識別子の各々に関連付けて、 当該ノードの少なくともノード値を格納した第 1のノード値格納配列が記憶され、前記 第 2のツリーのノードのノード識別子の各々に関連付けて、当該ノードの少なくともノ 一ド値を格納した第 2のノード値格納配列が記憶され、前記コンピュータに、
前記第 1および第 2の新規ノード識別子配列を参照して、前記第 1のツリーおよび 前記第 2のツリーのそれぞれのノード識別子と、前記第 3のツリーの新たなノード識別 子との関連付けにしたがって、前記新たなノード識別子の各々と関連付けて前記ノー ド値を格納した新たなノード値格納配列を生成するステップを実行させることを特徴と する請求項 28に記載の情報処理プログラム。
[31] 前記第 1のツリーに属する前記特定されたノードの情報を、前記記憶装置に記憶す るステップにおいて、前記コンピュータに、
前記第 2のツリーのルート'ノードが挿入される位置の情報に基づいて、前記第 1の 親子関係定義配列と同一のサイズの挿入マーク配列中、前記挿入される位置の直 後のノードおよび前記直後のノードを先祖とするノードにっ 、て、当該挿入位置であ ることを示す値を格納するステップを実行させることを特徴とする請求項 28ないし 30 の何れか一項に記載の情報処理プログラム。
[32] さらに、前記コンピュータに、前記第 1のツリーの各ノードの、当該第 2のツリーのル ート 'ノードからの深さのレベルを表すレベル値を格納した第 1のレベル配列を、前記 記憶装置に生成するステップと、
前記第 1のレベル配列中、前記第 2のツリーのルート'ノードの挿入位置に相当する レベル値を参照して、前記第 2のツリーの各ノードの、前記第 1のツリーのルート'ノー ドカゝらの深さのレベルを表すレベル値を格納した第 2のレベル配列を、前記記憶装 置に生成するステップと、を実行させ、
前記第 1の新規ノード識別子配列および前記第 2の新規ノード識別子配列を生成 するステップにおいて、前記コンピュータに、
前記第 1の親子関係定義配列および前記第 2の親子関係定義配列と、それぞれ、 同一のサイズである前記第 1の新規ノード識別子配列および前記第 2の新規ノード識 別子配列のための領域を、前記記憶装置中に確保するステップと、
新たなノード識別子を一時的に記憶するカレントノード識別子領域を、前記記憶装 置中に確保して、その初期値を格納するステップと、を実行させ、
前記挿入マーク配列中、その値が、挿入位置であることを示す値に変化している位 置以外の位置においては、さらに、前記コンピュータに、
(a)前記第 1の新規ノード識別子配列中、当該位置の値として、前記カレントノード識 別子領域の値を格納し、
(b)その後、前記カレントノード識別子領域の値を増分する
ステップを実行させ、
前記挿入マーク配列中、当該挿入マーク配列の値力 挿入位置であることを示す 値に変化する位置においては、さらに、前記コンピュータに、
(a)前記第 1のレベル配列中、当該位置のレベル値を参照し、かつ、前記第 2のレべ ル配列中、同一のレベル値を有する範囲を特定し、
(b)前記第 2の新規ノード識別子配列中、当該範囲の先頭位置力 順次、カレントノ ード識別子領域の値を格納し、
(c)その後、前記カレントノード識別子領域の値を増分し、
(d)前記第 2の新規ノード識別子配列中、前記同一のレベル値を有する範囲への値 の格納が終了すると、第 1の新規ノード識別子配列の値として、前記カレントノード識 別子領域の値を格納し、
(e)その後、前記カレントノード識別子領域の値を増分するステップを実行させること を特徴とする請求項 31に記載の情報処理プログラム。
前記新たな親子関係定義配列を生成するステップにお 、て、前記コンピュータに、 前記新たな第 1の親子関係定義配列と少なくとも同一サイズであるの、第 1の親ノー ド識別子配列のための領域および第 2の親ノード識別子配列のための領域を、前記 記憶装置中に確保するステップと、
前記第 1の新規ノード識別子配列中、前記第 1の親子関係定義配列の値が示す位 置の値を参照して、前記第 1の親ノード識別子配列中、前記親子関係定義配列の値 の位置と同じ位置に、前記第 1の新規ノード識別子配列の値を格納するステップと、 前記第 1の新規ノード識別子配列の値と、前記第 1の親ノード識別子配列の値とを 関連付けるステップと、
前記第 2の親子関係定義配列と同一サイズの、第 2の親ノード識別配列のための領 域を、前記記憶装置中に確保するステップと、
前記第 2の新規ノード識別子配列中、先頭の値として、前記挿入側ノードの頂点ノ 一ドの親ノードとなるノードのノード識別子を格納するともに、他の値として、前記第 2 の親子関係定義配列の値が示す位置の値を参照して、前記第 2の親ノード識別子 配列中、前記親子関係定義配列の値の位置と同じ位置に、前記第 2の新規ノード識 別子配列の値を格納するステップと、
前記第 2の新規ノード識別子配列の値と、前記第 2の親ノード識別子配列の値とを 関連付けるステップと、
前記第 1の親子関係定義配列によって関連付けられている子ノードのノード識別子 および親ノードのノード識別子を、前記第 1の新規ノード識別子配列を用いて、前記 子ノードの新たなノード識別子及び前記親ノードの新たなノード識別子に変換するス テツプと、
前記第 1の親ノード識別子配列中の前記子ノードの新たなノード識別子の値に対 応する位置に前記親ノードの新たなノード識別子を格納するステップと、
前記第 2の親子関係定義配列によって関連付けられている子ノードのノード識別子 および親ノードのノード識別子を、前記第 2の新規ノード識別子配列を用いて、前記 子ノードの新たなノード識別子及び前記親ノードの新たなノード識別子に変換するス テツプと、
前記第 2の親ノード識別子配列中の前記子ノードの新たなノード識別子の値に対 応する位置に前記親ノードの新たなノード識別子を格納するステップと、 前記第 1の新規ノード識別子配列の値および前記第 2の新規ノード識別子配列の 値のそれぞれに関連付けられた、前記第 1の親ノード識別子配列の値および前記第 2の親ノード識別子配列の値を重ね合わせることにより前記新たな、挿入後の親子関 係定義配列を生成に格納するステップと、
を実行させることを特徴とする請求項 28ないし 32の何れか一項に記載の情報処理 プログラム。
PCT/JP2006/315739 2005-08-12 2006-08-09 情報処理方法、情報処理装置および情報処理プログラム WO2007020850A1 (ja)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US12/063,596 US20090106298A1 (en) 2005-08-12 2006-08-09 Information processing method, information processing device, and information processing program
JP2007530961A JP4886693B2 (ja) 2005-08-12 2006-08-09 情報処理方法、情報処理装置および情報処理プログラム

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2005-234464 2005-08-12
JP2005234464 2005-08-12

Publications (1)

Publication Number Publication Date
WO2007020850A1 true WO2007020850A1 (ja) 2007-02-22

Family

ID=37757512

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2006/315739 WO2007020850A1 (ja) 2005-08-12 2006-08-09 情報処理方法、情報処理装置および情報処理プログラム

Country Status (3)

Country Link
US (1) US20090106298A1 (ja)
JP (1) JP4886693B2 (ja)
WO (1) WO2007020850A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116303405A (zh) * 2023-05-12 2023-06-23 深圳竹云科技股份有限公司 一种数据查重方法、装置、计算机设备

Families Citing this family (47)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20070101288A (ko) * 2005-01-25 2007-10-16 가부시키가이샤 터보 데이터 라보라토리 트리의 검색, 집계, 소트 방법, 정보 처리 장치, 및 트리의검색, 집계, 소트 프로그램
JP4369471B2 (ja) * 2006-12-27 2009-11-18 富士通株式会社 ミラーリングプログラム、ミラーリング方法、情報記憶装置
US8176084B2 (en) * 2007-11-26 2012-05-08 International Business Machines Corporation Structure based storage, query, update and transfer of tree-based documents
US8484256B2 (en) * 2010-01-13 2013-07-09 International Business Machines Corporation Transformation of logical data objects for storage
US9716672B2 (en) 2010-05-28 2017-07-25 Brocade Communications Systems, Inc. Distributed configuration management for virtual cluster switching
US9270486B2 (en) 2010-06-07 2016-02-23 Brocade Communications Systems, Inc. Name services for virtual cluster switching
US9769016B2 (en) 2010-06-07 2017-09-19 Brocade Communications Systems, Inc. Advanced link tracking for virtual cluster switching
US8867552B2 (en) 2010-05-03 2014-10-21 Brocade Communications Systems, Inc. Virtual cluster switching
US9806906B2 (en) 2010-06-08 2017-10-31 Brocade Communications Systems, Inc. Flooding packets on a per-virtual-network basis
US9628293B2 (en) 2010-06-08 2017-04-18 Brocade Communications Systems, Inc. Network layer multicasting in trill networks
US9608833B2 (en) 2010-06-08 2017-03-28 Brocade Communications Systems, Inc. Supporting multiple multicast trees in trill networks
US9807031B2 (en) 2010-07-16 2017-10-31 Brocade Communications Systems, Inc. System and method for network configuration
CN102402545B (zh) * 2010-09-14 2015-09-02 腾讯科技(深圳)有限公司 一种存储数据的方法及装置
US9736085B2 (en) 2011-08-29 2017-08-15 Brocade Communications Systems, Inc. End-to end lossless Ethernet in Ethernet fabric
US9699117B2 (en) 2011-11-08 2017-07-04 Brocade Communications Systems, Inc. Integrated fibre channel support in an ethernet fabric switch
US9450870B2 (en) 2011-11-10 2016-09-20 Brocade Communications Systems, Inc. System and method for flow management in software-defined networks
US9742693B2 (en) 2012-02-27 2017-08-22 Brocade Communications Systems, Inc. Dynamic service insertion in a fabric switch
US9154416B2 (en) 2012-03-22 2015-10-06 Brocade Communications Systems, Inc. Overlay tunnel in a fabric switch
US9009155B2 (en) * 2012-04-27 2015-04-14 Sap Se Parallel set aggregation
US10277464B2 (en) 2012-05-22 2019-04-30 Arris Enterprises Llc Client auto-configuration in a multi-switch link aggregation
US9256593B2 (en) * 2012-11-28 2016-02-09 Wal-Mart Stores, Inc. Identifying product references in user-generated content
US9548926B2 (en) 2013-01-11 2017-01-17 Brocade Communications Systems, Inc. Multicast traffic load balancing over virtual link aggregation
US9413691B2 (en) 2013-01-11 2016-08-09 Brocade Communications Systems, Inc. MAC address synchronization in a fabric switch
US9565099B2 (en) 2013-03-01 2017-02-07 Brocade Communications Systems, Inc. Spanning tree in fabric switches
US9912612B2 (en) 2013-10-28 2018-03-06 Brocade Communications Systems LLC Extended ethernet fabric switches
US9548873B2 (en) 2014-02-10 2017-01-17 Brocade Communications Systems, Inc. Virtual extensible LAN tunnel keepalives
US10581758B2 (en) 2014-03-19 2020-03-03 Avago Technologies International Sales Pte. Limited Distributed hot standby links for vLAG
US10476698B2 (en) 2014-03-20 2019-11-12 Avago Technologies International Sales Pte. Limited Redundent virtual link aggregation group
US10063473B2 (en) 2014-04-30 2018-08-28 Brocade Communications Systems LLC Method and system for facilitating switch virtualization in a network of interconnected switches
US9800471B2 (en) 2014-05-13 2017-10-24 Brocade Communications Systems, Inc. Network extension groups of global VLANs in a fabric switch
US10616108B2 (en) 2014-07-29 2020-04-07 Avago Technologies International Sales Pte. Limited Scalable MAC address virtualization
US9807007B2 (en) 2014-08-11 2017-10-31 Brocade Communications Systems, Inc. Progressive MAC address learning
US9699029B2 (en) 2014-10-10 2017-07-04 Brocade Communications Systems, Inc. Distributed configuration management in a switch group
US9626255B2 (en) 2014-12-31 2017-04-18 Brocade Communications Systems, Inc. Online restoration of a switch snapshot
US9628407B2 (en) * 2014-12-31 2017-04-18 Brocade Communications Systems, Inc. Multiple software versions in a switch group
US9942097B2 (en) 2015-01-05 2018-04-10 Brocade Communications Systems LLC Power management in a network of interconnected switches
US10003552B2 (en) 2015-01-05 2018-06-19 Brocade Communications Systems, Llc. Distributed bidirectional forwarding detection protocol (D-BFD) for cluster of interconnected switches
US9807005B2 (en) 2015-03-17 2017-10-31 Brocade Communications Systems, Inc. Multi-fabric manager
US10038592B2 (en) 2015-03-17 2018-07-31 Brocade Communications Systems LLC Identifier assignment to a new switch in a switch group
US10579406B2 (en) 2015-04-08 2020-03-03 Avago Technologies International Sales Pte. Limited Dynamic orchestration of overlay tunnels
US10439929B2 (en) 2015-07-31 2019-10-08 Avago Technologies International Sales Pte. Limited Graceful recovery of a multicast-enabled switch
US10171303B2 (en) 2015-09-16 2019-01-01 Avago Technologies International Sales Pte. Limited IP-based interconnection of switches with a logical chassis
US9547478B1 (en) 2015-09-30 2017-01-17 Semmle Limited Hierarchical dependency analysis enhancements using disjoint-or trees
US9912614B2 (en) 2015-12-07 2018-03-06 Brocade Communications Systems LLC Interconnection of switches based on hierarchical overlay tunneling
US10237090B2 (en) 2016-10-28 2019-03-19 Avago Technologies International Sales Pte. Limited Rule-based network identifier mapping
US10685079B2 (en) * 2017-09-12 2020-06-16 Sap Se Parsing nested javascript object notation requests
US11366810B2 (en) * 2020-04-27 2022-06-21 Salesforce.Com, Inc. Index contention under high concurrency in a database system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000348038A (ja) * 1999-06-02 2000-12-15 Fujitsu Ltd 半構造データベースのためのデータ格納装置および方法
JP2004120657A (ja) * 2002-09-27 2004-04-15 Internatl Business Mach Corp <Ibm> 木構造文書送受システム、木構造文書送信装置、木構造文書受信装置、木構造文書送受方法、木構造文書送信方法、木構造文書受信方法、及びプログラム

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3630057B2 (ja) * 2000-01-26 2005-03-16 日本電気株式会社 検索用データ構造構築方法、その装置、及び機械可読プログラム記録媒体
US7281206B2 (en) * 2001-11-16 2007-10-09 Timebase Pty Limited Maintenance of a markup language document in a database
US7313563B2 (en) * 2003-07-30 2007-12-25 International Business Machines Corporation Method, system and recording medium for maintaining the order of nodes in a heirarchical document
US7937413B2 (en) * 2004-05-04 2011-05-03 International Business Machines Corporation Self-adaptive prefix encoding for stable node identifiers

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000348038A (ja) * 1999-06-02 2000-12-15 Fujitsu Ltd 半構造データベースのためのデータ格納装置および方法
JP2004120657A (ja) * 2002-09-27 2004-04-15 Internatl Business Mach Corp <Ibm> 木構造文書送受システム、木構造文書送信装置、木構造文書受信装置、木構造文書送受方法、木構造文書送信方法、木構造文書受信方法、及びプログラム

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
EDA T. ET AL.: "XML Ki no Tame no Doteki Han'i Label-zuke Shuho", TRANSACTIONS OF INFORMATION PROCESSING SOCIETY OF JAPAN, INFORMATION PROCESSING SOCIETY OF JAPAN, vol. 45, no. SIG7(TOD22), 15 June 2004 (2004-06-15), pages 102 - 114, XP003008737 *
MIYAZATO C. ET AL.: "Shinka Tree-base Method ni yoru Multiple Alignment Mondai no Kaiho", IEICE TECHNICAL REPORT, THE INSTITUTE OF ELECTRONICS, INFORMATION AND COMMUNICATION ENGINEERS, vol. 104, no. 593(CST2004-48), pages 55 - 59, XP003008738 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116303405A (zh) * 2023-05-12 2023-06-23 深圳竹云科技股份有限公司 一种数据查重方法、装置、计算机设备
CN116303405B (zh) * 2023-05-12 2023-11-10 深圳竹云科技股份有限公司 一种数据查重方法、装置、计算机设备

Also Published As

Publication number Publication date
JP4886693B2 (ja) 2012-02-29
JPWO2007020850A1 (ja) 2009-02-26
US20090106298A1 (en) 2009-04-23

Similar Documents

Publication Publication Date Title
WO2007020850A1 (ja) 情報処理方法、情報処理装置および情報処理プログラム
JP4537391B2 (ja) ツリー型データ構造を取り扱う方法、情報処理装置、及び、プログラム
JP4681544B2 (ja) 配列の生成方法、情報処理装置、及び、プログラム
JP4141556B2 (ja) 構造化文書管理方法及びその実施装置並びにその処理プログラムを記録した媒体
JP4413286B2 (ja) エッジデータ構造を統一する方法
JP4712718B2 (ja) 配列の生成方法、及び、配列生成プログラム
JP5241738B2 (ja) 表からツリー構造データを構築する方法及び装置
JP4796970B2 (ja) ツリーデータの検索・集計・ソート方法及びプログラム
CN108351768A (zh) 用标记语言编写文档的方法
WO2006080268A9 (ja) ツリーの検索、集計、ソート方法、情報処理装置、および、ツリーの検索、集計、ソートプログラム
JP4681555B2 (ja) ノード挿入方法、情報処理装置、および、ノード挿入プログラム
JPH0652161A (ja) 文書処理方法及び文書処理装置
JP2001290801A (ja) 構造文書化システム,構造文書化プログラム,及び、コンピュータ可読格納媒体
JP3824956B2 (ja) 識別番号付与装置、識別番号管理方法、識別番号管理プログラム及び同プログラムを記録したコンピュータ読み取り可能な記録媒体
JP6753190B2 (ja) 文書検索装置及びプログラム
JP3707133B2 (ja) 文書データベース管理装置および文書データベース管理方法
JP3843574B2 (ja) 文書変換規則生成装置、文書変換規則生成方法及び文書変換規則生成プログラムを記録したコンピュータ読み取り可能な記録媒体
WO2024116688A1 (ja) 発想支援システム及び方法
JP2001134596A (ja) 構造化文書管理装置および構造化文書検索方法
JP2004310249A (ja) Xmlデータの検索方法及び検索装置、並びにプログラムおよびプログラムを記録した記録媒体
JP4334450B2 (ja) 構造化文書検索装置及び構造化文書検索方法
JP2003345781A (ja) 構造化データ編集装置、構造化データ編集方法及びプログラム
JP2005339019A (ja) 表−xml変換装置、方法およびその方法をコンピュータに実行させるためのプログラム
JP2004355322A (ja) 機械翻訳装置、変換ルール辞書管理装置およびプログラム
JPH02150955A (ja) 数式編集装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application
ENP Entry into the national phase

Ref document number: 2007530961

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 12063596

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 06782555

Country of ref document: EP

Kind code of ref document: A1