Skip to content

gavjmooney/geg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GEG Encodes Graphs

GEG Encodes Graphs is a JSON based storage format for encoding graph drawings which contain complex edge geometries using SVG path commands. GEG enables readability metric calculations on drawings containing curved/polygonal edges.

This package contains code for reading/writing GEG files, converting to/from other common formats, and several readability metric implementations.

For more information, see the following publication:

G. J. Mooney, T. Hegemann, A. Wolff, M. Wybrow, and H. Purchase, "Universal Quality Metrics for Graph Drawings: Which Graphs Excite Us Most?," in Graph Drawing and Network Visualization (GD 2025), 2025.

Installation

Install from PyPI (distribution name is geg-metrics):

pip install geg-metrics

Then import as:

import geg

Usage

Read a GEG file and compute a metric

import geg

G = geg.read_geg("example.geg")
print("Aspect ratio:", geg.aspect_ratio(G))

Convert GraphML to GEG and compute metrics

import geg

# Read GraphML into an internal graph, convert to a GEG-like NetworkX graph
G = geg.graphml_to_geg("example.graphml")

# Optionally write out a .geg file
geg.write_geg(G, "example_converted.geg")

# Compute metrics
print("Aspect ratio:", geg.aspect_ratio(G))
print("Angular resolution (avg):", geg.angular_resolution_avg_angle(G))
print("Edge length deviation:", geg.edge_length_deviation(G))

Render to SVG

import geg

G = geg.read_geg("example.geg")
geg.to_svg(G, "example.svg", margin=50)

Notes

  • Install name on PyPI is geg-metrics, but the import is import geg.
  • Most metrics expect node coordinates (x, y) and edge paths (path) to be present.

About

GEG (GEG Encodes Graphs) is a format for encoding graph drawings, where SVG paths are used to describe edge geometry. The repository contains code for parsing and rendering geg files, and converting to/from other graph formats. The format is based on a simple JSON schema to encode graph and layout properties.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages