Skip to content
Jordan Matelsky edited this page Aug 28, 2024 · 2 revisions

DotMotif comes with a Neo4jExecutor to enable motif queries in a Neo4j database. This tool makes certain assumptions about your Neo4j database (implementation details here).

If you do not have a Neo4j database but want to use some of the performance advantages of a graph database, DotMotif prior to v0.15.0 also includes the logic to provision a Docker container and ingest a dataset from a CSV edgelist, NetworkX dataset, or pandas DataFrame.

As of version v0.15.0 this logic has been extracted to a separate tool Tamarind.

With the Docker daemon running, you can simply pass a graph as usual to a Neo4jExecutor:

from dotmotif import Neo4jExecutor

E = Neo4jExecutor(graph=...)

If you specify the graph argument, DotMotif will provision a container and perform the ingest.


If you are running DotMotif inside a Docker container itself (e.g., issue #24) you must either allow that Docker container to communicate with the Docker host, or you must point instead to a remote Neo4j instance.

Option 1: Mounting Docker host inside container

Mount the following volumes to the container:

-v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker

Option 2: Point to a remote Neo4j instance:

You can use the following Neo4jExecutor configuration:

Neo4jExecutor(
    # (str): If connecting to an existing server, the URI
    #        of the server (including the port, probably 7474)
    db_bolt_uri="...", 
    # (str: "neo4j"): The username to use to attach to an
    #        existing server
    username="your_neo4j_username", 
    # (str): The password to use to attach to an existing server
    password="your_neo4j_password"
)