Skip to main content

Helios Network Python bindings

Project description

Helios Network (Python)

Python bindings for the Helios Network C core.

Quick start

from helios_network import AttributeScope, AttributeType, Network

network = Network(directed=False)
node_ids = network.add_nodes(3)
network.add_edges([(node_ids[0], node_ids[1])])

network.define_attribute(AttributeScope.Node, "weight", AttributeType.Double, 1)
network.nodes["weight"] = 1.0

# Auto-define attributes on assignment
network.nodes["score"] = 2.5

network.define_attribute(AttributeScope.Network, "title", AttributeType.String, 1)
network.network["title"] = "demo"
print(network.graph["title"])
network["title"] = "demo2"

# Node access
print(network.nodes[node_ids[0]]["weight"])
network.nodes[[node_ids[0], node_ids[1]]]["weight"] = [2.0, 3.0]

for node in network.nodes:
    node["weight"] = 4.0

Selectors

  • network.nodes[id] returns a node view
  • network.nodes[[id1, id2]] returns a selector for active nodes
  • network.nodes["attr"] returns a list of attribute values for active nodes
  • network.nodes["attr"] = value assigns a constant to all active nodes
  • network.nodes[[id1, id2]]["attr"] = [v1, v2] assigns per-node values

Edge access mirrors node access via network.edges, with network.edges.pairs() yielding (source, target) tuples.

For large generated graphs, avoid materializing Python (source, target) tuples:

from array import array

network.add_nodes(1_000_000)
network.add_edges_from_arrays(
    array("I", sources),
    array("I", targets),
)

Network Generators

The Python package exposes native generators as module-level constructors:

from helios_network import generate_watts_strogatz

network = generate_watts_strogatz(
    5_000,
    neighbor_level=2,
    rewiring_probability=0.01,
    seed=1,
)

Available generators include generate_stochastic_block_model, generate_barabasi_albert, generate_watts_strogatz, generate_random_geometric, generate_waxman, generate_configuration_model, and generate_lattice_2d.

Edge indices

for edge_id, (source, target) in network.edges.with_indices():
    print(edge_id, source, target)

Measurements and Community Detection

The Python wrapper exposes the native measurement APIs:

degree = network.measure_degree(direction="both")
components = network.measure_connected_components(mode="weak")
leiden = network.leiden_modularity(
    resolution=1.0,
    seed=42,
    out_node_community_attribute="community",
)

leiden_modularity(...) is an alias for measure_leiden_modularity(...). It writes an unsigned-integer node attribute and returns community_count, modularity, and values_by_node.

To label only major components for filtering or visualization:

major = network.label_major_components(
    mode="weak",
    max_components=3,
    min_size=100,
    out_node_component_attribute="major_component",
)

Selected components receive rank labels 1..N by decreasing size. Other nodes receive 0 by default.

The Leiden comparison harness in research/benchmarks/leiden_compare/ uses a conda environment file:

conda env create -f research/benchmarks/leiden_compare/environment.yml
conda run -n helios-leiden-compare python -m pip install -e python --no-build-isolation
conda run -n helios-leiden-compare python research/benchmarks/leiden_compare/compare_leiden.py

Installation

Standard install:

python -m pip install ./python --upgrade

Editable install (recommended during development):

python -m pip install -e python --no-build-isolation

mesonpy editable builds require --no-build-isolation.

If editable install fails, install build tools in the active environment:

python -m pip install meson ninja meson-python
python -m pip install -e python --no-build-isolation

Optional conversions

NetworkX and igraph conversions are optional. Install when needed:

python -m pip install networkx
python -m pip install igraph

UMAP export

Install the optional UMAP stack when you want a Helios-ready fuzzy graph or kNN graph export:

python -m pip install ./python[umap]
from helios_network import HeliosUMAP

umap_export = HeliosUMAP(
    n_neighbors=15,
    min_dist=0.1,
    build_knn_network=True,
)

network = umap_export.fit_network(X)
network.save_bxnet("embedding.bxnet")

# Optional directed kNN export
umap_export.knn_network_.save_zxnet("embedding-knn.zxnet")

