Skip to content

When exporting a matrix-valued attribute, it is treated as numeric scalar #1847

Open
@szhorvat

Description

@szhorvat

What happens, and what did you expect instead?

When exporting a matrix-valued attribute, it is treated as numeric scalar. The first element is exported, the rest are discarded.

CC @ntamas as this concerns the attribute interface as well, however, I believe this is in the end about how the R interface communicates the attribute type to the C core. Serializing into a string would perhaps be better.

To reproduce

library(igraphdata)
library(igraph)
data('kite')
write_graph(kite, 'kite.gml', 'gml')

Excerpts from the output:

graph
[
  directed 0
  name "Krackhardt's kite"
  layout 1

System information

R version 4.5.0 (2025-04-11)
Platform: aarch64-apple-darwin20
Running under: macOS Sequoia 15.4.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.1

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Atlantic/Reykjavik
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] igraph_2.1.4.9041     igraphdata_1.0.1.9013

loaded via a namespace (and not attached):
 [1] compiler_4.5.0    magrittr_2.0.3    cli_3.6.5         ragg_1.4.0       
 [5] tools_4.5.0       rstudioapi_0.17.1 pkgload_1.4.0     textshaping_1.0.0
 [9] lifecycle_1.0.4   systemfonts_1.2.2 pkgconfig_2.0.3   rlang_1.1.6      

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions