28.3 Exporting Graphs Into a File
The graph server (PGX) allows the client to export a currently loaded graph into a file.
Using the store()
method on any PgxGraph object, the client can specify which file format to store the graph in. The client can also dynamically select the set of properties to be stored with the graph, that is, not all the properties need to be exported. The client can specify a CompressionScheme to use when storing as shown:
Table 28-20 Files CompressionScheme
CompressionScheme | Supported Formats |
---|---|
NONE |
All formats |
GZIP |
ADJ_LIST , EDGE_LIST , FLAT_FILE , TWO_TABLES (text) |
The client can export to multiple files as well.
When PGX exports the specified graph into a file, PGX also creates a graph config which the client receives as return value. This is to help loading the created graph instance later.
When exporting graph data into multiple files a FileGraphStoringConfig
can be used which contains the following JSON fields:
Table 28-21 Graph Configuration when Exporting Graph into Multiple Files
Field | Type | Description | Default |
---|---|---|---|
base_path | string | Base path to use for storing a graph; file paths will be constructed using the following format _._ , that is, parent_path/my_graph_1.edges .
|
null |
compression_scheme | enum[none, gzip] | The scheme to use for compression, or none to disable compression. | none |
delimiter | character | Delimiter character used as separator when storing. The characters " , { , } and \n cannot be used as delimiters.
|
null |
edge_extension | string | The extension to use when creating edge file partitions. | edges |
initial_partition_index | integer | The value used as initial partition index, that is, initial_partition_index=1024 -> my_graph_1024.edges, my_graph_1025.edges .
|
1 |
num_partitions | integer | The number of partitions that should be created, when exporting to multiple files. | 1 |
row_extension | string | The extension to use when creating row file partitions. | rows |
vertex_extension | string | The extension to use when creating vertex file partitions. | nodes |