Positional Encoding Usage

We provide two ways of incorporating PEs, node PE (NPE) and edge PE (EPE), by simply adding a configuration of PE.

The configurations can be found in ./configs/pe/, and the implementations can be found in ./models/middle_model.py.

A sample config can be like:

model:
pe_file_name: lap_naive
pe_type: lap
pe_strategy: variant
lap_pe_dim_input: 10
lap_pe_dim_output: 10
se_pe_dim_input: 0
se_pe_dim_output: 0

eigval_encoder:
  in: 1
  hidden: 32
  out: 8
  num_layer: 3

pe_embedder:
  name: naive

The table below show the configuration to use for magnetic Laplacian PE with NPE or EPE:

stable

potential q

pe_type

pe_strategy

pe_embedder

example

NPE

NPE

EPE

EPE

q=0

q>0

q=0

q>0

lap

maglap

lap

maglap

variant

variant

invariant_fixed

invariant_fixed

naive

naive

./configs/pe/lap10/lap_naive

./configs/pe/maglap10/maglap_1q_naive

./configs/pe/lap10/lap_spe

./configs/pe/maglap10/maglap_1q_spe

The eigval_encoder is used to configure the hyper-parameters of stable PE.

Note that NPE directly concatenate PE with node feature, while EPE processes PE with stable PE and concatenates PE on edge features.