API: the NEExT class
NEExT.framework.NEExT is the main entry point, exported as from NEExT import NEExT.
Signatures below match the source in NEExT/framework.py (v0.3.1).
Constructor
NEExT(log_level: str = "INFO") set_log_level(level: str) -> None changes the level later ("DEBUG", "INFO",
"WARNING", "ERROR", "CRITICAL").
Loading
read_from_csv(
edges_path,
node_graph_mapping_path,
graph_label_path=None,
node_features_path=None,
edge_features_path=None,
graph_type="networkx",
reindex_nodes=True,
filter_largest_component=True,
node_sample_rate=1.0,
) -> GraphCollection
load_from_networkx(
nx_graphs,
graph_type="networkx",
reindex_nodes=True,
filter_largest_component=True,
node_sample_rate=1.0,
) -> GraphCollection See Data loading. DataFrame loading lives on GraphIO.load_from_dfs.
Features
compute_node_features(
graph_collection,
feature_list,
feature_vector_length=3,
normalize_features=True,
show_progress=True,
n_jobs=1,
my_feature_methods=None,
parallel_backend="loky", # "loky" | "threading"
profile_features=False,
joblib_kwargs=None,
) -> Features See Structural features.
Embeddings
compute_graph_embeddings(
graph_collection,
features,
embedding_algorithm, # "approx_wasserstein" | "wasserstein" | "sinkhornvectorizer" | "gnn"
embedding_dimension,
feature_columns=None,
random_state=42,
memory_size="4G",
# GNN-only (used when embedding_algorithm == "gnn"):
architecture="GCN", # "GCN" | "GraphSAGE" | "GIN"
hidden_dims=None, # default [64, 32]
epochs=100,
learning_rate=0.01,
weight_decay=5e-4,
dropout=0.0,
pooling="mean", # "mean" | "sum" | "max"
early_stopping_patience=10,
) -> Embeddings See Embeddings.
Models & importance
train_ml_model(
graph_collection,
embeddings,
model_type, # "classifier" | "regressor"
balance_dataset=False,
sample_size=5,
n_jobs=-1,
parallel_backend="process",
) -> dict
compute_feature_importance(
graph_collection,
features,
feature_importance_algorithm, # "supervised_greedy" | "supervised_fast" | "unsupervised"
embedding_algorithm="approx_wasserstein",
random_state=42,
n_iterations=5,
n_jobs=-1,
parallel_backend="process",
) -> pandas.DataFrame See ML models and Feature importance.
Egonets
compute_k_hop_egonets(
graph_collection,
k_hop=1,
egonet_feature_target=None,
skip_features=None,
nodes_to_sample=None,
sample_fraction=1.0,
random_seed=13,
) -> EgonetCollection
compute_leiden_egonets( # requires the iGraph backend
graph_collection,
egonet_feature_target=None,
skip_features=None,
n_iterations=10,
resolution=1.0,
) -> EgonetCollection See Egonets.
Synthetic graphs
generate_synthetic_graphs(
preset=None, # e.g. "er_vs_ba", "multiclass_topology", ...
specs=None, # list of (GeneratorSpec, count)
seed=42,
**kwargs, # forwarded to the preset
) -> GraphCollection See Synthetic graphs.