If you want only the UMAP graph construction output for helios-web-next to lay out from scratch, use the graph-only export path instead:

graph_network = umap_export.fit_graph_network(X)
graph_network.save_zxnet("umap-graph.zxnet")

The fit graph export writes:

  • node attributes: umap_embedding, _helios_visuals_position, umap_mass
  • edge attribute: umap_weight
  • network attributes that let helios-web-next auto-enable UMAP force mode on import

The graph-only export writes the same UMAP edge weights and graph metadata, but omits umap_embedding and _helios_visuals_position so helios-web-next can start its own realtime UMAP-like layout from scratch.

Examples

From python/:

python examples/basic_usage.py
python examples/toroidal_dimensions_table.py
python examples/toroidal_dimensions_plot.py --skip-plot
python examples/toroidal_dimensions_plot.py
python examples/toroidal_dimensions_plot.py --large --skip-plot
python examples/generate_umap_example_networks.py --sizes 200 2000 20000

toroidal_dimensions_plot.py uses matplotlib for plotting local dimension curves. Install it with:

python -m pip install matplotlib

Vector attributes

Attributes with dimension > 1 accept vector assignments:

network.define_attribute(AttributeScope.Node, "i3", AttributeType.Integer, 3)
network.nodes["i3"] = [1, 2, 3]  # broadcast to all nodes
network.nodes[[0, 1]]["i3"] = [[4, 5, 6], [7, 8, 9]]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

