Community Layout
Layout of large networkx graphs with community segmentation
A small package used to visualise community-structured networkx graphs.
Layout of communities individually, with communities themselves arranged according to their inter-links, allows far faster visualisation of large graphs.
Note: This is an early version, and usage will likely be changed as new functionality is added.
Usage
The layout class is accessed via:
from community_layout.layout_class import CommunityLayout
Position calculation is during __init__.
After __init__, CommunityLayout(G).full_positions is an dictionary of keys corresponding to node positions, as in networkx layout algorithms.
Basic usage is as follows:
import networkx as nx
from community_layout.layout_class import CommunityLayout
G = nx.gnm_random_graph(2000, 40000)
layout = CommunityLayout(G)
pos = layout.full_positions
There are several parameters that can be changed by the user:
CommunityLayout(self,
G,
community_compression = 0.25,
layout_algorithm = nx.spring_layout,
layout_kwargs = {"k":75, "iterations":1000},
community_algorithm = community.louvain_communities,
community_kwargs = {"resolution":2})
These are designed to work with networkx functions, but custom functions will work assuming similar syntax and that they return the same objects.
community_algorithm can also be a list of pre-determined communities, ie ["community_1":{"node_id1", "node_id2",...}, "community_2":{"node_id3", "node_id4",...}].
community_compression controls the scale compression of individual community sub-layouts.
Lower values will result in each community occupying smaller portions of the overall layout.
Optionally we also include figure plotting:
layout.display(colors = None,
bundle = False,
complex_alphas = True,
ax = None)
Which, if passed ax = matplotlib.Axes, returns the same. If no Axes is passed, it saves a .png in the working directory and calls plt.show().
Note: Edge bundling is currently a much heavier process than the community layout process.
Requirements
Requires the packages numpy, pandas, tqdm, scipy and networkx to be installed.
matplotlib is required for figure plotting. Edge bundling requires datashader and scikit-image.
Metadata
Release files for community-layout 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| community-layout-1.0.6.tar.gz | 43.7 kB | Without provenance | Details for community-layout-1.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| community_layout-1.0.6-py3-none-any.whl | Python 3 | none | any | Details for community_layout-1.0.6-py3-none-any.whl |
Total release size: 75.1 kB
Release files / community-layout-1.0.6.tar.gz
| Download URL | community-layout-1.0.6.tar.gz |
|---|---|
| Size | 43.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d2dc28283068dd16471a905704ba7147528e84635e88fe1b7a3a103b3348414
|
|
BLAKE2b-256 checksum How to use checksums |
51999cefce3c725e5b1f30d4d1bfb45a28d853e414068c027761b87c3e9d5870
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.13
|
Release files / community_layout-1.0.6-py3-none-any.whl
| Download URL | community_layout-1.0.6-py3-none-any.whl |
|---|---|
| Size | 31.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a04915af3499fbabf97bb899857c703a5d285f295d368291bfde728917010882
|
|
BLAKE2b-256 checksum How to use checksums |
3838191c8dc194443ce938fdbce8e55352d575dff4e7f40c89cd4b5a1b3e6135
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.13
|
Security for community-layout 1.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.