Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

RedisGraph githubactions

A RedisGraph client implementation library in Elixir.


The redisgraph package can be installed by adding redisgraph to your list of dependencies in mix.exs:

def deps do
    {:redisgraph, "~> 0.1.0"}

Documentation can be found at

Example usage

This library uses Redix to communicate with a redisgraph server.

To launch redisgraph locally, use

docker run -p 6379:6379 -it --rm redislabs/redisgraph

Here is a simple example:

alias RedisGraph.{Node, Edge, Graph, QueryResult}

# Create a connection using Redix
{:ok, conn} = Redix.start_link("redis://localhost:6379")

# Create a graph
graph ={
  name: "social"

# Create a node
john ={
  label: "person",
  properties: %{
    name: "John Doe",
    age: 33,
    gender: "male",
    status: "single"

# Add the node to the graph
# The graph and node are returned
# The node may be modified if no alias has been set
# For this reason, nodes should always be added to the graph
# before creating edges between them.
{graph, john} = Graph.add_node(graph, john)

# Create a second node
japan ={
  label: "country",
  properties: %{
    name: "Japan"

# Add the second node
{graph, japan} = Graph.add_node(graph, japan)

# Create an edge connecting the two nodes
edge ={
  src_node: john,
  dest_node: japan,
  relation: "visited"

# Add the edge to the graph
# If the nodes are not present, an {:error, error} is returned
{:ok, graph} = Graph.add_edge(graph, edge)

# Commit the graph to the database
{:ok, commit_result} = RedisGraph.commit(conn, graph)

# Print the transaction statistics

# Create a query to fetch some data
query = "MATCH (p:person)-[v:visited]->(c:country) RETURN, p.age, v.purpose,"

# Execute the query
{:ok, query_result} = RedisGraph.query(conn,, query)

# Pretty print the results using the Scribe lib

which gives the following results:

# Commit result statistics
  "Labels added" => nil,
  "Nodes created" => "2",
  "Nodes deleted" => nil,
  "Properties set" => "5",
  "Query internal execution time" => "0.228669",
  "Relationships created" => "1",
  "Relationships deleted" => nil

# Query result pretty-printed
| ""       | "p.age"     | "v.purpose"     | ""     |
| "John Doe"     | 33          | nil             | "Japan"      |


RedisGraph is licensed under MIT.