helios_network-0.10.1.tar.gz (1.8 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

helios_network-0.10.1-cp313-cp313-win_amd64.whl (501.8 kB view details)

Uploaded CPython 3.13Windows x86-64

helios_network-0.10.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (364.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

helios_network-0.10.1-cp313-cp313-macosx_11_0_arm64.whl (271.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

helios_network-0.10.1-cp312-cp312-win_amd64.whl (501.9 kB view details)

Uploaded CPython 3.12Windows x86-64

helios_network-0.10.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (364.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

helios_network-0.10.1-cp312-cp312-macosx_11_0_arm64.whl (271.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

helios_network-0.10.1-cp311-cp311-win_amd64.whl (501.6 kB view details)

Uploaded CPython 3.11Windows x86-64

helios_network-0.10.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (364.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

helios_network-0.10.1-cp311-cp311-macosx_11_0_arm64.whl (272.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

helios_network-0.10.1-cp310-cp310-win_amd64.whl (501.6 kB view details)

Uploaded CPython 3.10Windows x86-64

helios_network-0.10.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (364.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

helios_network-0.10.1-cp310-cp310-macosx_11_0_arm64.whl (272.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

helios_network-0.10.1-cp39-cp39-win_amd64.whl (502.3 kB view details)

Uploaded CPython 3.9Windows x86-64

helios_network-0.10.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (364.4 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

helios_network-0.10.1-cp39-cp39-macosx_11_0_arm64.whl (272.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file helios_network-0.10.1.tar.gz.

File metadata

  • Download URL: helios_network-0.10.1.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for helios_network-0.10.1.tar.gz
Algorithm Hash digest
SHA256 5d8345f11f8354f52e77b08d2f7a0b9fae6b64e41774ac50e1577a21a19ae083
MD5 0f102f36727400b9709b274a2d3821fa
BLAKE2b-256 d9b163511b7b489b6460e6c9db3c14faa947f264f9bcad299ddb322a16e4a79a

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1.tar.gz:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9f90a78d3beccef36aaa708dd8194c8fe4fc4ed029b6f70f74cb7067c9e9fbfc
MD5 0aba913600f7ea30284ca5567c795c02
BLAKE2b-256 1885dec81009208fb59627affd1d6911b0aea2666034efea919c2e6db6647cca

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp313-cp313-win_amd64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e55bf26da2e02a840e8fb4f4f648b06248d21b7c7c9e39e5688f89c75f782599
MD5 5994a056858dde58f99c3109574918b4
BLAKE2b-256 e81d82c038c1ad720021fbfd7f33592c35e43870e1eac857b130257d685692a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c172003e408dce7ade9e97c44d1b29ac9fd3d303bcd4dd2ceb9e989387a33f3
MD5 2fa94184d4ee8e563b27c5715959158d
BLAKE2b-256 910b489cbec1d5204dd03bd654ec6e0ffc11b7f3804f5ab29a0d22f00afa3b7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0c2f5ab6ed5047b34188a700f8c4a637cffc127448f47628e0865ebe389e2da9
MD5 acc4c31088cf0f4f058ff8bb4853e6f7
BLAKE2b-256 ffa5e79fe399f8a788c08a52e59d8e798eefb41062bf9a30252cd9e878e61f73

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp312-cp312-win_amd64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0294aca681aeafb08f885ae8e9749c5b0c466d439f713439c1df4cbea9992e36
MD5 58c025bbd51c047936352a0630756890
BLAKE2b-256 ccae22a335debd4ef235c72aaf03ebfa0a9a7c3923726d62af24bf121fab8a32

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ddf6ac1a1f6b898cc13b67cb6d96002c6871f096951fe952db0d387672e6e0e6
MD5 7c0e4af25beff8792f076b1c0ef6d587
BLAKE2b-256 45a0372dbb2ba62da2e96f349bc380d2c1bc462484c780bd424206a19d9bed39

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 96a2f0e55cf27fc344a8798a0ed7fcdb04e395653e70f7fc813f03327046d10d
MD5 f117f9b0916dd8157f75fabf37fcb0e7
BLAKE2b-256 84de07ef0cd66cfa1084a5f3228ffa2c9c545d7e6ca74ea7143d3d4b3d3710b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp311-cp311-win_amd64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 50f23fb3dda5deadd92ef0cf12b154ab799f7c649906ac89ec8c14b9137efe89
MD5 b2fdd0d0e5e04e25ff3d3929cc5d0750
BLAKE2b-256 eb7df7c8a83ad9ae3ac94646936471706c1a10e65487606eb0d5c51e44969b64

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 05ed6b79db25a54b6a27294c7a57980b1b9b8625254f85ecb7e46ff95ad2c322
MD5 3bd46c6f4ffb911b2ca7744d39b750da
BLAKE2b-256 319c7c9ecdc5516f4d097dc9d2e35d54ec88f4a514780a671839e9d1db306acf

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 146e8498d9342a543b1f98d0722a37068a72ef8a447bf5f1e3e43c96de997491
MD5 e6ca96c7b80cf6f04b727130bcf7e302
BLAKE2b-256 28794ef9bd36cb5563f22ac084c01989507929718e453e1d6c6fb23bfe62c2a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp310-cp310-win_amd64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 36d37b188ba6ea8f37efbc091d58d5c716e20a6b2383eec7a313527c9fc7dbf3
MD5 b4ad57099793751e76d2a214c6cdb708
BLAKE2b-256 e8fd7deeab280984704a3331da4eb1494204815d84ac6be685fbdb13450cf6ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab9977df796cd9c23c945eef7c1de1256833bd224739781a1b6db60d541a2d16
MD5 775e8f08c76a2333430a6b7f9eb67416
BLAKE2b-256 df6d25397625e8dbaf6cda0ad18cc97b85f3ba775db76e0d036db2e1c34bdd7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a870b026343a24e186a9b81cc91f4a1b0ac1ea07fb750154877717c36da04bcc
MD5 9a7345cdc9f78407b166c351238c42e1
BLAKE2b-256 3d55cff4b146148348ba2a7c3b8b318bb4c4435f00eff25dc67fa33f6f37682b

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp39-cp39-win_amd64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2f9d3553f9077b94e24ecaacd2c8b8164b5c176a50aebecbcc8a663bb502d00a
MD5 e14c2f0ab120995122c55dda6979c995
BLAKE2b-256 22d3acdcedf3d3e8b1323d28fb7464910eba497224e7f831426a5aea161afb78

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helios_network-0.10.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aa2a905f16ddfb24cc578ff6712bb1e17debe0670ccc58aea9c552c69e0a759c
MD5 28ec9a12d0ed14f6861789610a79a02e
BLAKE2b-256 46dac919b5414ae3e879976b232f032b3f72f8884da1db326e7f082e5fa276ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.1-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: release.yml on filipinascimento/helios-network

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page