Skip to content

Instantly share code, notes, and snippets.

View danielSanchezQ's full-sized avatar
🦀

Daniel Sanchez danielSanchezQ

🦀
View GitHub Profile
from typing import List, Set, TypeAlias, Sequence
from itertools import cycle
NodeId: TypeAlias = bytes
def calculate_subnets(nodes_list: Sequence[NodeId], num_subnets: int, replication_factor: int) -> List[Set[NodeId]]:
"""
Calculate in which subnet(s) to place each node.