Skip to content

fix: write GML without explicit vertex IDs#2745

Open
LeonidasZhak wants to merge 2 commits into
igraph:mainfrom
LeonidasZhak:fix/gml-null-id-2710
Open

fix: write GML without explicit vertex IDs#2745
LeonidasZhak wants to merge 2 commits into
igraph:mainfrom
LeonidasZhak:fix/gml-null-id-2710

Conversation

@LeonidasZhak

@LeonidasZhak LeonidasZhak commented Jul 11, 2026

Copy link
Copy Markdown

Summary

Allow write_graph(..., format = "gml") to use the GML writer's default vertex IDs when id is omitted. Fixes #2710.

Thanks to maintainers

Thanks for triaging the report, requesting a regression test, and reviewing the branch refresh.

Issue or motivation

Writing any graph as GML currently fails unless the caller supplies one ID per vertex. Earlier versions generated node IDs when none were supplied.

Root cause

Stimulus treated the C writer's nullable id pointer as a required vector. The generated R wrapper converted NULL to numeric(0), so C received an empty vector instead of a null pointer and rejected its length.

Change

Mark id as optional in the Stimulus metadata and regenerate both interface layers. The added test writes a graph without IDs and reads it back to confirm graph isomorphism.

Tests

  • air format --check .
  • Focused test-foreign.R: 13 passed, 0 failed, 0 warnings
  • R CMD build: succeeded, including vignette creation
  • R CMD check --no-manual on R 4.6.1: 0 errors; package tests and vignette rebuild passed; one existing warning comes from vendored GLPK
  • GitHub rcc is currently action_required; the workflow created no jobs or logs and requires maintainer approval to run

Scope

Explicit IDs, other file formats, GML serialization details, and vendored C sources are unchanged.

I used AI assistance to help check for issues, refine the code, and run tests.

I'm fine with GPL 2 or later and FDL.

  • By submitting this pull request, I assign the copyright of my contribution to The igraph development team.

@schochastics

Copy link
Copy Markdown
Contributor

LGTM if CI is green

@krlmlr

krlmlr commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Working on fixing checks on main, let's merge main into this branch when done to get it green.

@LeonidasZhak

Copy link
Copy Markdown
Author

Summary

Merged the current main branch into this PR branch as requested. The GML fix itself is unchanged.

Thanks to maintainers

Thanks for reviewing the fix and for the guidance on when to refresh the branch.

Issue or motivation

The branch was seven commits behind main, including the recent package-cleanup changes, so its CI result no longer represented the current repository state.

Root cause

The previous PR checks ran against the older base at acd63244. The branch needed the current main history before CI could reassess the patch.

Change

Merged igraph/rigraph@e772e9e7 without conflicts. Relative to current main, the PR still changes only the four original GML interface/test files.

Tests

  • air format .
  • focused test-foreign.R: four non-skipped tests passed; six CRAN-gated tests skipped
  • NOT_CRAN=true testthat::test_local(..., stop_on_failure = TRUE)
  • full vignette build with R CMD build
  • R CMD check --no-manual: tests and vignette rebuild passed; two existing vendored-GLPK warnings and one local rgl/X11 note remain

Scope

This update only syncs the PR with main. It does not alter the GML patch, workflows, vendored GLPK, or unrelated current-main CI failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

write_graph(g, format = "gml") fails because NULL id coerced to numeric(0)

3 participants