API: collections

GraphCollection

NEExT.collections.GraphCollection — a pydantic model holding a list of graphs.

GraphCollection
GraphCollection(
  graphs=[],                    # List[Graph]
  graph_type="networkx",        # "networkx" | "igraph"
  node_sample_rate=1.0,         # 0 < rate <= 1
)

# methods
add_graphs(
  graph_data_list,              # List[dict | networkx.Graph]
  graph_type=None,
  reindex_nodes=True,
  filter_largest_component=True,
  node_sample_rate=None,
) -> None
sample_nodes(random_seed=None) -> None
describe() -> dict

Key attributes: graphs (the Graph list), graph_type, node_sample_rate.

EgonetCollection

NEExT.collections.egonet_collection.EgonetCollection extends GraphCollection with per-node decomposition. Most users reach it through the framework’s compute_k_hop_egonets / compute_leiden_egonets, but it can be used directly:

EgonetCollection
EgonetCollection(
  egonet_feature_target=None,   # node attribute used as the egonet label
  skip_features=[],
)

# methods
compute_k_hop_egonets(
  graph_collection,
  k_hop=1,
  nodes_to_sample=None,
  sample_fraction=1.0,
  random_seed=13,
) -> None
compute_leiden_egonets(           # requires igraph backend
  graph_collection,
  n_iterations=10,
  resolution=1.0,
) -> None

See Egonets.

Graph

NEExT.graphs.Graph wraps a single backend graph. You rarely build it directly. Notable attributes:

AttributeMeaning
graph_idUnique identifier
graph_labelOptional label/target
nodesList of integer node IDs
edgesList of (src, dest) tuples
node_attributes / edge_attributesPer-node / per-edge attribute dicts
graph_type"networkx" or "igraph"
GThe underlying NetworkX or iGraph object

Egonet extends Graph, adding original_graph_id, original_node_id, and node_mapping (original → internal node IDs).