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.2.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.2-cp313-cp313-win_amd64.whl (501.8 kB view details)

Uploaded CPython 3.13Windows x86-64

helios_network-0.10.2-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.2-cp313-cp313-macosx_11_0_arm64.whl (271.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

helios_network-0.10.2-cp312-cp312-win_amd64.whl (501.8 kB view details)

Uploaded CPython 3.12Windows x86-64

helios_network-0.10.2-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.2-cp312-cp312-macosx_11_0_arm64.whl (271.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

helios_network-0.10.2-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.2-cp311-cp311-macosx_11_0_arm64.whl (272.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

helios_network-0.10.2-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.2-cp310-cp310-macosx_11_0_arm64.whl (272.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

helios_network-0.10.2-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.2-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.2.tar.gz.

File metadata

  • Download URL: helios_network-0.10.2.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.2.tar.gz
Algorithm Hash digest
SHA256 900c995f7e112a3128dfb4284b1984d3c31c0b51e5ced344320fef19090d9f2e
MD5 c178af8ac19ce7e91b9b37cadc229f2c
BLAKE2b-256 572d77bf24a0d10a654c6ae4119d2d28f4b42c4bc57d486e423c777371001c51

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2.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.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 406dec483433e5133ccf7bf7c0a77ffe2b1a5ab6460f7852c14665c590bf9f27
MD5 f8a32955976fe59ec627391a41f10b9a
BLAKE2b-256 910434884b1d07925c2e6c3b45f119a8f9938c988f069761ca7753a4ed372906

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-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.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c577139b44b98f4d142bbbd94e1eec72e343b9189f8c300141d2b848867c6507
MD5 5dc10868bff5db5dcae57cdc709a255d
BLAKE2b-256 3431bd5cee2c4bb36c33d88923edf8ddc68f5fad9397c51c32cf387987176643

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6ce8e5cea7a83585a8e916effe25c462228c7efb1d1bf8482f0be3adb6489c2c
MD5 3aeaef723c42320fe71cdbd50b56595b
BLAKE2b-256 6c0437066cb03c51f28ade65650010e0113017d6c435086293004c672f978497

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 245d052a8592eaa9e55d9d2f63de1c218f3c31c3a9816ba500e77272078d27d5
MD5 026cda500a8d838181cc1c6e781e535b
BLAKE2b-256 7021ffd2502a0b5852d749723a2ef5ee1d8aae6c358c3c928cd8d25a0ba5250a

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-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.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9c8114f1ffdbf0650fb7a0cd3e48b847d1fe77f0e8fb112f360c4f326eef351f
MD5 6a32f8dee04f4abe251d65558659ec40
BLAKE2b-256 19a967a31b0e46cbd5052359f10a763dfe0ed94231ca11bf6289f1f2c8af445a

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2690144103e3ebec79789f21c4d385bee2a5e9d1569f887c09ea9b3bb642c394
MD5 333315280a545f47d559ebe1964c6eee
BLAKE2b-256 b14916804ba8437595df3c737945d280514147085dadcd27b28bc85cce737804

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a8a73cbd49b8f0a04c5de1fd6b476e4121d35224dbb958fe9462d59eee3bd2f2
MD5 d19ea1acb95e1df74882f1e211410c5e
BLAKE2b-256 f1a2953cff32c17bd705d2e51f5e7fd4ab8e36883e02d9ab3e6308761e04dfe8

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-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.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5af782ee35b2dde7d759289ffd8ef8d085316ee667e83fca9945c180549ef513
MD5 ce99b0963333b4770fc75d14fff9c88d
BLAKE2b-256 c34dfd067f04c6b1d2001fdab9f355b0059fe9d6da2ac711b81179f1f13387d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a485985e16b05ab3261e492cf8d07e84058d9d31fc5dcb276946f452475ae65
MD5 43416bc65a64161fb41b5f93e78a5f12
BLAKE2b-256 03925dc23da8a9f7bcbe439c146f8cfba20ed6ec81ba51a86d591209bf5d0b6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0474464df39f156710989aeeb6a18883334481a5aeeed0e6619f4fde6a455ff9
MD5 07ac9f002732a657281fe3b5e860488a
BLAKE2b-256 0be87444b8708a2d853e3a4db6e46090b17054bc129e7ad385591a58ff9d809f

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-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.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7226220158f8754bca6c9287faa960da63be4f390dce1757de96d049daea9fe0
MD5 6727546b8add3b3727997149df6790a9
BLAKE2b-256 ca4d178b2b838494c4d93f7679f7342644955c8046fc199ccf57b38334aba867

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 42263da63d1001d01de3a38922972cd980516f8e29e1cc76340710cca6fd95f2
MD5 dcba3911f8508be5948f6273ca0da1d1
BLAKE2b-256 5fa829b964fc289fe5054ee5818efa5cbdc9706776173976bc3c1438b2d279fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 04ea6dee1cbf30f3ab2d42cec2fa469b53d832904123c3471a044e4b5695c3ae
MD5 11872daa8904a932a55c8172f6e9ca37
BLAKE2b-256 3a71941481d88e8f35b3a7fe97b17f768893f28edeeb28333496463e4a123def

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-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.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9782061ab944aa04188cd9bf5d1904b7101e8dc63b52f8498d44dfdea880e7be
MD5 16305a4d32c1e1ed32dcf19d59a93dc4
BLAKE2b-256 03d06d10689a4368e733ab54d60bc741263e343729b25e70181193f148998edd

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for helios_network-0.10.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 acdee8beb99c818aaa2c8af61a54e060cd8b7f9ae6c2d369022534daffa4bc9d
MD5 2fddeba714cc90f0e4a09085ce81cc39
BLAKE2b-256 0531722a042782f5ebe0ffbee9e34c250a5b5a6cecaee20bcd8817de8f9ad689

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.2-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