-
Notifications
You must be signed in to change notification settings - Fork 6
Algorithms section & degree docs #117
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
Open
swilly22
wants to merge
8
commits into
main
Choose a base branch
from
degree
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4a4d583
Algorithms section & degree docs
swilly22 f40742f
add influencers to wordlist
swilly22 2399d35
update nav order
swilly22 e90a8c2
algorithms index page
swilly22 879bb5d
add new words to .wordlist
swilly22 6c9615a
Merge branch 'main' into degree
gkorland dfaf8c9
updated degree docs
GomezGab e7cfc43
added example graph image
GomezGab 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 |
---|---|---|
@@ -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': [<label>, ...], | ||
'dir': 'incoming' / 'outgoing' / 'both', | ||
'relationshipTypes': [<type>, ...], | ||
'destLabels': [<label>, ...], | ||
}) | ||
``` | ||
|
||
### 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. | | ||
| Name | Type | Description | Default | | ||
|---------------------|-----------------------|--------------------------------------------|-----------| | ||
| `srcLabels` | [optional] [string[]] | type of nodes for which degree is computed | All Nodes | | ||
| `dir` | [optional] [string] | 'incoming', 'outgoing', or 'both' | outgoing | | ||
| `relationshipTypes` | [optional] [string[]] | the type of edges to consider | All edges | | ||
| `destLabels` | [optional] [string[]] | type of reachable nodes | All Nodes | | ||
|
||
--- | ||
|
||
|
@@ -90,7 +100,7 @@ CREATE (p2)-[:VISITED]->(c2:City {id: 4}) | |
### Example 1: Compute the outgoing degree for all nodes | ||
|
||
```plaintext | ||
CALL algo.degree({}) | ||
CALL algo.degree() | ||
``` | ||
|
||
#### Result: | ||
|
@@ -107,7 +117,7 @@ CALL algo.degree({}) | |
### Example 2: Compute the outgoing degree for specific node types | ||
|
||
```plaintext | ||
CALL algo.degree({source: 'Person'}) | ||
CALL algo.degree({srcLabels: ['Person']}) | ||
``` | ||
|
||
#### Result: | ||
|
@@ -119,24 +129,25 @@ CALL algo.degree({source: 'Person'}) | |
|
||
--- | ||
|
||
### Example 3: Compute the outgoing degree for a specific relationship type | ||
### Example 3: Compute the total degree for a specific relationship type | ||
|
||
```plaintext | ||
CALL algo.degree({source: 'Person', relation: 'FRIEND', dir: 'outgoing'}) | ||
CALL algo.degree({srcLabels: ['Person'], relationshipTypes: ['FRIEND'], dir: 'total'}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the default if not specified ? is it 'outgoing' ? |
||
``` | ||
|
||
#### Result: | ||
|
||
| Node | Degree | | ||
| ---- | ------ | | ||
| 1 | 1 | | ||
| 2 | 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'}) | ||
CALL algo.degree({srcLabels: ['Person'], relationshipTypes: ['VISITED'], dir: 'incoming', destLabels: ['City']}) | ||
``` | ||
|
||
#### Result: | ||
|
@@ -146,4 +157,13 @@ CALL algo.degree({source: 'Person', relation: 'VISITED', dir: 'incoming', destin | |
| 3 | 2 | | ||
| 4 | 1 | | ||
|
||
## Usage Notes | ||
|
||
- When `both` is specified, the in and out degrees of the node are summed. So if | ||
(a)-[:R]->(b) and (b)-[:R]->(a) then (a) would have a degree of 2 when | ||
`both` is specified. | ||
- When multiple labels are specified, the nodes' degrees accross each of those | ||
labels are summed together. | ||
- This algorithm counts multi-edges and self-edges towards the degree. | ||
- Computationally cheapest when computing the outdegree, especially on | ||
undirected graphs. |
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.
Fix typo in front-matter description.
There's a misspelling in the description field.
📝 Committable suggestion
🤖 Prompt for AI Agents