From 4a4d583504e94911f814efea60a734209db0f1ce Mon Sep 17 00:00:00 2001 From: Roi Lipman Date: Thu, 16 Jan 2025 22:18:53 +0200 Subject: [PATCH 1/7] Algorithms section & degree docs --- algorithms/degree.md | 149 +++++++++++++++++++++++++++++++++++++++++++ algorithms/index.md | 0 2 files changed, 149 insertions(+) create mode 100644 algorithms/degree.md create mode 100644 algorithms/index.md diff --git a/algorithms/degree.md b/algorithms/degree.md new file mode 100644 index 0000000..bf418ae --- /dev/null +++ b/algorithms/degree.md @@ -0,0 +1,149 @@ +# Degree Procedure Documentation + +## Introduction + +The **Degree Procedure** calculates the degree of nodes in a graph based on the specified parameters. +This allows users to analyze the connectivity of nodes in terms of incoming or outgoing edges, filtered by node labels and relationship types. + +--- + +## Use Cases + +Here are some practical scenarios where the **Degree Procedure** can be applied: + +1. **Social Network Analysis**: Identify influencers or highly connected individuals by calculating the degree of `Person` nodes in a social graph. +2. **Infrastructure Planning**: Determine bottlenecks in a transportation network by analyzing nodes with high incoming or outgoing connections. +3. **E-commerce Recommendations**: Identify popular products or categories by computing the degree of `Product` or `Category` nodes based on customer interactions. +4. **Fraud Detection**: Spot suspicious activities by analyzing nodes with unusually high degrees in financial transaction graphs. + +--- + +## Syntax + +```plaintext +CALL algo.degree(config) +``` + +### Parameters + +The `config` parameter is a Map object containing the following optional keys: + +| Key | Type | Default | Description | +| ------------- | ------ | ---------- | ---------------------------------------------------------------------- | +| `source` | String | `null` | Specifies the label of nodes for which the degree is computed. | +| `dir` | String | `outgoing` | Direction of edges to consider: `incoming` or `outgoing`. | +| `relation` | String | `null` | Specifies the type of edges to consider. | +| `destination` | String | `null` | Specifies the label of nodes reachable via the edges being considered. | + +--- + +## Output + +The procedure returns a result set where each row corresponds to a node and includes the following fields: + +| Field | Type | Description | +| -------- | ---- | -------------------------------- | +| `node` | Node | The Node object. | +| `degree` | Int | The computed degree of the node. | + +--- + +## Setting Up the Graph + +To run the examples below, create the following graph structure: + +### Nodes: + +| ID | Label | +| -- | ------ | +| 1 | Person | +| 2 | Person | +| 3 | City | +| 4 | City | + +### Relationships: + +| Source | Target | Type | +| ------ | ------ | ------- | +| 1 | 2 | FRIEND | +| 1 | 3 | VISITED | +| 2 | 3 | VISITED | +| 2 | 4 | VISITED | + +Create this graph using the following commands: + +```plaintext +CREATE (:Person {id: 1}) +CREATE (:Person {id: 2}) +CREATE (:City {id: 3}) +CREATE (:City {id: 4}) +CREATE (p1:Person {id: 1})-[:FRIEND]->(p2:Person {id: 2}) +CREATE (p1)-[:VISITED]->(c1:City {id: 3}) +CREATE (p2)-[:VISITED]->(c1) +CREATE (p2)-[:VISITED]->(c2:City {id: 4}) +``` + +--- + +## Examples and Results + +### Example 1: Compute the outgoing degree for all nodes + +```plaintext +CALL algo.degree({}) +``` + +#### Result: + +| Node | Degree | +| ---- | ------ | +| 1 | 2 | +| 2 | 3 | +| 3 | 0 | +| 4 | 0 | + +--- + +### Example 2: Compute the outgoing degree for specific node types + +```plaintext +CALL algo.degree({source: 'Person'}) +``` + +#### Result: + +| Node | Degree | +| ---- | ------ | +| 1 | 2 | +| 2 | 3 | + +--- + +### Example 3: Compute the outgoing degree for a specific relationship type + +```plaintext +CALL algo.degree({source: 'Person', relation: 'FRIEND', dir: 'outgoing'}) +``` + +#### Result: + +| Node | Degree | +| ---- | ------ | +| 1 | 1 | + +--- + +### Example 4: Compute the incoming degree for reachable nodes of a specific type + +```plaintext +CALL algo.degree({source: 'Person', relation: 'VISITED', dir: 'incoming', destination: 'City'}) +``` + +#### Result: + +| Node | Degree | +| ---- | ------ | +| 3 | 2 | +| 4 | 1 | + + diff --git a/algorithms/index.md b/algorithms/index.md new file mode 100644 index 0000000..e69de29 From f40742f4a29d8d8c87d5e6b6b5d88d20eca34b07 Mon Sep 17 00:00:00 2001 From: Roi Lipman Date: Thu, 16 Jan 2025 22:22:06 +0200 Subject: [PATCH 2/7] add influencers to wordlist --- .wordlist.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.wordlist.txt b/.wordlist.txt index 4bf94c3..22d1639 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -347,3 +347,4 @@ hostnames bigmac calmcode io +influencers From 2399d3570cefd1cacda9aaa443f7af63d64ef4cc Mon Sep 17 00:00:00 2001 From: Roi Lipman Date: Thu, 16 Jan 2025 22:48:38 +0200 Subject: [PATCH 3/7] update nav order --- algorithms/index.md | 59 +++++++++++++++++++ .../path_algorithm.md | 0 bolt_support.md | 2 +- clients.md | 2 +- cypher/index.md | 2 +- datatypes.md | 2 +- docker-examples/README.md | 2 +- integration/index.md | 2 +- llm_support.md | 2 +- operations/index.md | 2 +- redisgraph-to-falkordb.md | 2 +- 11 files changed, 68 insertions(+), 9 deletions(-) rename path_algorithm.md => algorithms/path_algorithm.md (100%) diff --git a/algorithms/index.md b/algorithms/index.md index e69de29..2b89aea 100644 --- a/algorithms/index.md +++ b/algorithms/index.md @@ -0,0 +1,59 @@ +--- +title: "Graph Algorithms" +description: Graph Algorithms +nav_order: 4 +has_children: true +--- + +# FalkorDB Algorithms Documentation + +Welcome to the FalkorDB Algorithms Documentation! This guide provides an overview of all algorithms available within FalkorDB, enabling powerful graph analytics and insights. Each algorithm is designed to help you process and analyze graph data efficiently for a variety of use cases. + +## Available Algorithms + +Below is the list of supported algorithms in FalkorDB. Click on an algorithm to view its detailed documentation, including syntax, examples, and practical use cases: + +### Traversal Algorithms +- [BFS](#) + - Performs a Breadth-First Search traversal of the graph. + +### Centrality Algorithms +- [PageRank](#) + - Measures the importance of nodes based on incoming connections. + +### Connectivity Algorithms +- [Degree](#) + - Calculates the degree of nodes, focusing on connectivity based on edge direction and type. + +### Pathfinding Algorithms +- [Shortest Path](#) + - Finds the shortest path between two nodes. + +### Community Detection Algorithms +- [Label Propagation](#) + - Identifies communities based on label diffusion through the graph. + +--- + +## Getting Started + +To begin using any of the algorithms: +1. Ensure FalkorDB is installed and running. +2. Load your graph data into FalkorDB. +3. Refer to the detailed documentation for each algorithm to configure and execute it. + +For example, to calculate node degrees: + +```plaintext +CALL algo.degree({}) +``` + +--- + +## Feedback and Contributions + +We welcome feedback and contributions! If you encounter issues or have suggestions for new algorithms, please visit our [GitHub repository](https://github.com/FalkorDB/FalkorDB). + +Happy graph analytics with FalkorDB! + + diff --git a/path_algorithm.md b/algorithms/path_algorithm.md similarity index 100% rename from path_algorithm.md rename to algorithms/path_algorithm.md diff --git a/bolt_support.md b/bolt_support.md index 66a2d5c..06e26ba 100644 --- a/bolt_support.md +++ b/bolt_support.md @@ -1,6 +1,6 @@ --- title: "BOLT protocol support" -nav_order: 10 +nav_order: 11 description: "Connecting to FalkorDB using BOLT protocol." --- diff --git a/clients.md b/clients.md index a6491e6..10f0a39 100644 --- a/clients.md +++ b/clients.md @@ -1,6 +1,6 @@ --- title: "Client Libraries" -nav_order: 4 +nav_order: 5 description: > FalkorDB Clients --- diff --git a/cypher/index.md b/cypher/index.md index 4a5f7c6..4070a7d 100644 --- a/cypher/index.md +++ b/cypher/index.md @@ -1,6 +1,6 @@ --- title: "Cypher Language" -nav_order: 7 +nav_order: 9 description: > Cypher Language documentation has_children: true diff --git a/datatypes.md b/datatypes.md index 8d207d8..b748204 100644 --- a/datatypes.md +++ b/datatypes.md @@ -1,7 +1,7 @@ --- title: "Data types" description: "FalkorDB supports a number of distinct data types, some of which can be persisted as property values and some of which are ephemeral." -nav_order: 5 +nav_order: 6 --- # Graph types diff --git a/docker-examples/README.md b/docker-examples/README.md index 9de3d38..2def85c 100644 --- a/docker-examples/README.md +++ b/docker-examples/README.md @@ -1,6 +1,6 @@ --- title: Building Docker -nav_order: 6 +nav_order: 8 description: "Building docker container examples" --- diff --git a/integration/index.md b/integration/index.md index 7c2644a..422bf0e 100644 --- a/integration/index.md +++ b/integration/index.md @@ -2,7 +2,7 @@ title: "Integration" description: "Learn how to integrate FalkorDB into your applications with REST APIs" has_children: true -nav_order: 5 +nav_order: 7 --- # Integration diff --git a/llm_support.md b/llm_support.md index 1899ed9..1aea378 100644 --- a/llm_support.md +++ b/llm_support.md @@ -1,6 +1,6 @@ --- title: "LLM frameworks support" -nav_order: 8 +nav_order: 10 description: "FalkorDB supports a number of LLM frameworks." --- diff --git a/operations/index.md b/operations/index.md index 7a62381..d21bc5c 100644 --- a/operations/index.md +++ b/operations/index.md @@ -1,6 +1,6 @@ --- title: "Operations" -nav_order: 10 +nav_order: 12 description: "Configuring FalkorDB Docker" --- diff --git a/redisgraph-to-falkordb.md b/redisgraph-to-falkordb.md index 97eb141..8bef3c3 100644 --- a/redisgraph-to-falkordb.md +++ b/redisgraph-to-falkordb.md @@ -1,6 +1,6 @@ --- title: "RedisGraph to FalkorDB" -nav_order: 11 +nav_order: 13 description: "Migrate from RedisGraph to FalkorDB." --- From e90a8c289141fbdb0b4d8327082cfcf7fc8483c9 Mon Sep 17 00:00:00 2001 From: Roi Lipman Date: Thu, 16 Jan 2025 22:50:55 +0200 Subject: [PATCH 4/7] algorithms index page --- algorithms/index.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/algorithms/index.md b/algorithms/index.md index 2b89aea..949ec1c 100644 --- a/algorithms/index.md +++ b/algorithms/index.md @@ -14,23 +14,23 @@ Welcome to the FalkorDB Algorithms Documentation! This guide provides an overvie Below is the list of supported algorithms in FalkorDB. Click on an algorithm to view its detailed documentation, including syntax, examples, and practical use cases: ### Traversal Algorithms -- [BFS](#) +- [BFS](algorithms/BFS) - Performs a Breadth-First Search traversal of the graph. ### Centrality Algorithms -- [PageRank](#) +- [PageRank](algorithms/page_rank) - Measures the importance of nodes based on incoming connections. ### Connectivity Algorithms -- [Degree](#) +- [Degree](algorithms/degree) - Calculates the degree of nodes, focusing on connectivity based on edge direction and type. ### Pathfinding Algorithms -- [Shortest Path](#) +- [Shortest Path](algorithms/shortest_path) - Finds the shortest path between two nodes. ### Community Detection Algorithms -- [Label Propagation](#) +- [Label Propagation](algorithms/label_propagation) - Identifies communities based on label diffusion through the graph. --- From 879bb5d1c7cd87aeba775dafc84ebe6538aa7dbf Mon Sep 17 00:00:00 2001 From: Roi Lipman Date: Thu, 16 Jan 2025 22:53:02 +0200 Subject: [PATCH 5/7] add new words to .wordlist --- .wordlist.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.wordlist.txt b/.wordlist.txt index 22d1639..c8249b8 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -348,3 +348,5 @@ bigmac calmcode io influencers +analytics +Pathfinding From dfaf8c96e0a4b5e77911e4ff387620ca1477442b Mon Sep 17 00:00:00 2001 From: Gabriel Gomez Date: Fri, 13 Jun 2025 20:33:05 -0500 Subject: [PATCH 6/7] updated degree docs --- algorithms/degree.md | 50 +++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/algorithms/degree.md b/algorithms/degree.md index bf418ae..b006d86 100644 --- a/algorithms/degree.md +++ b/algorithms/degree.md @@ -1,3 +1,9 @@ +--- +title: "Degree" +description: "Measures the number of incoming or outgoing conections for all nodes." +parent: "Algorithms" +--- + # Degree Procedure Documentation ## Introduction @@ -20,20 +26,24 @@ Here are some practical scenarios where the **Degree Procedure** can be applied: ## Syntax -```plaintext -CALL algo.degree(config) +The procedure has the following call signature: +```procedure input: +CALL algo.dgree({ + 'srcLabels': [