A Pytorch implementation to generated directed graphs in the discrete flow matching framework.
Paper: https://arxiv.org/abs/2506.16404
There are two options for environment installation: a conda environment or using pixi.
🐍 To create the conda environment:
conda env create -f environment.yaml
conda activate directo✨ To use pixi, install it and run the desired command preceeded by:
pixi run ...The script is runnable from main.py (inside src) which uses Hydra overrides.
python main.py +experiment=debugAn example of a training run would be:
python main.py +experiment=visual_genome dataset=visual_genome dataset.acyclic=False model.extra_features=rrwp-pprThe following parameters can be configured:
-
dataset,experiment:
Choose one of:synthetic|tpu_tile|visual_genome -
model.extra_features:
These are the positional encodings it is possible to choose from. Extra features to include:null|eigenvalues|magnetic-eigenvalues|rrwp|rrwp-ppr|mult-magnetic-eigenvalues(Q = 5) |mult10-magnetic-eigenvalues(Q = 10) -
dataset.acyclic:
Set totrueorfalsedepending on the dataset (only relevant for some synthetic datasets, otherwise the default is already set in the corresponding Hydra config).
Additional options are available for the synthetic dataset. If you select dataset=synthetic, you can further configure:
-
dataset.graph_type:
Graph generation model:er|sbm|ba -
dataset.acyclic:
Whether to generate directed acyclic graphs:true(for ER, BA) |false(for ER, SBM)
To run discrete diffusion set model.backbone=diffusion
To search for the best sampling configuration, you can run:
python main.py +experiment=visual_genome dataset=visual_genome dataset.acyclic=False \
model.extra_features=rrwp-ppr general.num_sample_fold=5 general.test_only=your_checkpoint \
sample.search=all⚙️ Available parameters
all— searches through the three parametersstochasticity— searches over stochastic leveldistortion— searches over distortion functionstarget_guidance— searches over targuet guidance levels
Once the best sampling parameters are identified, update the configuration accordingly and run:
python main.py +experiment=visual_genome dataset=visual_genome dataset.acyclic=False \
model.extra_features=rrwp-ppr general.num_sample_fold=5 general.test_only=your_checkpoint \
sample.eta=10 sample.omega=0.1 sample.time_distortion=polydecBaseline experiments follow a similar procedure and their adaptation can be found in the src/baselines directory.
@article{carballo2025directo,
title = {Generating Directed Graphs with Dual Attention and Asymmetric Encoding},
author = {Carballo-Castro, Alba and Madeira, Manuel and Qin, Yiming and Thanou, Dorina and Frossard, Pascal},
year = {2025},
url = {https://arxiv.org/abs/2506.16404}
}