diff --git a/CHANGELOG.md b/CHANGELOG.md index c186f5281..6317bc16c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # igraph Python interface changelog +## [main] + +### Fixed + +- Fixed import of `graph-tool` graphs for vertex properties where each property + has a vector value. + ## [0.11.3] - 2023-11-19 ### Added diff --git a/src/igraph/io/libraries.py b/src/igraph/io/libraries.py index d47490292..52e47b8af 100644 --- a/src/igraph/io/libraries.py +++ b/src/igraph/io/libraries.py @@ -248,9 +248,12 @@ def _construct_graph_from_graph_tool(cls, g): # Node attributes for key, val in g.vertex_properties.items(): + # val.get_array() returns None for non-scalar types so use the slower + # way if this happens prop = val.get_array() + arr = prop if prop is not None else val for i in range(vcount): - graph.vs[i][key] = prop[i] + graph.vs[i][key] = arr[i] # Edges and edge attributes # NOTE: graph-tool is quite strongly typed, so each property is always