Saving internal property maps, not loading back in

I am storing a graph with internal property maps in gt format. Upon loading it back in it appears that all the internal properties were not saved. Is this because of the 2.57 version?

What can I do to save the internal property maps?

Thanks,
Alex

Version information below:

In [25]: gt.show_config()
version: 2.57
gcc version: 13.2.0
compilation flags: -DBOOST_ALLOW_DEPRECATED_HEADERS -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2 -fopenmp -O3 -fvisibility=default -fvisibility-inlines-hidden -Wno-deprecated -Wall -Wextra -ftemplate-backtrace-limit=0 -g -O2 -ffile-prefix-map=/build/graph-tool-n1IAsq/graph-tool-2.57+ds=. -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fdebug-prefix-map=/build/graph-tool-n1IAsq/graph-tool-2.57+ds=/usr/src/graph-tool-2.57+ds-1ubuntu1 -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now
install prefix: /usr
python dir: /usr/lib/python3.11/dist-packages
graph filtering: True
openmp: True
uname: Linux laptop 6.5.0-28-generic #29-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 28 23:46:48 UTC 2024 x86_64

Did you read at all the instructions for posting?

Unfortunately, it’s not possible to provide a solution to your problem or an answer to your question with the information provided.

To enable us to understand the situation, you need to provide all the items below:

  1. Your exact graph-tool version.
  2. Your operating system.
  3. A minimal working example that shows the problem.

Item 3 above is very important! If you provide us only with a vague description or only the part of the code that you believe causes the problem, then it is not possible to understand the context that may have contributed to it.

You need to provide us a complete example that runs and reproduces the problem you are observing.

To post code, please use triple back-ticks for proper formatting:

for x in range(100):
    print("hello world")

or upload your files as attachments.

My apologies, apparently I was saving the graph before naming the properties. The latter appears to internalize the properties. Is that correct?

The code snipped below works as documented in version 2.47:

from graph_tool.all import *

#Make a graph
g = Graph()

#Populate with two connected vertices
v1=g.add_vertex()
v2=g.add_vertex()
e=g.add_edge(v1,v2)

#Make internal properties
eweight=g.new_edge_property("double")
g.ep['weight value'] = eweight
vcolor=g.new_vertex_property("string")
g.vp['color value'] = vcolor

eweight[e]=25.3
vcolor[1]="#1c71d8"
vcolor[2]="#2ec27e"

gprop=g.new_graph_property("string")
g.gp['graph name'] = gprop
gprop="Try saving properties"

g.list_properties()

g.save("trythis.gt")
g2=load_graph("trythis.gt")

g.list_properties()
g2.list_properties()

Looks fine, except the line:

gprop="Try saving properties"

which should be instead

gprop[g]="Try saving properties"

Otherwise the graph property will not be set.

Ah yes, of course! Thank you!