Skip to content

fix: write GML without explicit vertex IDs#2745

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

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

Conversation

@LeonidasZhak

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 and asking for a regression test.

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 .
  • Focused foreign-format tests: 13 passed, 0 failed, 0 warnings
  • devtools::check() with CRAN lifecycle 1.0.5: all 8,185 package tests passed; 0 errors, with three unchanged local warnings from vendored GLPK and unavailable checkbashisms

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.

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

Labels

None yet

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)

1 participant