Skip to content
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

Add Leiden community detection algorithm docs #1014

Open
wants to merge 1 commit into
base: memgraph-2-21
Choose a base branch
from

Conversation

DavIvek
Copy link
Contributor

@DavIvek DavIvek commented Oct 14, 2024

Description

Add Leiden community detection algorithm docs to the available Mage algorithms.

Pull request type

Please check what kind of PR this is:

  • Fix or improvement of an existing page
  • New documentation page, release related

Related PRs and issues

PR this doc page is related to:
memgraph/mage#508

Checklist:

  • Check all content with Grammarly
  • Perform a self-review of my code
  • Make corresponding changes to the rest of the documentation (consult with the DX team)
  • The build passes locally
  • My changes generate no new warnings or errors
  • Add a corresponding label
  • If release-related, add a product and version label
  • If release-related, add release note on product PR

Copy link

vercel bot commented Oct 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
documentation ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2024 1:39pm

@@ -30,6 +30,7 @@ library](/advanced-algorithms/install-mage).
| [bipartite_matching](/advanced-algorithms/available-algorithms/bipartite_matching) | C++ | Algorithm for calculating maximum bipartite matching, where matching is a set of nodes chosen in such a way that no two edges share an endpoint. |
| [bridges](/advanced-algorithms/available-algorithms/bridges) | C++ | A bridge is an edge, which when deleted, increases the number of connected components. The goal of this algorithm is to detect edges that are bridges in a graph. |
| [community_detection](/advanced-algorithms/available-algorithms/community_detection) | C++ | The Louvain method for community detection is a greedy method for finding communities with maximum modularity in a graph. Runs in _O_(*n*log*n*) time. |
| [leiden_community_detection](/advanced-algorithms/available-algorithms/leiden_community_detection) | C++ | The Leiden method for community detection is an improvement on the Louvain method, designed to find communities with maximum modularity in a graph while addressing issues of disconnected communities. Runs in _O_(*L* *m*) time, where *L* is the number of iterations of the algorithm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in alphabetical order

{<h4> Input: </h4>}

- `subgraph: Graph` (**OPTIONAL**) ➡ A specific subgraph, which is an [object of type Graph](/advanced-algorithms/run-algorithms#run-procedures-on-subgraph) returned by the `project()` function, on which the algorithm is run.
- `weight: string (default=null)` ➡ Specifies the default relationship weight. If not set,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a string and not a float? Does it refer to a property name?


- `subgraph: Graph` (**OPTIONAL**) ➡ A specific subgraph, which is an [object of type Graph](/advanced-algorithms/run-algorithms#run-procedures-on-subgraph) returned by the `project()` function, on which the algorithm is run.
- `weight: string (default=null)` ➡ Specifies the default relationship weight. If not set,
the algorithm uses the `weight` relationship attribute when present and otherwise
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relationship implies "edge". Is that what you meant?

- `weight: string (default=null)` ➡ Specifies the default relationship weight. If not set,
the algorithm uses the `weight` relationship attribute when present and otherwise
treats the graph as unweighted.
- `gamma: double (default=1.0)` ➡ Resolution parameter used when computing the modularity. Internally the value is divided by the number of relationships for an unweighted graph, or the sum of weights of all relationships otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is gamma divided by some kind of weight? Please explain.


{<h4> Output: </h4>}

- `node: Vertex` ➡ Graph node.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we give this a more descriptive label? What is special about this single node that is returned? Is it some kind of centroid for the community?


{<h4> Input: </h4>}

- `subgraph: Graph` (**OPTIONAL**) ➡ A specific subgraph, which is an [object of type Graph](/advanced-algorithms/run-algorithms#run-procedures-on-subgraph) returned by the `project()` function, on which the algorithm is run.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does the algorithm behave when subgraph is NOT provided?


- `node: Vertex` ➡ Graph node.
- `community_id: integer` ➡ Community ID. Defaults to $-1$ if the node does not belong to any community.
- `communities: list` ➡ List of intermediate communities that a node has been part of across iterations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this indicate the community hierarchy?


### `get_subgraph()`

Computes graph communities over a subgraph using the Louvain method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is Louvain on the Leiden page? I'm confused.

```cypher
CALL leiden_community_detection.get()
YIELD node, community_id, communities
RETURN node.id AS node_id, community_id, communities
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to see an example where a node is a member of more than one hierarchical community

- `subgraph: Graph` (**OPTIONAL**) ➡ A specific subgraph, which is an [object of type Graph](/advanced-algorithms/run-algorithms#run-procedures-on-subgraph) returned by the `project()` function, on which the algorithm is run.
- `subgraph_nodes: List[Node]` ➡ List of nodes in the subgraph.
- `subgraph_relationships: List[Relationship]` ➡ List of relationships in the subgraph.
- `weight: string (default=null)` ➡ Specifies the default relationship weight. If not set,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does leiden require the --storage-properties-on-edges=true configuration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants