A SQLite-like tool for querying graphs from the command-line using graph query languages in in-memory Python.
Supports out-of-core graphs with Grand.
$ pip install grandlite
$ poetry run grandlite --stats 'h-edgelist(pre:post)://white_1986_n2u.csv'
Nodes: 221
Edges: 1855
Density: 0.038153023447141096
Orphans: 0
Leaves: 7
Max degree: 44
Max node: RIMR
Self-loops: 52
$ grandlite my-graph.graphml
> match (a)-[]->(b) return a,b limit 3
a b
0 023620 364605
1 023620 438847
2 023620 462336
> save results.json
> exit()
Note that save [filename]
will output csv
, json
, and jsonl
files, depending on the extension provided; or will default to results-XXXX.json
with XXX as a timestamp in ISO format, if no filename is provided.
For more information about saving, see the docs.
$ grandlite --help
usage: An interactive graph query tool for Cypher and other query languages.
[-h]
[-o {csv,json,jsonl}]
[-q QUERY]
[-l {cypher,dotmotif}]
[--stats]
[--convert OUTPUT_FILENAME]
graph
positional arguments:
graph The filename of the graph to load.
options:
-h, --help show this help message and exit
-o {csv,json,jsonl}, --output {csv,json,jsonl}
The output format to use.
-q QUERY, --query QUERY
If not provided, enters an interactive prompt.
-l {cypher,dotmotif}, --language {cypher,dotmotif}
The query language to use (default: cypher).
--stats Print statistics about the graph and exit.
--convert OUTPUT_FILENAME
Convert the graph to a new format, save to the
output filename specified, and exit.
Grandlite supports a growing variety of input formats. For a complete list, see the docs.
$ grandlite 'vertex:vertices.csv;edge:edges.csv'
$ grandlite 'h-edgelist(pre:post)://white_1986_n2u.csv'