Skip to content

Making the input type of leiden algorithm generic #55

@johandahlberg

Description

@johandahlberg

Hi!

I am working in a project where we use the Leiden implementation of graspologic to processes some rather large graphs (in the order of magnitude of tens of millions of edges and nodes). We are able to represent our node ids as unsigned 64bit integers, and I noticed that graspologic uses strings internally to represent the nodes.

I am rather a novice when it comes to Rust, but I did a quick try to see if I could change Edge to be a struct like this:

pub struct Edge<T> {
    pub source: T,
    pub target: T,
    pub weight: f64,
}

And use that throughout the code. For my use-case this improved runtime by ~30% and lowered the memory usage by ~20%, when I passed a list of integers instead of strings to the method. Since for us running the Leiden can take hours, cutting the runtime by a third would be a rather big win.

I am wondering if you would be interested in a PR introducing these changes into graspologic-native. If so I can clean up my work a bit and submit a PR for your consideration.

/Johan Dahlberg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions