Skip to content

cosmograph-org/python-layout-precompute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-layout-precompute

Minimal Python CLI to precompute force-directed graph layout coordinates from parquet edge lists.

1) Create env and install

python3 -m venv .venv
source .venv/bin/activate
pip install .

2) Run on your files

precompute-layout \
  --edges links.parquet \
  --nodes points.parquet \
  --output points_layout.parquet

Output parquet columns:

  • id
  • x
  • y

Notes:

  • The script expects edge columns source and target by default.
  • If --nodes exists, its id column is used so isolated nodes also get coordinates.

Incremental updates

Scalable incremental refine

Re-use the previous coordinates as seed and do a refine pass:

precompute-layout \
  --edges links.parquet \
  --nodes points.parquet \
  --previous-layout points_layout.parquet \
  --mode drl_refine \
  --output points_layout_next.parquet

Strictly freeze old nodes

Keep existing node coordinates fixed and only place new nodes:

precompute-layout \
  --edges links.parquet \
  --nodes points.parquet \
  --previous-layout points_layout.parquet \
  --mode fr_freeze \
  --fr-niter 200 \
  --output points_layout_next.parquet

fr_freeze is stricter but can be slower on very large graphs.

About

Example of how to precompute a graph layout with Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages