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

Uploaded CPython 3.13Windows x86-64

helios_network-0.10.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (366.9 kB view details)

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

helios_network-0.10.3-cp313-cp313-macosx_11_0_arm64.whl (273.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

helios_network-0.10.3-cp312-cp312-win_amd64.whl (504.1 kB view details)

Uploaded CPython 3.12Windows x86-64

helios_network-0.10.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (366.9 kB view details)

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

helios_network-0.10.3-cp312-cp312-macosx_11_0_arm64.whl (273.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

helios_network-0.10.3-cp311-cp311-win_amd64.whl (503.8 kB view details)

Uploaded CPython 3.11Windows x86-64

helios_network-0.10.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (366.7 kB view details)

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

helios_network-0.10.3-cp311-cp311-macosx_11_0_arm64.whl (273.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

helios_network-0.10.3-cp310-cp310-win_amd64.whl (503.8 kB view details)

Uploaded CPython 3.10Windows x86-64

helios_network-0.10.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (366.6 kB view details)

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

helios_network-0.10.3-cp310-cp310-macosx_11_0_arm64.whl (273.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

helios_network-0.10.3-cp39-cp39-win_amd64.whl (504.5 kB view details)

Uploaded CPython 3.9Windows x86-64

helios_network-0.10.3-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (366.6 kB view details)

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

helios_network-0.10.3-cp39-cp39-macosx_11_0_arm64.whl (273.7 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: helios_network-0.10.3.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.3.tar.gz
Algorithm Hash digest
SHA256 bed842ae9c72e09c008a97b8732d9655d9ba017cea32ae4eac242ca23e744d57
MD5 21d9742b2fe53a8a50efdc2fc39d2a95
BLAKE2b-256 aaa42a7115d4bfc5d956b159b8b5a58f7ef2bc173de80db5f8663198de8a6d12

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for helios_network-0.10.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8c3aaa3d20b1e278e9ba1479d45e166c9a25cd9a322e5005bd6d854959f917da
MD5 48edf300a501b5aead89f5519800b16a
BLAKE2b-256 60b625b267c013d4ce99e03f0d1813ccf25e23ed4f422013dffc494be82b2fb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.3-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.3-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.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3650fda0e76c18dc9f6580f5b9386c6fcbffecd341841769d2d30980fd1ece72
MD5 9538f5ca57c0268d2b94fa55ee4e0d1c
BLAKE2b-256 e01bc0793b85036a0ac5558fc8d0e44c6941a7ad5e85c6697355623919d74039

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for helios_network-0.10.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 196e07188eec95e91d3886b17bb03ffa5ad926086b9709ea15904eab45a74530
MD5 c0e97487920ce48a4d44248c83135be4
BLAKE2b-256 d126247cda00f166817c608ab6e7f47f268a5a11446f15366dca4df46518cc4c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for helios_network-0.10.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6759eecf1efddab2b9ec41c8fa0d4b30dd6f168a649fb4be81a1d8de6d0662af
MD5 e38f6dd2f101c39f6d623e8e3fade53e
BLAKE2b-256 465a6d92a0e4ab8bef1ce8e65aa0da5b2de33c1d1fac9bef57ac768bec865166

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.3-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.3-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.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6f5f1ffbb0954f00d3e60bc9ff2a5baf3a82fb1d78137b33b361d8d396517a2f
MD5 65ff75b1e1dc45896eab04701551d901
BLAKE2b-256 f4c769efb27015df33def2e0480cf9bc8a4e6e3488bfc940f54a23a1c402ab67

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for helios_network-0.10.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f3856d79fa21b242d1b14e4303d9ea1470a77f72e42cca0c52e9666ba425a255
MD5 c5b5821e5b3c684e508cf3d377db400b
BLAKE2b-256 de185253989f56243d181b3032ddcbc83cef877d9a1bd0204a73030947c8434f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for helios_network-0.10.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b1f3c8bf20f65fca555306a4ef1c13d3bc0446816c2b6d00768f20cb95d7c69b
MD5 e82c793fce9824299e13cce5019e04a0
BLAKE2b-256 0434897072d82b97f59720ddb5629967b8331130dc56ddeeb344fab656324e7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.3-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.3-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.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2fdc23e0a1ed220333dee937d28f8d94cca4854788d840b3b1a0dffb29f21556
MD5 384bad4bbfa2949d8f4b77ae50b0ef0e
BLAKE2b-256 b32fd940657495194d8ae5b2a6d5f38bc4c4fa3fa9980c8e3c2cf3a2b39ad527

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for helios_network-0.10.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 766bb4fb74a2091046f9e0df19688071f4500cc2778d19b36c58135d6aca97dc
MD5 7bd1a0bd39c7ac18c18c8a9a5a47fe76
BLAKE2b-256 f30199b7f9f158f4be3891dafda1e5ef77bfc04ad284406d6f154a5f6d804e24

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for helios_network-0.10.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 84d615ab6da74efd7a1847d2f38fbf3477453c38add6fac5843f4fba540b5ecc
MD5 cedf290057cc88595aa08d683881bd46
BLAKE2b-256 ecb86ba4b969d1c1add57135577045386b82f18babbabefe23f1fb94fdb9492a

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.3-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.3-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.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ed8f093537345c4d99d92a1a90945093b0ea565678d6acaf7890663bc65f2584
MD5 26965684a42604654bd60be60faf6574
BLAKE2b-256 675545782f96bd80d1053731129a8ea1c51185fa97dd8cebcc47f6eaa61b61f6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for helios_network-0.10.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2a64e65a3318f5a2a0946050b502974706fbfe0a0ca4e0fbbd17d34162338555
MD5 c7e493307033eeb3f78b80a926025b03
BLAKE2b-256 2250e6d2728e28179a7c0d8f0d1832d94c868528d7d37fc5698a08f8622558b3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for helios_network-0.10.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0590a032c336f017c2789501c664fe4025f2f46bfa7e284d6bdc858be48cd6d7
MD5 d709b174389ba2c589822c24a35cd0e2
BLAKE2b-256 dbab83cb9b16ce55bddd6bbd76e66e303389dddbc367de94d040798977844a15

See more details on using hashes here.

Provenance

The following attestation bundles were made for helios_network-0.10.3-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.3-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.3-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b98baaf2920278fafbfb61d713cb3ef5f388542a7f423c17cfc30941dba8f208
MD5 2c95577ac3f674bb7f78d9cf9afb71e3
BLAKE2b-256 e0fc23f22ae04977a264243da36446d0e88c1efbbe696a84e1c30df590e99ab2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for helios_network-0.10.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4803ad11efd726dc3bb98de4bbb81977da642fdf63baf36f8feb6cbcda4bd0f
MD5 9a4b80f513cbffbe4bfaa810117a2bfb
BLAKE2b-256 07ae0a0fdfd93cc2efd8ec60cc8733ea12bf3cafc552a1d88e9b69c5c6b45b92

See more details on using hashes here.

Provenance

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