louvainsplit


Namelouvainsplit JSON
Version 0.2.0.4 PyPI version JSON
download
home_pagehttps://github.com/mehrdaddjavadi/louvainsplit
SummaryEfficient graph partitioning using LouvainSplit algorithm
upload_time2024-06-10 10:44:28
maintainerNone
docs_urlNone
authorMehrdad Javadi
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LouvainSplit

LouvainSplit is a Python package for efficient graph partitioning using the LouvainSplit algorithm, based on the paper by Mehrdad Javadi, Hossein Aghighi and Mohsen Azadbakht.

## Abstract

Graph partitioning is essential for uncovering cohesive communities within complex networks. This paper introduces LouvainSplit, an innovative algorithm designed to enhance graph partitioning efficiency and accuracy. LouvainSplit leverages advanced techniques in feature representation, community detection, and evaluation, providing a robust framework for addressing challenges inherent in graph partitioning tasks across diverse domains. At its core, LouvainSplit utilizes a feature pyramid representation approach to extract both basic and summary features from input graphs at multiple granularity levels. This methodology ensures a subtle evaluation of graph data by capturing fundamental graph information alongside intricate structural patterns, thus offering a comprehensive representation of underlying community structures. A key innovation of our approach is the integration of the Louvain algorithm, renowned for its efficacy in community detection. By leveraging pairwise cosine similarities computed from node feature vectors, the Louvain algorithm optimizes modularity iteratively, effectively partitioning graphs into cohesive communities. This iterative process facilitates the identification of significant network structures within complex networks, providing valuable insights into their organizational dynamics. To comprehensively evaluate LouvainSplit's performance, we integrated diverse graph partitioning algorithms, including PyMetis, Genetic Algorithm (GA), DBSCAN, KMeans, OPTICS, and spectral clustering to evaluate the effectiveness of LouvainSplit and using popular evaluation metrics across diverse benchmarks spanning various domains and graphs. The results demonstrate LouvainSplit's superiority in terms of recall score, modularity, and scalability compared to existing methods. Moreover, LouvainSplit maintains competitive average runtime values, ensuring efficient processing even with large-scale datasets.

