Save graph to specified location with specified format. Args: path (str): the directory path to write graph. format (str): the format to write graph, default is "serialization". selector (dict, optional): the selector to select the data to write.
(
self,
path,
format="serialization",
**kwargs,
)
| 1246 | return sess._wrapper(GraphDAGNode(sess, op)) |
| 1247 | |
| 1248 | def save_to( |
| 1249 | self, |
| 1250 | path, |
| 1251 | format="serialization", |
| 1252 | **kwargs, |
| 1253 | ): |
| 1254 | """Save graph to specified location with specified format. |
| 1255 | |
| 1256 | Args: |
| 1257 | path (str): the directory path to write graph. |
| 1258 | format (str): the format to write graph, default is "serialization". |
| 1259 | selector (dict, optional): the selector to select the data to write. |
| 1260 | graphar_graph_name (str, optional): the name of graph in graphar format. |
| 1261 | graphar_file_type (str, optional): the file type of graphar format, |
| 1262 | support "parquet", "orc", "csv", default is "parquet". |
| 1263 | graphar_vertex_chunk_size (int, optional): the chunk size of vertex in graphar format, default is 2^18. |
| 1264 | graphar_edge_chunk_size (int, optional): the chunk size of edge in graphar format, default is 2^22. |
| 1265 | graphar_store_in_local (bool, optional): whether store graphar format in local, default is False. |
| 1266 | |
| 1267 | Return (dict): A dict contains the type and uri string of output data. |
| 1268 | """ |
| 1269 | |
| 1270 | def _check_write_options(write_options): |
| 1271 | for k, v in write_options.items(): |
| 1272 | if k == "graphar_graph_name" and not isinstance(v, str): |
| 1273 | raise ValueError( |
| 1274 | "graphar_graph_name should be a string, but got {}".format( |
| 1275 | type(v) |
| 1276 | ) |
| 1277 | ) |
| 1278 | elif k == "graphar_file_type" and v not in ["parquet", "orc", "csv"]: |
| 1279 | raise ValueError( |
| 1280 | "graphar_file_type should be one of ['parquet', 'orc', 'csv'], but got {}".format( |
| 1281 | v |
| 1282 | ) |
| 1283 | ) |
| 1284 | elif k == "graphar_vertex_chunk_size": |
| 1285 | if not isinstance(v, int) or v <= 0: |
| 1286 | raise ValueError( |
| 1287 | "graphar_vertex_chunk_size should be a positive integer, but got {}".format( |
| 1288 | v |
| 1289 | ) |
| 1290 | ) |
| 1291 | elif k == "graphar_edge_chunk_size": |
| 1292 | if not isinstance(v, int) or v <= 0: |
| 1293 | raise ValueError( |
| 1294 | "graphar_edge_chunk_size should be a positive integer, but got {}".format( |
| 1295 | v |
| 1296 | ) |
| 1297 | ) |
| 1298 | elif k == "graphar_store_in_local": |
| 1299 | if not isinstance(v, bool): |
| 1300 | raise ValueError( |
| 1301 | "graphar_store_in_local should be a bool, but got {}".format( |
| 1302 | v |
| 1303 | ) |
| 1304 | ) |
| 1305 | elif k == "selector": |