Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pajek writer outputs NaN values #2560

Open
szhorvat opened this issue Apr 3, 2024 · 3 comments
Open

Pajek writer outputs NaN values #2560

szhorvat opened this issue Apr 3, 2024 · 3 comments
Labels
fuzz Issues found using fuzzing, or related to fuzzing
Milestone

Comments

@szhorvat
Copy link
Member

szhorvat commented Apr 3, 2024

Describe the bug

The Pajek writes outputs NaN attribute values, but the Pajek format does not actually support these.

igraph's Pajek reader cannot read NaN values either.

This makes it impossible to test round-tripping through the Pajek format in the write_all fuzz targets.

To reproduce

write_graph(make_empty_graph() + vertex(x=NaN, y=NaN), "badpaj.net", "pajek")

Output:

*Vertices 1
1 "1" NaN NaN
*Arcs

Version information
Current master

@szhorvat szhorvat added the fuzz Issues found using fuzzing, or related to fuzzing label Apr 3, 2024
@szhorvat szhorvat changed the title Pajek writes outputs NaN values Pajek writer outputs NaN values Apr 3, 2024
@szhorvat
Copy link
Member Author

szhorvat commented Apr 3, 2024

What would be a good solution here? Perhaps skip standard Pajek attributes that contain NaN and issue a warning? igraph_vector_is_any_nan() should make it easy enough.

@krlmlr Is it easy to quickly replace all NA and NaN by a zero in a vector in R? I'd like to understand if it'd be easy for an R user to deal with this change.

@szhorvat szhorvat added this to the 1.0 milestone Apr 3, 2024
@szhorvat
Copy link
Member Author

szhorvat commented Apr 3, 2024

I wouldn't fix this before 1.0 since @ntamas already modified the Pajek reader/writer on develop, and it is not a high-impact bug.

@szhorvat szhorvat modified the milestones: 1.0, 1.1 Apr 17, 2024
@szhorvat
Copy link
Member Author

I suggest replacing any NaN with Pajek's defaults for that specific attribute when writing the graph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fuzz Issues found using fuzzing, or related to fuzzing
Projects
None yet
Development

No branches or pull requests

1 participant