diff --git a/mage/query-modules/cpp/label.md b/mage/query-modules/cpp/label.md new file mode 100644 index 00000000000..90d08309711 --- /dev/null +++ b/mage/query-modules/cpp/label.md @@ -0,0 +1,65 @@ +--- +id: label +title: label +sidebar_label: label +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import RunOnSubgraph from '../../templates/_run_on_subgraph.mdx'; + +export const Highlight = ({children, color}) => ( + +{children} + +); + +Labels are used to categorize nodes, and the `label` module provides an array of utilities for working with labels in a Memgraph database. + + +[![docs-source](https://img.shields.io/badge/source-label-FB6E00?logo=github&style=for-the-badge)](https://github.com/memgraph/mage/tree/main/cpp/label_module) + +| Trait | Value | +| ------------------- | ----------------------------------------------------- | +| **Module type** | **algorithm** | +| **Implementation** | **C++** | +| **Graph direction** | **directed**/**undirected** | +| **Edge weights** | **weighted**/**unweighted** | +| **Parallelism** | **sequential** | + +### Procedures + +### `exists(node, label)` + +Checks whether a specified label exists within the provided node. + +#### Input: + +- `node: Any` ➡ node whose labels are to be checked. +- `label: string` ➡ name of the label whose existence is to be confirmed. + +#### Output: + +- `exists: bool` ➡ whether or not provided node has a specified label. + +#### Usage: + +```cypher +CREATE (:Student {name: 'Ana'}); +MATCH (s:Student {name: 'Ana'}) CALL label.exists(s, "Teacher") YIELD exists RETURN exists; +``` + +```plaintext ++----------------------------+ +| exists | ++----------------------------+ +| False | ++----------------------------+ +``` + diff --git a/mage/templates/_mage_spells.mdx b/mage/templates/_mage_spells.mdx index 6410d941190..e1aae71aca7 100644 --- a/mage/templates/_mage_spells.mdx +++ b/mage/templates/_mage_spells.mdx @@ -15,6 +15,7 @@ | [graph_coloring](/mage/query-modules/python/graph-coloring) | Python | Algorithm for assigning labels to the graph elements subject to certain constraints. In this form, it is a way of coloring the graph vertices such that no two adjacent vertices are of the same color. | | [katz_centrality](/mage/query-modules/cpp/katz-centrality) | C++ | Katz centrality is a centrality measurement that outputs a node's influence based on the number of shortest paths and their weighted length. | | [kmeans](/mage/query-modules/python/kmeans) | Python | An algorithm for clustering given data. | +| [label](/mage/query-modules/cpp/label) | C++ | The label module provides an array of utilities for working with labels in a Memgraph database. | | [map](/mage/query-modules/cpp/map) | C++ | The map module offers a versatile toolkit for manipulating collections of key-value pairs, enabling advanced data operations within a graph database context | | [max_flow](/mage/query-modules/python/max-flow) | Python | An algorithm for finding a flow through a graph such that it is the maximum possible flow. | | [node_similarity](/mage/query-modules/cpp/node-similarity) | C++ | A module that contains similarity measures for calculating the similarity between two nodes. | diff --git a/package-lock.json b/package-lock.json index 94a01e30b54..a85fa60513b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5888,14 +5888,14 @@ } }, "node_modules/docusaurus-plugin-sass": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/docusaurus-plugin-sass/-/docusaurus-plugin-sass-0.2.2.tgz", - "integrity": "sha512-ZZBpj3PrhGpYE2kAnkZB9NRwy/CDi4rGun1oec6PYR8YvGzqxYGtXvLgHi6FFbu8/N483klk8udqyYMh6Ted+A==", + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/docusaurus-plugin-sass/-/docusaurus-plugin-sass-0.2.5.tgz", + "integrity": "sha512-Z+D0fLFUKcFpM+bqSUmqKIU+vO+YF1xoEQh5hoFreg2eMf722+siwXDD+sqtwU8E4MvVpuvsQfaHwODNlxJAEg==", "dependencies": { "sass-loader": "^10.1.1" }, "peerDependencies": { - "@docusaurus/core": "^2.0.0-beta", + "@docusaurus/core": "^2.0.0-beta || ^3.0.0-alpha", "sass": "^1.30.0" } }, @@ -17485,9 +17485,9 @@ } }, "docusaurus-plugin-sass": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/docusaurus-plugin-sass/-/docusaurus-plugin-sass-0.2.2.tgz", - "integrity": "sha512-ZZBpj3PrhGpYE2kAnkZB9NRwy/CDi4rGun1oec6PYR8YvGzqxYGtXvLgHi6FFbu8/N483klk8udqyYMh6Ted+A==", + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/docusaurus-plugin-sass/-/docusaurus-plugin-sass-0.2.5.tgz", + "integrity": "sha512-Z+D0fLFUKcFpM+bqSUmqKIU+vO+YF1xoEQh5hoFreg2eMf722+siwXDD+sqtwU8E4MvVpuvsQfaHwODNlxJAEg==", "requires": { "sass-loader": "^10.1.1" } diff --git a/sidebars/sidebarsMAGE.js b/sidebars/sidebarsMAGE.js index 72781b4703b..eb5d4b44350 100644 --- a/sidebars/sidebarsMAGE.js +++ b/sidebars/sidebarsMAGE.js @@ -47,6 +47,7 @@ module.exports = { "query-modules/cpp/katz-centrality", "query-modules/cpp/katz-centrality-online", "query-modules/python/kmeans", + "query-modules/cpp/label", "query-modules/python/link-prediction-with-gnn", "query-modules/python/llm-util", "query-modules/cpp/map",