DOI: [10.21203/rs.3.rs-4301602/v1](https://doi.org/10.21203/rs.3.rs-4301602/v1)

## Installation

You can install the package via pip:

```sh
pip install louvainsplit


## Usage
Here is an example of how to use the LouvainSplit package:
import networkx as nx
from louvainsplit import construct_feature_pyramid, louvain_algorithm

# Create a sample graph
G = nx.karate_club_graph()

# Construct the feature pyramid
feature_pyramid = construct_feature_pyramid(G, num_levels=3)


# Apply the Louvain algorithm
partitions = louvain_algorithm(feature_pyramid, num_clusters=3)

print("Partitions:", partitions)

output >>> Partitions: [[0, 3, 6, 9, 12, 15, 18, 21, 24], [1, 4, 7, 10, 13, 16, 19, 22, 25], [2, 5, 8, 11, 14, 17, 20, 23]]

## Features
Feature Pyramid Representation: Extracts both basic and summary features from input graphs at multiple granularity levels.
Louvain Algorithm Integration: Utilizes the Louvain algorithm for efficient community detection based on cosine similarities of node feature vectors.

## Functions and Methods
construct_feature_pyramid(graph, num_levels)
Constructs a feature pyramid representation of the input graph.

Parameters:

graph: A NetworkX graph object.
num_levels: The number of levels in the feature pyramid.
Returns: A list of tensors representing the feature pyramid.
extract_basic_features(graph)
Extracts basic features from the input graph.

graph: A NetworkX graph object.
Returns: A list of basic features [num_nodes, num_edges, avg_degree clustering_coefficient].
extract_abstract_features(graph, level)
Extracts abstract features from the input graph at the specified level.

graph: A NetworkX graph object.
level: The granularity level for feature extraction.
Returns: A tensor of abstract features.
louvain_algorithm(feature_pyramid, num_clusters, similarity_measure='cosine')
Applies the Louvain algorithm to partition the graph based on the feature pyramid.

feature_pyramid: A list of tensors representing the feature pyramid.
num_clusters: The number of clusters to partition the graph into.
similarity_measure: The similarity measure to use (cosine is currently supported).
Returns: A list of partitions, where each partition is a list of node indices.




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mehrdaddjavadi/louvainsplit",
    "name": "louvainsplit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Mehrdad Javadi",
    "author_email": "mehrdaddjavadi@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e9/65/0dfcafa369ec73f62da9eb7615d006d9a3e2c7f97c6ae532b654fc357920/louvainsplit-0.2.0.4.tar.gz",
    "platform": null,
    "description": "# LouvainSplit\r\n\r\nLouvainSplit is a Python package for efficient graph partitioning using the LouvainSplit algorithm, based on the paper by Mehrdad Javadi, Hossein Aghighi and Mohsen Azadbakht.\r\n\r\n## Abstract\r\n\r\nGraph partitioning is essential for uncovering cohesive communities within complex networks. This paper introduces LouvainSplit, an innovative algorithm designed to enhance graph partitioning efficiency and accuracy. LouvainSplit leverages advanced techniques in feature representation, community detection, and evaluation, providing a robust framework for addressing challenges inherent in graph partitioning tasks across diverse domains. At its core, LouvainSplit utilizes a feature pyramid representation approach to extract both basic and summary features from input graphs at multiple granularity levels. This methodology ensures a subtle evaluation of graph data by capturing fundamental graph information alongside intricate structural patterns, thus offering a comprehensive representation of underlying community structures. A key innovation of our approach is the integration of the Louvain algorithm, renowned for its efficacy in community detection. By leveraging pairwise cosine similarities computed from node feature vectors, the Louvain algorithm optimizes modularity iteratively, effectively partitioning graphs into cohesive communities. This iterative process facilitates the identification of significant network structures within complex networks, providing valuable insights into their organizational dynamics. To comprehensively evaluate LouvainSplit's performance, we integrated diverse graph partitioning algorithms, including PyMetis, Genetic Algorithm (GA), DBSCAN, KMeans, OPTICS, and spectral clustering to evaluate the effectiveness of LouvainSplit and using popular evaluation metrics across diverse benchmarks spanning various domains and graphs. The results demonstrate LouvainSplit's superiority in terms of recall score, modularity, and scalability compared to existing methods. Moreover, LouvainSplit maintains competitive average runtime values, ensuring efficient processing even with large-scale datasets.\r\n\r\nDOI: [10.21203/rs.3.rs-4301602/v1](https://doi.org/10.21203/rs.3.rs-4301602/v1)\r\n\r\n## Installation\r\n\r\nYou can install the package via pip:\r\n\r\n```sh\r\npip install louvainsplit\r\n\r\n\r\n## Usage\r\nHere is an example of how to use the LouvainSplit package:\r\nimport networkx as nx\r\nfrom louvainsplit import construct_feature_pyramid, louvain_algorithm\r\n\r\n# Create a sample graph\r\nG = nx.karate_club_graph()\r\n\r\n# Construct the feature pyramid\r\nfeature_pyramid = construct_feature_pyramid(G, num_levels=3)\r\n\r\n\r\n# Apply the Louvain algorithm\r\npartitions = louvain_algorithm(feature_pyramid, num_clusters=3)\r\n\r\nprint(\"Partitions:\", partitions)\r\n\r\noutput >>> Partitions: [[0, 3, 6, 9, 12, 15, 18, 21, 24], [1, 4, 7, 10, 13, 16, 19, 22, 25], [2, 5, 8, 11, 14, 17, 20, 23]]\r\n\r\n## Features\r\nFeature Pyramid Representation: Extracts both basic and summary features from input graphs at multiple granularity levels.\r\nLouvain Algorithm Integration: Utilizes the Louvain algorithm for efficient community detection based on cosine similarities of node feature vectors.\r\n\r\n## Functions and Methods\r\nconstruct_feature_pyramid(graph, num_levels)\r\nConstructs a feature pyramid representation of the input graph.\r\n\r\nParameters:\r\n\r\ngraph: A NetworkX graph object.\r\nnum_levels: The number of levels in the feature pyramid.\r\nReturns: A list of tensors representing the feature pyramid.\r\nextract_basic_features(graph)\r\nExtracts basic features from the input graph.\r\n\r\ngraph: A NetworkX graph object.\r\nReturns: A list of basic features [num_nodes, num_edges, avg_degree clustering_coefficient].\r\nextract_abstract_features(graph, level)\r\nExtracts abstract features from the input graph at the specified level.\r\n\r\ngraph: A NetworkX graph object.\r\nlevel: The granularity level for feature extraction.\r\nReturns: A tensor of abstract features.\r\nlouvain_algorithm(feature_pyramid, num_clusters, similarity_measure='cosine')\r\nApplies the Louvain algorithm to partition the graph based on the feature pyramid.\r\n\r\nfeature_pyramid: A list of tensors representing the feature pyramid.\r\nnum_clusters: The number of clusters to partition the graph into.\r\nsimilarity_measure: The similarity measure to use (cosine is currently supported).\r\nReturns: A list of partitions, where each partition is a list of node indices.\r\n\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Efficient graph partitioning using LouvainSplit algorithm",
    "version": "0.2.0.4",
    "project_urls": {
        "Homepage": "https://github.com/mehrdaddjavadi/louvainsplit"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ce3fe77ef0c9d1b988d2329d43e4d5d943c27071fbc2e345beae827b0725a86",
                "md5": "8ec61c7119d25c9fe8e4b2ba179204cc",
                "sha256": "1d79603c5c650525d977093c1c6bb70f5a753ba436ed041e172f0b995c3f1446"
            },
            "downloads": -1,
            "filename": "louvainsplit-0.2.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8ec61c7119d25c9fe8e4b2ba179204cc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6067,
            "upload_time": "2024-06-10T10:44:26",
            "upload_time_iso_8601": "2024-06-10T10:44:26.383296Z",
            "url": "https://files.pythonhosted.org/packages/0c/e3/fe77ef0c9d1b988d2329d43e4d5d943c27071fbc2e345beae827b0725a86/louvainsplit-0.2.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e9650dfcafa369ec73f62da9eb7615d006d9a3e2c7f97c6ae532b654fc357920",
                "md5": "48947509ee6b648d04302bb5e130b9c3",
                "sha256": "0505c68073111d7525e84af842fc3000b6ec906899d53204a0ab93293f1c6c4f"
            },
            "downloads": -1,
            "filename": "louvainsplit-0.2.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "48947509ee6b648d04302bb5e130b9c3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 5090,
            "upload_time": "2024-06-10T10:44:28",
            "upload_time_iso_8601": "2024-06-10T10:44:28.533871Z",
            "url": "https://files.pythonhosted.org/packages/e9/65/0dfcafa369ec73f62da9eb7615d006d9a3e2c7f97c6ae532b654fc357920/louvainsplit-0.2.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-10 10:44:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mehrdaddjavadi",
    "github_project": "louvainsplit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "louvainsplit"
}
        
Elapsed time: 0.27175s