Memgraph Documentation

website·Indexed 35 days ago

https://memgraph.com/docs

Memgraph is a high-performance, in-memory graph database designed to power real-time AI context. The documentation covers installation across Docker, Kubernetes, and various Linux distributions (Debian, Ubuntu, CentOS, Fedora, Red Hat), as well as Memgraph Cloud management. It provides comprehensive guides for client libraries in Python, JavaScript, Node.js, Java, Go, Rust, C#, and PHP, and details the AI ecosystem including GraphRAG and knowledge graph creation.

Tokens
474.1K
Snippets
2.4K
Records
3.6K
Agent score
71%

What's inside Memgraph

  1. Overview of Memgraph custom query modules

    Memgraph allows extending the Cypher query language with user-written procedures grouped into query modules. These modules can be written in C, C++, Python, and Rust.

    • Compiled Languages (C, C++, Rust): Offer faster execution but are more challenging to write and debug. They result in .so shared library files.
    • Interpreted Languages (Python): Offer easier writing and debugging but have slower execution. They result in .py files.

    Naming and Mapping:

    • The filename determines the module name. For example, example.so or example.py is mapped to the example module.
    • A procedure named procedure within that file is called in Cypher as example.procedure().
    • A single module file can contain multiple read/write procedures and functions.
  2. Overview of Memgraph Cypher clauses

    Memgraph uses the Cypher language to perform database operations. The available clauses include:

    • ALTER: Modify existing enum definitions.
    • CALL: Execute a subquery within a query.
    • CASE: Create conditional expressions.
    • CREATE: Create new nodes and relationships.
    • DELETE: Delete nodes and relationships.
    • DROP: Remove constraints, indexes, or the entire database.
    • EXPLAIN: Inspect a query's execution plan.
    • FOREACH: Iterate over a list of elements.
    • LOAD CSV: Import data from a CSV file.
    • MATCH: Search for patterns.
    • MERGE: Ensure a pattern exists (creates it if it does not).
    • OPTIONAL MATCH: Search for patterns, filling missing parts with nulls if not found.
    • PROFILE: Generate a detailed report on query plan behavior.
    • REMOVE: Remove labels and properties.
    • RETURN: Define the result set to be presented to the user.
    • SET: Add or update labels and properties.
    • UNION / UNION ALL: Combine results from multiple queries.
    • UNWIND: Expand a list of values into individual rows.
    • WHERE: Filter matched data.
    • WITH: Chain multiple read and write operations.
    • USING PERIODIC COMMIT num_rows: Batch a query for periodic execution.
    • CALL {subquery} IN TRANSACTIONS OF num_rows ROWS: Batch a subquery for periodic execution.
  3. Overview of Memgraph Enterprise features

    Memgraph Enterprise unlocks advanced capabilities across several categories:

    • Security: Role-based access control (RBAC), Label-based access control (LBAC), Property-based access control (PBAC), multi-role/multi-tenant roles, authentication integrations (LDAP, SAML, OIDC), user impersonation, and hiding sensitive information.
    • Logging & Monitoring: Audit logs and Prometheus integration via HTTP server metrics.
    • Database Management: High availability with automatic failover, multi-tenancy, tenant profiles, and CRON snapshot scheduling.
    • Querying: Dynamic graph algorithms, Time-to-live (TTL) for data expiration, and parallel execution.
    • Memgraph Lab: Real-time performance monitoring, query and GSS sharing, and SSO support (OIDC, SAML).
  4. Overview of graph_analyzer metrics

    The graph_analyzer module extracts structural properties from an undirected, unweighted graph. The available analytics include:

    • nodes: Number of nodes
    • edges: Number of relationships
    • bridges: Number of bridges
    • articulation_points: Number of articulation points
    • avg_degree: Average degree
    • sorted_nodes_degree: Sorted nodes degree
    • self_loops: Self loops
    • is_bipartite: Whether the graph is bipartite
    • is_plannar: Whether the graph is planar
    • is_biconnected: Whether the graph is biconnected
    • is_weakly_connected: Whether the graph is weakly connected
    • number_of_weakly_components: Number of weakly connected components
    • is_strongly_connected: Whether the graph is strongly connected
    • strongly_components: Number of strongly connected components
    • is_dag: Whether the graph is a directed acyclic graph (DAG)
    • is_eulerian: Whether the graph is eulerian
    • is_forest: Whether the graph is a forest
    • is_tree: Whether the graph is a tree
  5. Overview of Time-to-Live (TTL) in Memgraph Enterprise

    Time-to-Live (TTL) allows vertices and edges to be tagged with an expiration time. When a vertex expires, it and all its associated edges are deleted. TTL is implemented as a background job that periodically executes deletions; therefore, objects are deleted eventually after expiration, not necessarily immediately.

    Important Constraints:

    • The label TTL and property ttl are reserved for this feature.
    • TTL is a best-effort background process.
    • In v3.5.0, TTL durability was changed; users upgrading from earlier versions must reconfigure TTL.
  6. Introduction to Knowledge Graph modeling in Memgraph

    A knowledge graph (KG) is a structured representation of information where entities (nodes), their relationships, and properties are organized to enable reasoning and insights. In Memgraph, knowledge graphs are implemented using the Labeled Property Graph (LPG) model, which supports dynamic schema evolution and high-performance deep path traversals. This approach is generally more flexible than the Resource Description Framework (RDF) for modern applications.
  7. Overview of node2vec for network embeddings

    node2vec is a semi-supervised framework that maps nodes to a low-dimensional feature space while preserving network neighborhoods. It uses biased random walks to capture two types of similarities:

    • Homophily: Nodes that are highly interconnected or belong to the same community are embedded closely. This is captured using a DFS-like strategy (prioritize when q < 1).
    • Structural Equivalence: Nodes with similar structural roles (e.g., hubs) are embedded closely. This is captured using a BFS-like strategy (prioritize when p < 1).

    It supports directed/undirected graphs and weighted/unweighted edges.

  8. Overview of Memgraph embeddings module

    The embeddings module computes sentence embeddings for text, supporting two backends:

    • Local (Default): Uses SentenceTransformer models from Hugging Face running on CPU or CUDA within the Memgraph process.
    • Remote: Supports any provider compatible with LiteLLM (e.g., OpenAI, Ollama, Voyage, Mistral, Bedrock).

    Routing is determined by the model_name configuration: a LiteLLM-style provider prefix (e.g., openai/text-embedding-3-small) triggers a remote call; a bare name or Hugging Face path (e.g., all-MiniLM-L6-v2 or BAAI/bge-small-en-v1.5) loads the model locally.

  9. Overview of Server-side Descriptions

    Server-side descriptions are durable, human-readable strings attached to schema elements in Memgraph. They are persisted to disk (WAL and snapshots), replicated, and included in DUMP DATABASE exports. They are primarily used to document the data model for human developers and AI-driven tools (like LLM clients, GraphChat, and MCP) that consume SHOW SCHEMA INFO.
  10. Overview of Online Community Detection (LabelRankT)

    The community_detection_online module implements the LabelRankT dynamic community detection algorithm. It is a label propagation algorithm where nodes determine their communities by learning from neighbors. It is designed for large-scale graphs and is ideal for streaming platforms because it only processes sections of the graph affected by updates. The algorithm is deterministic and supports both directed/undirected and weighted/unweighted graphs. Note: This is a Memgraph Enterprise feature and requires an Enterprise license.
  11. Overview of Memgraph data stream ingestion

    Memgraph can connect to Kafka, Redpanda, and Pulsar sources to ingest data for querying with MAGE algorithms or custom procedures. To implement a stream, a user must follow these steps:

    1. Create a transformation module.
    2. Load the transformation module into Memgraph.
    3. Create the stream using a CREATE <streaming platform> STREAM query.
    4. Start the stream using a START STREAM query.