A method for constructing a file system graph structure
Through the graph structure construction method, tags and graph structure modules are used to describe various relationships in the file system, which solves the problem of unintuitive file system structure in the existing technology and achieves intuitive and convenient file system display and efficient retrieval.
Patent Information
- Application Number
- CN202210766776.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-01
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2042-07-01
AI Technical Summary
The directory structure of the existing file system is not intuitive enough when displaying the relationship between files, and cannot effectively express the multiple relationships between files.
Using the graph structure construction method, the tag recording module and the graph structure module describe various connection relationships between files, establish an unweighted graph or a weighted graph structure, provide user interface tools to establish and display node tags and their relationships, and realize file Intuitive and multi-structuring of the system.
It realizes an intuitive and convenient structure display of the file system, meets the needs of various forms of expression, and can view file relationships without traversing the directory structure, improving the efficiency of file retrieval.
Smart Images

Figure CN114996213B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a method for constructing a graph structure of a file system. Background Art
[0002] In the file system of the existing operating system, the structuring of the file system is used to describe the relationship between files. The most widely used solution for implementing structuring is the directory system, that is, files are stored in the form of a directory structure consisting of a root directory and multiple sub-directories, and the directory is used to classify and display files in a hierarchical manner. This system equates directories with files during management. All root directories and sub-directories must be opened to display a complete tree-like file structure, and to see the subordinate relationship between files, which is not intuitive enough. In addition, the relationship between files is multivariate, and the relationship between files does not necessarily appear in the form of a hierarchical relationship. The relationship between them may be in various graphical forms, so it is not enough to provide only a directory structure.
[0003] Tags are used to classify files in Windows and Mac OS, but they are only used to quickly find files, and no structured solution has been formed.
[0004] For directory-less file systems, such as "A File System", patent application number 201911038055.0, tags are used to classify and manage files, but there is also no file system structuring solution.
[0005] To this end, it is necessary to build a more intuitive and diverse file system structure. Summary of the invention
[0006] In response to the demand for building a more intuitive and diverse file system structure proposed in the background technology, the present invention proposes to establish a file system graph structure, that is, to establish a graph structure with more connection relationships between files, and the directory structure is only one of the forms included in the graph structure.
[0007] To achieve the above object, the present invention provides the following technical solutions:
[0008] A method for constructing a file system graph structure, characterized by comprising:
[0009] The label recording module is used to record the corresponding relationship between files and labels;
[0010] A graph structure module is used to describe the label composition and mutual relationship at the nodes of a graph structure. The labels at the nodes of the graph structure are called node labels. The label recording module is also used to record the graph structure module information.
[0011] A graph construction module, configured to select a corresponding file in the tag recording module according to the node tag in the graph structure module, and record graph structure module information corresponding to the file in the tag recording module;
[0012] The graph structure module information includes a module identifier of the graph structure module and location information of a node tag in the graph structure module used to select a file from the tag record module;
[0013] There is a corresponding relationship between the file in the label recording module and the physical address where the file is stored.
[0014] Optionally, the method for constructing the file system graph structure is characterized by further comprising:
[0015] A graph module, used for establishing and / or displaying a graph structure including the node labels and the relationships between the node labels;
[0016] The graph module has a user interface, which includes a tool for establishing the node labels, a tool for establishing the relationship between the node labels, and a tool for establishing a space for accommodating files under the node labels after the node labels are established, wherein the space for accommodating files is called a file space;
[0017] The graph module is further used to display the content in the graph structure module as a graph structure, and to add corresponding files to the file space under the node tag of the graph structure according to the graph structure module information of the graph structure module in the tag recording module;
[0018] There is a corresponding relationship between the file in the file space under the node tag and the physical address where the file is stored.
[0019] Optionally, the method for constructing the file system graph structure is characterized by:
[0020] The graph structure is an unweighted graph structure, and the unweighted graph structure includes an unweighted undirected graph and an unweighted directed graph;
[0021] The graph structure module is an array label file, which describes the composition and mutual relationship of all node labels for establishing the unweighted graph structure in a certain order in a manner that each line describes the relationship between the root node and the branch node of the first-level node label;
[0022] Each row in the graph structure module has only one root node label that is fixed at one position, and the remaining labels are branch node labels arranged in a certain order.
[0023] Optionally, the method for constructing the file system graph structure is characterized by:
[0024] The graph structure is a weighted graph structure, and the weighted graph structure includes a weighted undirected graph and a weighted directed graph;
[0025] The graph structure module is two array label files, one of which describes the composition and mutual relationship of all node labels for establishing the weighted graph structure in a certain order in which each line describes the relationship between the root node and branch node of the first-level node label. Each line in the graph structure module has only one root node label fixed in one position, and the remaining labels are branch node labels arranged in a certain order; the other array label file is used to record the weights between label nodes in the previous array label file.
[0026] Optionally, the graph structure module includes a graph type label of the graph structure, which is used to indicate whether the graph structure is an unweighted undirected graph, an unweighted directed graph, a weighted undirected graph, or a weighted directed graph.
[0027] Optionally, a group of node label root nodes and branch node relationships in the graph structure module includes a graphical label of the graph structure, which is used to indicate whether the relationship within the node label group in the graph structure is an unweighted undirected graph, or an unweighted directed graph, or a weighted undirected graph, or a weighted directed graph.
[0028] Optionally, the graph structure may be decomposed into several graph structures by decomposing the graph structure module and changing the corresponding content in the tag recording module.
[0029] Optionally, the graph structure may be merged into one graph structure by merging the graph structure module with other graph structures and changing the corresponding content in the tag recording module.
[0030] Optionally, the process of creating a new file system graph structure through a user interface in the graph module is as follows:
[0031] Create the node label;
[0032] Establishing a relationship between the node labels;
[0033] Establish file spaces for accommodating files under each of the node labels according to needs;
[0034] Selecting the file corresponding to the node label in the label recording module and placing the file into the corresponding file space;
[0035] The newly created node label and the relationship between the node labels are stored as the graph structure module, and the graph construction module is used to update the graph structure module information of the file corresponding to the node label in the label recording module.
[0036] Optionally, the user interface of the graph module may include one or more of the label recording module, the graph structure module and the graph construction module.
[0037] It should be noted that for the unweighted undirected graph or weighted undirected graph described above, since there is no directional relationship between any two node labels, the root node is actually the start node of the relationship segment, and the branch node is the end node of the relationship segment. The reason for distinguishing the start node and the end node is just to describe the start and end of a segment. Figure 1 The description is concise at the beginning, and the root node and branch node are still used to describe the undirected graph in the future.
[0038] In addition, the above description of the graph structure module, which is all expressed in terms of behavior targets, can also be expressed in terms of columns, for example, "each row" becomes "each column", and "row by row" becomes "column by column". For consistency of expression, the following description is still expressed in terms of behavior targets.
[0039] The present invention has the following beneficial effects:
[0040] (1) A method for constructing a file system graph structure using tags is provided, which meets the demand for multiple representations of the file system;
[0041] (2) Since the tag recording module already contains all the files and tags needed, the file graph structure can be viewed without graph traversal or opening multiple sub-directories of the directory structure. The present invention provides a more intuitive and convenient file system structure.
[0042] (3) The directory structure is just an unweighted graph, and the graph structure of the present invention can be an unweighted graph or a weighted graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use are briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work.
[0044] Figure 1 A schematic diagram of a method for constructing a file system graph structure disclosed in an embodiment of the present invention;
[0045] Figure 2 A schematic diagram of another method for constructing a file system graph structure disclosed in an embodiment of the present invention;
[0046] Figure 3 A graph structure of an unweighted directed graph disclosed in an embodiment of the present invention;
[0047] Figure 4 A graph structure of an unweighted directed graph with a file space disclosed in an embodiment of the present invention;
[0048] Figure 5 A graph structure of another unweighted directed graph with file space disclosed in an embodiment of the present invention;
[0049] Figure 6 Another unweighted directed graph disclosed in an embodiment of the present invention;
[0050] Figure 7 An unweighted undirected graph disclosed in an embodiment of the present invention;
[0051] Figure 8 A graph structure of an unweighted undirected graph with a file space disclosed in an embodiment of the present invention;
[0052] Fig. 9 A weighted directed graph disclosed in an embodiment of the present invention;
[0053] Fig.10 A graph structure of a weighted directed graph with a file space disclosed in an embodiment of the present invention;
[0054] Fig.11 A weighted undirected graph disclosed in an embodiment of the present invention;
[0055] Fig.12 A weighted undirected graph with a file space disclosed in an embodiment of the present invention;
[0056] Fig.13 A graph structure consisting of three graph types disclosed in an embodiment of the present invention;
[0057] Fig.14 The first graph structure after decomposition in the example of decomposing one graph structure into two graph structures disclosed in the embodiment of the present invention;
[0058] Fig.15 The second graph structure after decomposition in the example of decomposing one graph structure into two graph structures disclosed in the embodiment of the present invention;
[0059] Fig.16 This is an example of merging two graph structures into one graph structure disclosed in an embodiment of the present invention.
[0060] Reference numerals:
[0061] G1, an unweighted directed graph; G2, an unweighted undirected graph; G3, a weighted directed graph; G4, a weighted undirected graph; a1, the weight between two nodes; a2, the weight between two nodes; a3, the weight between two nodes; a4, the weight between two nodes; a5, the weight between two nodes; a6, the weight between two nodes; a7, the weight between two nodes; a8, the weight between two nodes; a9, the weight between two nodes. DETAILED DESCRIPTION
[0062] The present invention is further described in detail below in conjunction with the embodiments and drawings, but the embodiments of the present invention are not limited thereto. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0063] The embodiment of the present invention discloses a method for constructing a file system graph structure, see Figure 1 As shown, the method includes a label recording module 1, a graph structure module 2 and a graph construction module 3.
[0064] The label recording module 1 is used to record the corresponding relationship between files and labels.
[0065] There is a corresponding relationship between the files in the label recording module 1 and the physical addresses where the files are stored.
[0066] Files can be found, opened or edited by selecting files in the tag record module 1. For example, if these files come from a file system with a directory structure, a physical address link of the file can be put in; if these files come from a file system without a directory structure "a file system", a combination of a tag and a file name corresponding to a file description block (FCB) can be put in, so that the physical address of the file can be found by finding the file description block.
[0067] Files can be tagged in Windows and Mac OS, which are file systems with directories, and can also be tagged in "a file system" which is a file system without directories. Using these technologies, when there are already a number of tags and files corresponding to each other, a new tag recording module 1 is created to record this correspondence. This module can be a table, including two columns: one column is the file identifier, which can be the file name or other identifiers that have a corresponding relationship with the physical address where the file is stored, and the other column is the tags of these files, as shown in Table 1. If it is found in subsequent operations that there are files or tags missing in the tag recording module 1, it is necessary to use the original file system (such as Windows, MacOS or a file system without directories) to create a new correspondence between these files and tags, and record it in the tag recording module 1.
[0068] Table 1
[0069] File Identification Label
[0070] For example, there are already labels A, B, C, D, E, file 1, file 2, file 3, file 4. The correspondence between these files and labels is shown in Table 2: file 1 has label B, file 2 has labels C and E, file 3 has labels A, D and E, and file 4 has label D.
[0071] Table 2
[0072] File Identification Label File 1 B File 2 C,E File 3 A,D,E File 4 D
[0073] The graph structure module 2 is used to describe the label composition and mutual relationship at the nodes of a graph structure. At the same time, the label recording module 1 is also used to record the information of the graph structure module 2; wherein the information of the graph structure module 2 includes the module identifier of the graph structure module 2 and the location information of the node label in the graph structure module 2 used to select files from the label recording module 1 in the graph structure module 2.
[0074] In order to describe the graph structure, it is necessary to first look at the definition of a graph: if there is an arbitrary preceding and following relationship R between the elements in the data element set D, then this data structure B = (D, R) is called a graph. The location of the data element is called a node. There are two types of graphs: undirected graphs and directed graphs: if the edges connecting the nodes have no direction, it is called an undirected graph; conversely, if the edges connecting the nodes have a direction, it is called a directed graph. In addition, in some graphs, the data information associated with the edge or arc is called weight. There are four types of graphs, divided into weighted and unweighted, directed and undirected: unweighted undirected graph, unweighted directed graph, weighted undirected graph and weighted directed graph.
[0075] In the embodiment of the present invention, the data elements of the graph are tags, and the relationship between tags is the context relationship. The graph structure module 2 is to determine which tags to add to the graph structure, and the context relationship between these tags.
[0076] The description of the graph structure can be represented by the storage structure of the graph, for example, it can be represented by an association matrix (also known as an adjacency matrix): it refers to the use of two arrays, a one-dimensional array to store the information of the nodes in the graph, and a two-dimensional array to store the relationship between the nodes in the graph.
[0077] Detailed description of the association matrix representation: Suppose a graph G(D, R) has n nodes d1, d2, ..., dn. In order to store the graph G, a one-dimensional array D(1:n) with a length of n is used to store the information of each node in the graph G, and then a two-dimensional array R(1:n, 1:n) is used to store the association status of each node in the graph G. For each element R(i, j) (1≦i≦n, 1≦j≦n), the value is either 1 or 0, which depends on the association status of nodes di and dj: if (di, dj)∈R, then R(i, j)=1, otherwise R(i, j)=0.
[0078] For example, to create Figure 3 The graph structure G1 shown has four node labels v1, v2, v3, and v4, where v1 is the root node of v2 and v3, v3 is the root node of v4, and v4 is the root node of v1.
[0079] If we continue with the previous example Table 2 and specify that the node labels v1 to v4 assigned to the graph G1 are A, B, D, and E respectively, we can use a one-dimensional array D1 and a two-dimensional array D2 to represent the graph G1:
[0080] D1={A,B,D,E}
[0081] D2={{0,1,1,0},{0,0,0,0},{0,0,0,1},{1,0,0,0}}
[0082] Among them, D2 represents the relationship listed in the following Table 3: the horizontal and vertical titles of the table are both node labels, and the table has 4 rows and 4 columns except the title; since G1 is a directed graph, "1" is only represented at the root node, for example: node label A is the root node of node labels B and D, so the horizontal node label A (1st row) corresponds to the vertical node labels B (2nd column) and D (3rd column) are both 1, conversely, the horizontal node labels B (2nd row) and D (3rd row) correspond to the vertical node label A (1st column) are both 0.
[0083] Table 3
[0084]
[0085]
[0086] In this way, D1 and D2 constitute the graph structure module 2 of G1.
[0087] The graph construction module 3 is used to select the corresponding file in the tag recording module 1 according to the node tag in the graph structure module 2, and record the graph structure module 2 information corresponding to the file in the tag recording module 1. The graph structure module 2 information includes the module identifier of the graph structure module 2 and the position information of the node tag in the graph structure module 2 used to select the file from the tag recording module 1.
[0088] This process is similar to determining the root directory and subdirectory names when building a directory structure, deciding which file to place in which directory, and finally establishing the directory structure.
[0089] Specifically, the position of the node label can be represented by rows and columns starting from 0. The position of the node label is recorded in order to determine which file to select and where to place the selected file when a file meets multiple node label requirements or when multiple files meet the node label requirements. This position is the row number and column number of the array containing the node label in the graph structure module. It can also be omitted after some judgments: if it is determined that a file can only meet one node label requirement and the node label can only find the file, the position information of the node label can be omitted; or, if it is determined that only the row or column information is sufficient to determine which file and its placement position, it can also only contain the row or column information.
[0090] Continuing with the above example, we know from D1 in the graph structure module 2 of G1 that it contains node labels A, B, D, and E. We look for the corresponding file in Table 2 of the label record module 1. The file we are looking for must contain the node label of the destination. There can be more labels. For example, if we want to put file 3 at label node A, then file 3 must have label A. Based on this principle, we can put file 3 at label node A, file 1 at label node B, file 4 at label node D, and file 2 at label node E. Then we add a column to Table 2: graph structure module information, and fill in these options to get Table 4.
[0091] Table 4
[0092] File Identification Label Graph structure module information File 1 B D1(1) File 2 C,E D1(3) File 3 A,D,E D1(0) File 4 D D1(2)
[0093] Among them, since it is known that D1 belongs to the graph G1, D1 is the module identifier of the graph G1 in Table 4, and G1D1 can also be directly used as the module identifier. The module identifier here is also called the graph structure identifier.
[0094] Among them, there is no doubt that the position of file 1 only corresponds to the position of label node B. When searching for files with label B, only one file can be found, so the position information can be omitted; only file 3 meets the requirements of label node A, but it also meets the requirements of label node D and node E, so the position information needs to be filled in; file 4 can only be placed at label node D, but multiple files can be found when searching for files with label D, so the position information is needed, so Table 4 can be simplified to Table 5.
[0095] Table 5
[0096]
[0097]
[0098] Since a node label position can contain no file or multiple files, file 3 can be arranged at node label D, as shown in Table 6.
[0099] Table 6
[0100] File Identification Label Graph structure module information File 1 B D1 File 2 C,E D1(3) File 3 A,D,E D1(2) File 4 D D1(2)
[0101] If the graph structure module information of a file is empty, the file will not be placed on the graph structure.
[0102] At this point, the file system graph structure of graph G1 is constructed, and the user can view or display this graph structure through D1, D2 and Table 4, or D1, D2 and Table 5, or D1, D2 and Table 6.
[0103] The file system graph structure established in the embodiment of the present invention is different from the directory structure. When searching for a file and its related files, only the file can be found in the tag record module 1 to find the graph structure where it is located and other files in the graph structure, without traversing the graph structure. For example, to find file 4, it is only necessary to find it in Table 6, then find the graph structures D1 and G1 where it is located, and then continue to find other files in D1: file 1, file 2 and file 3, which are the files related to file 4. Correspondingly, the search for files in the directory structure usually requires traversing each subdirectory, so the graph structure of the embodiment of the present invention can retrieve files faster than the directory structure.
[0104] Furthermore, the present invention discloses a method for constructing a file system graph structure. Figure 2 As shown, the method includes a graph module 4, a label recording module 1, a graph structure module 2 and a graph construction module 3.
[0105] A graph module 4, for establishing and / or displaying a graph structure including node labels and relationships between node labels;
[0106] The graph module 4 has a user interface, which includes a tool for establishing node labels, a tool for establishing node label relationships, and a tool for establishing space for accommodating files under the node labels after the node labels are established; wherein the graph module 4 is also used to display the content of the graph structure module 2 as a graph structure, and to add corresponding files to the file space under the node label of the graph structure according to the graph structure module information of the graph structure module 2 in the label recording module 1.
[0107] Specifically, a new graph structure can be created in the graph module 4, and the newly created graph structure can be stored as the graph structure module 2, and the graph structure module information in the tag recording module 1 can be updated for later use. The graph module 4 can also call out an already established graph structure module 2 and display the graph structure in combination with the content of the tag recording module 1.
[0108] For example, in the diagram module 4, a user interface is used to establish Figure 4 The process of the file system graph structure of the graph G1 style shown can be the following 5 steps:
[0109] 1. Create four node labels v1, v2, v3, and v4. These labels can be labels that are already in the label recording module 1. If not, you need to use the original file system (such as Windows, MacOS, or a directory-free file system) to create these labels and record them in the label recording module 1.
[0110] 2. Establish the relationship between node labels. In this example, there are three sets of root node and branch node relationships: v1 is the root node of v2 and v3, v3 is the root node of v4, and v4 is the root node of v1;
[0111] 3. Create file spaces for accommodating files under node labels v1, v2, v3, and v4 as needed;
[0112] 4. In the label recording module 1, select the files corresponding to the node labels v1, v2, v3, and v4 and put these files into the corresponding file space;
[0113] 5. Save the newly created node labels and the relationship between node labels as a graph structure module. Specifically, save the four newly created node labels v1, v2, v3, and v4 as a file similar to the graph structure module D1 in the previous example, and save the relationship between them as a file similar to the graph structure module D2 in the previous example. Use the graph construction module 3 to update the graph structure module 2 information of the files corresponding to the node labels v1, v2, v3, and v4 in the label recording module 1.
[0114] On the other hand, when calling out an existing graph module file 2, following the previous example, the first step of the process can be completed according to the graph structure module D1, the second step of the process can be completed according to the graph structure module D2, and the third and fourth steps of the process can be completed according to the graph structure module information corresponding to the module identifier D1 of the graph G1 in the label record module table 4 (or table 5), thus establishing a graph structure including node labels and the corresponding files under the node labels. Figure 4 In the same way, the graph structure corresponding to Table 6 can be established as follows Figure 5 shown.
[0115] Among them, there is a corresponding relationship between the file in the label recording module 1 and the file corresponding to the node label in the graph structure and the physical address where the file is stored.
[0116] Specifically, the files in Tables 2 to 6 and Figure 4 as well as Figure 5 The files in the folder can directly correspond to the physical addresses where the files are stored, so that you can open the files directly by clicking on them.
[0117] The file system graph structure established in the embodiment of the present invention is different from the directory structure. When retrieving a file and its related files, it is only necessary to search in the tag record module without traversing the graph structure. At the same time, the display of the graph structure more intuitively and diversely shows the relationship between files.
[0118] Furthermore, when the graph structure is an unweighted graph structure, it includes an unweighted undirected graph and an unweighted directed graph. The graph structure module 2 is an array label file. When describing the graph structure, the composition and mutual relationship of all node labels that establish the unweighted graph structure can be described in a top-down and left-to-right order with each line describing the relationship between the root node and the branch node of the first-level node label.
[0119] It should be noted that for undirected graphs, including unweighted undirected graphs and weighted undirected graphs, since there is no directional relationship between any two node labels, the root node is actually the start node of the relationship segment, and the branch node is the end node of the relationship segment. The reason for distinguishing between the start node and the end node is just to describe the start and end of a segment. The start node (or root node) and the end node (or branch node) can be interchangeable while ensuring the same connection relationship. For example, the line between two node labels A and B can be regarded as A as the start node or root node, or B as the start node or root node. In order to maintain the same as directed Figure 1 The description is concise at the beginning, and the root node and branch node are still used to describe the undirected graph in the future.
[0120] Specifically, the root node label of each row can be fixedly placed in the first place, and the remaining labels are branch node labels arranged in order from left to right. When the graph structure module 2 is a two-dimensional array label file, each row can always check whether the label of the earliest branch node in the previous row is the root node label and whether it has been described. If not, describe them line by line in order.
[0121] Specifically, in the above example, if G1 only contains three label nodes A, B, and D, and does not contain label node E, it can be described by a one-dimensional array label file D3: D3 = {A, D, B}.
[0122] The first digit "A" of D3 is the root node label, and the remaining two digits from left to right are the two branch node labels "D" and "B" of "A". D3 contains the three node labels A, B, and D required in the graph, as well as the description of the relationship between these node labels.
[0123] Specifically, in the above example, when G1 contains the labeled node E, the graph structure module 2 can be described by a two-dimensional array label file D4: the first line first describes the situation where A is the root node and D and B are branch nodes, so there is {A, D, B}; the second line first checks whether the first branch node D in the previous line is the root node, and the result is that it is, so there is {D, E}; the third line checks whether the second branch node E in the previous line is the root node, and the result is that it is, so there is {E, A}, and finally D4 = {{A, D, B}, {D, E}, {E, A}}.
[0124] D4 also contains both the node labels required in the graph and the description of the relationship between these node labels. A label in D4 can have multiple positions, for example, label A can be D4(0,0) or D4(2,1).
[0125] According to the elements in the graph structure module D4 of G1, delete the duplicates and find that it contains node labels A, B, D, and E. Find the corresponding file in Table 2 of the label record module 1. The file must contain the node label. There can be more labels, for example, file 3 is placed at node label A, file 1 is placed at node label B, file 4 is placed at node label D, and file 2 is placed at node label E. Then fill these selections into Table 2 to obtain Table 7.
[0126] Table 7
[0127] File Identification Label Graph structure module information File 1 B D4(0,2) File 2 C,E D4(1,1) File 3 A,D,E D4(0,0) File 4 D D4(0,1)
[0128] Among them, since it is known that D4 belongs to the graph G1, D4 is the module identifier of the graph G1 in Table 7, and G1D4 can also be directly used as the module identifier.
[0129] In the graph module 4, according to D4 in the graph structure module 2, the graph structure including the node label and the corresponding file under the node label is established according to the label record module table 7. The situation is the same as the situation when the graph structure modules are D1 and D2. Figure 4 D4 in the embodiment of the present invention substantially replaces D1 and D2 in the structural modules of the previous figure.
[0130] Compared with the graph storage method of the association matrix, the embodiment of the present invention uses one array to replace the two arrays in the association matrix to store the graph structure, so it has the advantages of reducing complexity and saving storage space.
[0131] It should be noted that the embodiments of the present invention can express various special types of graph structures, such as Figure 6 The multigraph shown is a graph with multiple relationships between nodes. Figure 6 In the graph, A and E are mutually root-branch-node related, and its graph structure module 2 is: D5 = {{A,D,B},{D,E},{E,A},{A,E}}.
[0132] For another example, to build a file system graph structure of an unweighted undirected graph G2, such as Figure 7 As shown, it includes 7 node labels v1, v2, v3, ... v7, and the relationship between them is: v1 is the root node of v3, v4 and v5, v3 is the root node of v6 and v7, and v2 is the root node of v4 and v5.
[0133] For example, 10 files are prepared to be put into G2, and they have 15 labels A, B, C, ...O, as shown in Table 8.
[0134] Table 8
[0135]
[0136]
[0137] If the node labels v1 to v7 in graph G2 are labels A, D, L, B, N, F and H respectively, then the graph structure module of G2 can be described by a two-dimensional array label file D6:
[0138] D6={{A,L,B,N},{L,F,H},{D,B,N}}
[0139] D6(0,0) is "A" which is the root node label. Similarly, D6(1,0) is "L" and D6(2,0) is "D" which are root node labels. The remaining positions are branch node labels.
[0140] According to the elements in the graph structure module D6 of G2, delete the duplicates and find out that it contains node labels A, L, B, N, F, H, and D. Find the corresponding file in the label record module table 8. The file must contain the node label of the destination. There can be more labels, for example, file 3 and file 5 are placed at node label A, file 1 and file 2 are placed at node label B, file 4 is placed at node label D, file 6 is placed at node label F, file 7 is placed at node label H, file 8 and file 10 are placed at node label L, and file 9 is placed at node label N. Then fill these selections into Table 8 to get Table 9.
[0141] Table 9
[0142]
[0143]
[0144] When displaying the graph structure, an unweighted undirected graph is established in the graph module 4 according to D6, and then the graph structure with files under the node label is obtained according to Table 9. Figure 8 For easy operation, all files of G2 can also be created through the user interface in Figure Module 4 and finally displayed. Figure 8 The graph structure shown.
[0145] It is not difficult to see that G2 is a graph structure similar to a directory structure. If it is represented as a directory structure, the node labels v1 and v2 in G2 must be in two side-by-side subdirectories, and the files at the node labels v4 and v5 shared between them must be duplicated, that is, one copy in each of the two subdirectories. Then, the two subdirectories must be opened at the same time to see the shared files under them, which is very unintuitive.
[0146] Furthermore, when the graph structure is a weighted graph structure, it includes a weighted undirected graph and a weighted directed graph, and the graph structure module 2 is two array label files, one of which can describe the composition and mutual relationship of all node labels that establish the weighted graph structure in a top-down and left-to-right order, with each line describing the relationship between the root node and the branch node of the first-level node label, and the other array label file is used to record the weights between the label nodes in the previous array label file.
[0147] Similar to the description of the unweighted undirected graph mentioned above, since there is no directional relationship between any two node labels in a weighted undirected graph, the root node is actually the starting node of the relationship segment, and the branch node is the ending node of the relationship segment. The reason for distinguishing between the starting node and the ending node is just to describe the beginning and end of a segment.
[0148] Specifically, the root node label of each line of the array label file that describes the relationship between node labels can be fixed in the first place, and the remaining positions can be placed with branch node labels arranged in order from left to right. When the file is a two-dimensional array label file, each line can always check whether the situation in which the label of the earliest branch node in the previous line is the root node label has been described. If not, they are described line by line in order.
[0149] Specifically, when the graph structure module is two one-dimensional array label files, the two one-dimensional array label files can also be merged into one two-dimensional array label file, and each row corresponds to an original one-dimensional array label file. Similarly, when the graph structure module is two two-dimensional array label files, the two two-dimensional array label files can also be merged into one two-dimensional array label file, and the number of rows is the sum of the original two two-dimensional array label files, and the upper and lower parts correspond to the original two-dimensional array label files. The following is still discussed in terms of two one-dimensional array label files or two two-dimensional array label files.
[0150] For example, to create a weighted directed graph G3, Fig. 9 As shown, it includes 7 node labels v1, v2, ... v7 and the authorized relationship between them. This authorized relationship is expressed as the connection lines a1, a2, ... a9 between 9 nodes.
[0151] Suppose G3 is a project schedule, which is established to timely control the impact of different activities on the progress of the project. The 9 lines are 9 activities, and the 7 node labels represent 7 events. Each event indicates that the activity before it has been completed and the activity after it can start. For example, v1 indicates the start of the entire project, and v7 indicates the end of the entire project. The number associated with each activity is the time required to perform the activity. For example, the number of days required for each activity is: a1 requires 6 days, a2 requires 4 days, a3 requires 1 day, a4 requires 3 days, a5 requires 6 days, a6 requires 8 days, a7 requires 10 days, a8 requires 2 days, and a9 requires 7 days. At each event, a record of the previously completed activities and the file corresponding to the event must be placed. For example, these files are file 1, file 2, ... file 16, as shown in Table 10. In addition to the labels v1, v2, ...v7, the files in Table 10 may also have other labels. For example, file 1 has both v1 and Li labels. The Li label indicates that Li is responsible for this file. File 8 has both v2 and log1 labels. The log1 label indicates that it records the activities of a1.
[0152] Table 10
[0153]
[0154]
[0155] To build its graph structure module 2, two two-dimensional array label files need to be created. First, a file D7 describing the relationship between node labels is created. The specific steps are:
[0156] 1) The first line describes the situation where v1 is the root node and v2, v3 and v4 are branch nodes, so there is
[0157] {v1,v2,v3,v4};
[0158] 2) The second line first checks whether the first branch node v2 in the previous line is the root node. The check result shows that it is, so we have {v2,v5};
[0159] 3) The third line continues to check whether the second branch node v3 in the first line is the root node. The result of the check is that it is, so there is {v3,v6};
[0160] 4) The fourth line continues to check whether the second branch node v4 in the first line is the root node. The result of the check is that it is, so there is {v4,v6};
[0161] 5) The fifth line checks whether the branch node v5 in the previous line is the root node. The result of the check is that it is, so there is
[0162] {v5,v6,v7};
[0163] 6) The sixth line checks whether the branch node v6 in the previous line is the root node. The check result shows that it is, so there is
[0164] {v6,v7};
[0165] 7) Finally, check whether v7 is the root node. The result is that it is not, and all branch nodes in the previous row have been checked. Finally,
[0166] D7={{v1,v2,v3,v4},{v2,v5},{v3,v6},{v4,v6},{v5,v6,v7},{v6,v7}}. Then create a two-dimensional array label file D8 that describes the weights between node labels. The specific steps are:
[0167] 1) The first line checks the weights between the root node v1 and its branch nodes v2, v3, and v4 in D7, so we have {6, 4, 1};
[0168] 2) The second line checks the weight between the root node v2 and its branch node v5 in D7, so we have {3};
[0169] 3) The third line checks the weight between the root node v3 and its branch node v6 in D7, so we have {6};
[0170] 4) The fourth line checks the weight between the root node v4 and its branch node v6 in D7, so we have {8};
[0171] 5) The fifth line checks the weights between the root node v5 and its branch nodes v6 and v7 in D7, so we have {2,10};
[0172] 6) The sixth line checks the weight between the root node v6 and its branch node v7 in D7, so we have {7};
[0173] 7) Confirm that all nodes in D7 have been checked, and finally
[0174] D8={{6,4,1},{3},{6},{8},{2,10},{7}}.
[0175] According to the elements in the graph structure module D7 of G3, duplicate items are deleted and it is known that it contains node labels v1, v2, ... v7. The corresponding file is found in the label record module table 10, and then these selections are filled into table 10 to obtain table 11.
[0176] Table 11
[0177]
[0178]
[0179] When displaying the graph structure, in the graph module 4, a weighted directed graph is established according to D7 and D8 in the graph structure module 2, and then a graph structure including node labels and corresponding files under the node labels is established according to table 11 of the label recording module 1, as shown in FIG. Fig.10 shown.
[0180] For another example, an example of a weighted undirected graph in an embodiment of the present invention is a close relationship group graph G4 in QQ, such as Fig.11 As shown in the figure. In QQ, each contact has its own related files. The weights of contacts with close relationships can be set higher, and the weights of contacts with distant relationships can be set lower. One of the benefits of this is that when publishing a message, the audience can be selected according to the weight. For example Fig.11 There are four contacts Q1, Q2, Q3 and Q4, where Q1 is the root node label, and its branch node labels are Q2, Q3 and Q4. The weights between Q1 and them are a1, a2 and a3 respectively, and a1=5, a2=1, a3=3. The weight of Q1 and Q2 is 5, indicating that Q1 and Q2 are relatively close, the weight of Q3 is 1, indicating that the relationship between Q1 and Q3 is relatively distant, and the weight of Q4 is 3, indicating that the relationship between Q1 and Q4 is average.
[0181] For example, each contact has only one file and they have tags as shown in Table 12 of Tag Record Module 1:
[0182] Table 12
[0183] Files to be put into the graph structure Label Graph structure module information File 1 Q1 File 2 Q2 File 3 Q3 File 4 Q4
[0184] Then, the graph structure module 2 of G4 can be established as: D8 = {Q1, Q2, Q3, Q4}, and the information of D8 can be directly filled into Table 12 to form Table 13.
[0185] Table 13
[0186] Files to be put into the graph structure Label Graph structure module information File 1 Q1 D8 File 2 Q2 D8 File 3 Q3 D8 File 4 Q4 D8
[0187] When displaying, in the graph module 4, a weighted undirected graph is established according to D8, and then the graph structure can be obtained according to Table 13 as follows Fig.12 shown.
[0188] The embodiment of the present invention can select different tools for establishing node label relationships when establishing a graph structure in the graph module 4 to indicate that the graph structure is an unweighted undirected graph, or an unweighted directed graph, or a weighted undirected graph, or a weighted directed graph. For example, connecting two node labels with an unweighted straight line without an arrow indicates that there is an unweighted undirected relationship between them, connecting them with an unweighted straight line with an arrow indicates that there is an unweighted directed relationship between them and the arrow points from the root node to the branch node, connecting them with a weighted straight line without an arrow indicates that there is a weighted undirected relationship between them, and connecting them with a weighted straight line with an arrow indicates that there is a weighted directed relationship between them and the arrow points from the root node to the branch node.
[0189] Furthermore, the graph structure module 2 includes a graph type label of the graph structure, which is used to indicate whether the graph structure is an unweighted undirected graph, an unweighted directed graph, a weighted undirected graph, or a weighted directed graph.
[0190] Specifically, the graphic label can be represented by the following tags:
[0191] 0: unweighted undirected graph, which is the default setting of the graph type label. That is, the graph structure when there is no graph type label in the graph structure module 2 is an unweighted undirected graph;
[0192] 1: Unweighted directed graph;
[0193] 2: Powerful undirected graph;
[0194] 3: Weighted directed graph.
[0195] The graphic label of the graph structure can be fixedly placed in the first position of the first line of the array label file describing the relationship between the node label root node and the branch node in the graph structure module 2. In this case, the root node label position of the first line in the above example can be moved back one position to the second position of the first line, and the label position in the corresponding label recording module 1 needs to be changed, for example:
[0196] The graph structure module D4 of the unweighted directed graph G1 can be changed to {{1,A,D,B},{D,E},{E,A}}, where 1 indicates that this is an unweighted directed graph, the position of label A in the label recording module 1 is changed from D4(0,0) to D4(0,1), the position of label B is changed from D4(0,2) to D4(0,3), and the position of label D is changed from D4(0,1) to D4(0,2), and Table 7 is changed to Table 14;
[0197] Table 14
[0198] File Identification Label Graph structure module information File 1 B D4(0,3) File 2 C,E D4(1,1) File 3 A,D,E D4(0,1) File 4 D D4(0,2)
[0199] The graph structure module D6 of the unweighted undirected graph G2 can be changed to {{0, A, L, B, N}, {L, F, H}, {D, B, N}} or remain unchanged, where 0 or the default indicates that this is an unweighted undirected graph;
[0200] The graph structure module D7 of the weighted directed graph G3 can be transformed into
[0201] {{3,v1,v2,v3,v4},{v2,v5},{v3,v6},{v4,v6},{v5,v6,v7},{v6,v7}}, where 3 indicates that this is a weighted directed graph;
[0202] The graph structure module D8 of the weighted undirected graph G4 can be changed to {2, Q1, Q2, Q3, Q4}.
[0203] In the graph module 4, a new graph structure can be created, or an already created graph structure file stored in a file can be called out and displayed. After the graph structure module 2 contains the graph type tag, it completely describes a graph structure with a file. Then, calling the graph structure module 2 in the graph module 4 can find the corresponding file in the tag record module 1 and display the complete graph structure with a file.
[0204] Furthermore, a graph structure can also be composed of different types of graph structures. A set of node label root nodes and branch node relationships in the graph structure module 2 can include a graph label of a graph structure, while other groups of node relationships contain different graph labels. If this is done, then each group of node relationships must include a graph label, and those that do not include it will be considered as the default unweighted undirected graph.
[0205] For example, if the graph structure module D4 of the unweighted directed graph G1 is changed to
[0206] D40={{1,A,D,B},{2,D,E},{E,A}}
[0207] Then G1 is no longer all unweighted directed graphs, but only the first group {1, A, D, B} is an unweighted directed graph, the second group {2, D, E} is a weighted undirected graph, and the third group {E, A} is an unweighted undirected graph. Since the second group is a weighted graph, an array label file needs to be added, in which a special label can be used to represent the weight of the unweighted graph. Assuming that the weight between D and E is a1 and a1 = 5, the special label of the unweighted graph is -1, then the added array label file is:
[0208] D41={{-1},{5},{-1}}
[0209] Now D40 and D41 together form the graph structure module 2 of G1. The corresponding graph structure is as follows Fig.13 In particular, since the third group {E, A} of D40 is an unweighted undirected graph in which the start and end nodes of the relationship segments can be interchanged, this third group can also be {A, E}.
[0210] Furthermore, a graph structure can be decomposed into multiple graph structures by decomposing the graph structure module 2, and in this case, the corresponding content in the label recording module 1 needs to be changed.
[0211] For example, the graph structure module D6 = {{A, L, B, N}, {L, F, H}, {D, B, N}} of graph G2 can be decomposed into:
[0212] D60={{A,L,B,N},{L,F,H}}
[0213] D61={D,B,N}
[0214] The corresponding table 9 of the label recording module 1 becomes table 15, and the corresponding graph structure is as follows Fig.14 and Fig.15 As shown, Fig.14 Corresponding to the graph structure module D60, Fig.15 Corresponding graph structure module D61.
[0215] Table 15
[0216]
[0217]
[0218] Furthermore, multiple graph structures can be combined into one graph structure by merging the graph structure module 2 , and in this case, the corresponding content in the label recording module 1 also needs to be changed.
[0219] For example, the graph structure module D6 = {{A, L, B, N}, {L, F, H}, {D, B, N}} of the graph G2 can be merged with another graph structure module, such as {D, C, J}. Since {D, B, N} and {D, C, J} are adjacent, they can be merged, so we have:
[0220] D62={{A,L,B,N},{L,F,H},{D,B,N,C,J}}
[0221] Assuming that file 2 is placed at label node C and file 3 is placed at label node J, then the corresponding table 9 of label recording module 1 becomes table 16, and the corresponding graph structure is as follows: Fig.16 shown.
[0222] Table 16
[0223]
[0224]
[0225] Furthermore, although the four modules included in the embodiment of the present invention, namely the graph module 4, the label recording module 1, the graph structure module 2 and the graph construction module 3, can exist independently, if they are included in the user interface of the graph module 4, unified scheduling of the operations of each module can be achieved, making the completion of the graph structure construction more convenient.
[0226] Specifically, the user interface of the graph module 4 may have the function of an input / output module, and selectively input / output one or more of the label recording module 1, the graph structure module 2 and the graph construction module 3 as needed.
[0227] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A method for constructing a file system graph structure, characterized in that: include: The label recording module is used to record the corresponding relationship between files and labels; A graph structure module is used to describe the label composition and mutual relationship at the nodes of a graph structure. The labels at the nodes of the graph structure are called node labels. The label recording module is also used to record the graph structure module information. A graph construction module, configured to select a corresponding file in the tag recording module according to the node tag in the graph structure module, and record graph structure module information corresponding to the file in the tag recording module; The graph structure module information includes a module identifier of the graph structure module and location information of a node tag in the graph structure module used to select a file from the tag record module; Wherein, the file in the label recording module has a corresponding relationship with the physical address where the file is stored; Wherein, the graph structure is an unweighted graph structure or a weighted graph structure; The unweighted graph structure includes an unweighted undirected graph and an unweighted directed graph, and the graph structure module is an array label file, which describes the composition and mutual relationship of all node labels for establishing the unweighted graph structure in a certain order in a manner that each line describes the relationship between the root node and the branch node of the first-level node label; each line in the graph structure module has only one root node label fixed in one position, and the remaining labels are branch node labels arranged in a certain order; Among them, the weighted graph structure includes a weighted undirected graph and a weighted directed graph; the graph structure module is two array label files, one of which describes the composition and mutual relationship of all node labels for establishing the weighted graph structure in a certain order in which each line describes the relationship between the root node and branch node of the first-level node label, and each line in the graph structure module has only one root node label fixed in one position, and the remaining labels are branch node labels arranged in a certain order; the other array label file is used to record the weights between label nodes in the previous array label file.
2. A method for constructing a file system graph structure according to claim 1, characterized in that: Also includes: A graph module, used for establishing and / or displaying a graph structure including the node labels and the relationships between the node labels; The graph module has a user interface, which includes a tool for establishing the node labels, a tool for establishing the relationship between the node labels, and a tool for establishing a space for accommodating files under the node labels after the node labels are established, wherein the space for accommodating files is called a file space; The graph module is further used to display the content of the graph structure module as a graph structure, and to add corresponding files to the file space under the node tag of the graph structure according to the graph structure module information of the graph structure module in the tag recording module; There is a corresponding relationship between the file in the file space under the node tag and the physical address where the file is stored.
3. The method for constructing a file system graph structure according to claim 1, characterized in that: The graph structure module includes a graph type label of the graph structure, which is used to indicate whether the graph structure is an unweighted undirected graph, an unweighted directed graph, a weighted undirected graph, or a weighted directed graph.
4. The method for constructing a file system graph structure according to claim 1, characterized in that: A group of node label root nodes and branch node relationships in the graph structure module include a graph label of the graph structure, which is used to indicate whether the relationship within the node label group in the graph structure is an unweighted undirected graph, an unweighted directed graph, a weighted undirected graph, or a weighted directed graph.
5. The method for constructing a file system graph structure according to claim 1, characterized in that: The graph structure may be decomposed into several graph structures by decomposing the graph structure module and changing the corresponding content in the tag recording module.
6. The method for constructing a file system graph structure according to claim 1, characterized in that: The graph structure can be merged into one graph structure by merging the graph structure modules with other graph structures and changing the corresponding contents in the tag recording modules.
7. The method for constructing a file system graph structure according to claim 2, characterized in that: The process of creating a new file system graph structure through the user interface in the graph module is as follows: Create the node label; Establishing a relationship between the node labels; Establish file spaces for accommodating files under each of the node labels according to needs; Selecting the file corresponding to the node label in the label recording module and placing the file into the corresponding file space; The newly created node label and the relationship between the node labels are stored as the graph structure module, and the graph construction module is used to update the graph structure module information of the file corresponding to the node label in the label recording module.
8. The method for constructing a file system graph structure according to claim 2, characterized in that: The user interface of the graph module may include one or more of the tag recording module, the graph structure module and the graph construction module.
