Graph Store
Graph Storage
GraphStore provides named, persistent storage for NetworkX graphs, backed by AWS S3.
Just like the DataFrame Store handles named DataFrames, the GraphStore class lets your team list, add, retrieve, and delete named NetworkX graphs from a shared, inspectable location.
Workbench REPL
Experiment with listing, adding, and getting graphs using the GraphStore() class in the Workbench REPL.
GraphStore: Storage for NetworkX Graphs
GraphStore
Bases: AWSGraphStore
GraphStore: Storage for NetworkX Graphs
Common Usage
Source code in src/workbench/api/graph_store.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
__init__(path_prefix=None)
GraphStore Init Method
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path_prefix
|
Optional[str]
|
Path prefix for storage locations (Defaults to None) |
None
|
Source code in src/workbench/api/graph_store.py
check(location)
Check if a graph exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
str
|
Logical location of the graph. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the graph exists, False otherwise. |
delete(location)
Delete a NetworkX graph from AWS S3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
str
|
Logical location of the graph to delete. |
required |
details()
Return detailed metadata for all stored graphs.
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: DataFrame with details like location, size, and last modified date. |
get(location)
Retrieve a NetworkX graph from AWS S3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
str
|
Logical location of the graph. |
required |
Returns:
| Type | Description |
|---|---|
Union[Graph, None]
|
Union[nx.Graph, None]: The retrieved graph or None if not found. |
Source code in src/workbench/api/graph_store.py
last_modified(location)
Return the last modified date of a graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
str
|
Logical location of the graph. |
required |
Returns:
| Type | Description |
|---|---|
Union[datetime, None]
|
Union[datetime, None]: Last modified datetime or None if not found. |
Source code in src/workbench/api/graph_store.py
list()
List all graphs in the store.
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
A list of all graph locations in the store. |
summary()
Provide a summary of all graphs in the store.
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: Summary DataFrame with location, size, and modified date. |
upsert(location, graph)
Insert or update a NetworkX graph in AWS S3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
str
|
Logical location to store the graph. |
required |
graph
|
Graph
|
The NetworkX graph to store. |
required |