
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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.
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.
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
.
FAQs
A Python package for community-separated layout of large networkx graphs.
We found that community-layout demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.