Here is a minimal code that shows this behaviour:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from numpy import array
import graph_tool.all as gt
print 'Graph_tool version : %s' % gt.__version__
def test1():
print ('\n'
'Performing test1:\n'
'-----------------')
graph1 = gt.lattice((2,2), periodic=False)
pos = graph1.new_vertex_property('float')
pos.a = array([0.0,0.1,
1.0, 1.1])
graph1.vertex_properties['pos'] = pos
print ('\n'
'original pos: %s\n'
'reload graph property:\n'
' %s\n') % (str(pos.a),
str(graph1.vertex_properties['pos'].a))
graph1.save("graph_tool_io_test1.xml")
return graph1
def test2():
print ('\n'
'Performing test2:\n'
'-----------------')
graph2 = gt.load_graph("graph_tool_io_test1.xml")
pos = array([0.0,0.1,
1.0, 1.1])
print ('\n'
'original pos: %s\n'
'reload graph property:\n'
' %s\n') % (str(pos),
str(graph2.vertex_properties['pos'].a))
return graph2
def test3():
graph3 = gt.lattice((2,2), periodic=False)
pos = graph3.new_vertex_property('float')
pos.a = array([0.0,0.1,
1.0, 1.1])
graph3.load("graph_tool_io_test1.xml")
print ('\n'
'original graph property: %s\n'
'reload graph property: %s\n') % (str(pos.a),
str(graph3.vertex_properties['pos'].a))
return graph3
if __name__ == '__main__':
switch = sys.argv[1]
if switch == 'all':
graph1 = test1()
graph2 = test2()
graph3 = test3()
elif switch == 'test1':
graph1 = test1()
elif switch == 'test2':
graph2 = test2()
elif switch == 'test3':
graph3 = test3()
elif switch == 'import-only':
print 'Imports only'
else:
print 'Usage: python test.py {all|test1|test2|test3}'
##### End
Le 02/10/2012 14:37, Guillaume a écrit :
Hi list, hi Tiago,
First thank you for graph tool, that's a great package.
I run in a very strange problem when reloading a xml graph file with an
'internalized' PropertyMap.
the minimum script does the following:
* test1: create, internalize the PropertyMap pos1, save the graph in xml
* test2: load the graph from xml, read the internalized PropertyMap pos2
Depending whether the two tests are ran in separate processes are in the
same process, the two Propertymaps will not have the same values:
test1 and 2 in the same process:
pos1 == pos2
test1 and test2 in different processes
pos1 != pos2
--
View this message in context:
http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Strange-save-load-graph-behaviour-tp4024788.html
Sent from the Main discussion list for the graph-tool project mailing list
archive at Nabble.com.
_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool
_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool