Graph Operations

Batched graph-level operations for message-passing and graph reconstruction, exposed via pyc::graph.

pyc::graph Functions

Function

Description

edge_aggregation(edge_index, prediction, node_feature)

Aggregate node features along edges weighted by prediction

node_aggregation(edge_index, prediction, node_feature)

Aggregate edge scores back to nodes

unique_aggregation(cluster_map, features)

Aggregate features by integer cluster label (reduces to number of clusters)

PageRank(edge_index, edge_scores, alpha, threshold, norm_low, timeout, num_cls)

Personalised PageRank convergence; returns cluster assignment and scores

PageRankReconstruction(edge_index, edge_scores, pmc, …)

PageRank + batched 4-momentum sum per cluster

pyc::graph::polar overloads accept (pt, eta, phi, e) or a stacked pmu tensor instead of cartesian pmc for aggregation functions.

namespace graph

Graph-level aggregation and PageRank reconstruction.

Functions

torch::Dict<std::string, torch::Tensor> edge_aggregation(torch::Tensor edge_index, torch::Tensor prediction, torch::Tensor node_feature)

Aggregate node features along edges weighted by prediction.

torch::Dict<std::string, torch::Tensor> node_aggregation(torch::Tensor edge_index, torch::Tensor prediction, torch::Tensor node_feature)

Aggregate edge features to nodes weighted by prediction.

torch::Dict<std::string, torch::Tensor> unique_aggregation(torch::Tensor cluster_map, torch::Tensor features)

Aggregate features within unique cluster assignments.

torch::Dict<std::string, torch::Tensor> PageRank(torch::Tensor edge_index, torch::Tensor edge_scores, double alpha = 0.85, double threshold = 0.5, double norm_low = 1e-6, long timeout = 1e6, long num_cls = 2)

Batched personalised PageRank clustering.

torch::Dict<std::string, torch::Tensor> PageRankReconstruction(torch::Tensor edge_index, torch::Tensor edge_scores, torch::Tensor pmc, double alpha = 0.85, double threshold = 0.5, double norm_low = 1e-6, long timeout = 1e6, long num_cls = 2)

PageRank clustering followed by four-momentum reconstruction.

namespace cartesian

Functions

torch::Dict<std::string, torch::Tensor> edge_aggregation(torch::Tensor edge_index, torch::Tensor prediction, torch::Tensor pmc)
torch::Dict<std::string, torch::Tensor> node_aggregation(torch::Tensor edge_index, torch::Tensor prediction, torch::Tensor pmc)
torch::Dict<std::string, torch::Tensor> edge_aggregation(torch::Tensor edge_index, torch::Tensor prediction, torch::Tensor px, torch::Tensor py, torch::Tensor pz, torch::Tensor e)
torch::Dict<std::string, torch::Tensor> node_aggregation(torch::Tensor edge_index, torch::Tensor prediction, torch::Tensor px, torch::Tensor py, torch::Tensor pz, torch::Tensor e)
namespace polar

Functions

torch::Dict<std::string, torch::Tensor> edge_aggregation(torch::Tensor edge_index, torch::Tensor prediction, torch::Tensor pmu)
torch::Dict<std::string, torch::Tensor> node_aggregation(torch::Tensor edge_index, torch::Tensor prediction, torch::Tensor pmu)
torch::Dict<std::string, torch::Tensor> edge_aggregation(torch::Tensor edge_index, torch::Tensor prediction, torch::Tensor pt, torch::Tensor eta, torch::Tensor phi, torch::Tensor e)
torch::Dict<std::string, torch::Tensor> node_aggregation(torch::Tensor edge_index, torch::Tensor prediction, torch::Tensor pt, torch::Tensor eta, torch::Tensor phi, torch::Tensor e)

Internal Kernel Namespace

namespace graph_

Internal namespace for CUDA-accelerated graph aggregation.

Functions

std::map<std::string, torch::Tensor> unique_aggregation(torch::Tensor *cluster_map, torch::Tensor *features)

Sum features within each unique cluster in cluster_map.

Parameters:
  • cluster_map – [N] integer cluster assignments.

  • features – [N, D] node features.

Returns:

Map with keys "clusters" and "cluster_map".

std::map<std::string, torch::Tensor> edge_aggregation(torch::Tensor *edge_index, torch::Tensor *prediction, torch::Tensor *node_feature)

Aggregate node_feature along source edges, weighted by prediction.

Parameters:
  • edge_index – [2, E] COO edge index.

  • prediction – [E] or [E, C] edge weights/predictions.

  • node_feature – [N, D] node features.

Returns:

Map containing "nodes" and "node_map".

std::map<std::string, torch::Tensor> node_aggregation(torch::Tensor *edge_index, torch::Tensor *prediction, torch::Tensor *node_feature)

Aggregate node_feature along destination edges, weighted by prediction.

Parameters:
  • edge_index – [2, E] COO edge index.

  • prediction – [E] or [E, C] edge weights/predictions.

  • node_feature – [N, D] node features.

Returns:

Map containing "nodes" and "node_map".