-
Notifications
You must be signed in to change notification settings - Fork 7
document WCC #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
document WCC #152
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| title: "Algorithms" | ||
| description: "Algorithms" | ||
| --- | ||
|
|
||
| # Algorithms | ||
|
|
||
| ## 1. [WCC](/algorithms/wcc) | ||
|
|
||
| ## 2. [PageRank](/algorithms/pagerank) | ||
|
|
||
| ## 3. [All Neighbors](/algorithms/all_neighbors) | ||
|
|
||
| ## 4. [All Paths](/algorithms/all_paths) | ||
|
|
||
| ## 5. [All Shortest Paths](/algorithms/all_shortest_paths) | ||
|
|
||
| ## 6. [BFS](/algorithms/bfs) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| # Weakly Connected Components (WCC) - FalkorDB Documentation | ||
|
|
||
| ## Overview | ||
|
|
||
| The Weakly Connected Components (WCC) algorithm identifies sets of nodes that are connected to each other, regardless of the edge directions. | ||
| Each node in a weakly connected component can reach every other node in that component if edge directions are ignored. | ||
|
|
||
| WCC is a common algorithmic building block used in applications like: | ||
| - Community detection | ||
| - Data preprocessing | ||
| - Network analysis | ||
| - Identifying isolated subgraphs | ||
|
|
||
| ## Algorithm Details | ||
|
|
||
| WCC begins with each node in its own component. | ||
| The algorithm repeatedly merges components when edges are found between them, ignoring edge directions. | ||
| This process continues until no more merges are possible, resulting in a set of disjoint communities. | ||
|
|
||
| ### Performance | ||
|
|
||
| The time complexity of WCC is O(|V| + |E|) where: | ||
| - |V| is the number of nodes | ||
| - |E| is the number of edges | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```cypher | ||
| CALL algo.wcc([config]) | ||
| ``` | ||
|
|
||
| ### Parameters | ||
|
|
||
| The procedure accepts an optional configuration `Map` with the following parameters: | ||
|
|
||
| | Name | Type | Default | Description | | ||
| |---------------------|-------|------------------------|----------------------------------------------------------------------------------| | ||
| | `nodeLabels` | Array | All labels | Array of strings listing which node labels will be considered | | ||
| | `relationshipTypes` | Array | All relationship types | Array of strings specifying which relationship types are allowed to be traversed | | ||
|
|
||
| ### Return Values | ||
|
|
||
| | Name | Type | Description | | ||
| |---------------|---------|--------------------------------------| | ||
| | `node` | Node | The current node object | | ||
| | `componentId` | Integer | The component ID the node belongs to | | ||
|
|
||
| ## Examples | ||
|
|
||
| ```cypher | ||
| CALL algo.wcc({ | ||
| nodeLabels: ["Person"], | ||
| relationshipTypes: ["KNOWS"] | ||
| }) | ||
| YIELD node, componentId | ||
| RETURN node.name, componentId | ||
| ``` | ||
|
|
||
| ### Creating a Social Network Graph | ||
|
|
||
| ```cypher | ||
| // Create users in different communities | ||
| CREATE | ||
| // Community 1 | ||
| (alice:User {name: 'Alice'}), | ||
| (bob:User {name: 'Bob'}), | ||
| (charlie:User {name: 'Charlie'}), | ||
|
|
||
| // Community 2 | ||
| (david:User {name: 'David'}), | ||
| (emma:User {name: 'Emma'}), | ||
|
|
||
| // Community 3 | ||
| (frank:User {name: 'Frank'}) | ||
|
|
||
| // Create relationships within communities | ||
| CREATE | ||
| (alice)-[:FOLLOWS]->(bob), | ||
| (bob)-[:FRIENDS_WITH]->(charlie), | ||
| (charlie)-[:FOLLOWS]->(alice), | ||
|
|
||
| (david)-[:FRIENDS_WITH]->(emma) | ||
|
|
||
| // Note that Frank is isolated and forms his own community | ||
| ``` | ||
|
|
||
| ### Analyzing Social Networks | ||
|
|
||
| ```cypher | ||
| // Find isolated communities in a social network | ||
| CALL algo.wcc({ | ||
| nodeLabels: ["User"], | ||
| relationshipTypes: ["FOLLOWS", "FRIENDS_WITH"], | ||
| }) | ||
| YIELD componentId | ||
|
|
||
| // Get community sizes | ||
| RETURN componentId AS communityId, count(*) AS communitySize | ||
| ORDER BY communitySize DESC | ||
| ``` | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If WCC isn't a ubiquitous term, I'd print the entire name: Weakly Connected Components (WCC)