Hi, I'm encountering a perplexing issue that I've spent some time trying to make sense of. Apologies if this should go on the gitlab issues page, but it tells me my account has been blocked for every method I've attempted to register an account there.
I get a Boost dump any time I attempt to read an edge property. I can read and write graph and vertex properties fine. I can also write to an edge property just fine. If I try to read an edge property I get an exception.
I have tried many methods of installing graph_tool all with the same result. I believe I have tried all of the following: install graph_tool from the ubuntu package manager, install with conda, compile graph_tool and all dependencies from scratch on ubuntu, do a fresh install of gentoo and install using emerge. All have resulted in the same error.
Am I doing something stupid here or is this broken? Below is a minimal example.
uname -srm
Linux 5.10.60-gentoo-dist x86_64
Python 3.9.6 (default, Aug 24 2021, 15:56:03) [GCC 10.3.0] on linux
import graph_tool as gt gt.__version__
'2.43 (commit 9d41331e, Wed Jul 7 15:32:52 2021 +0200)'
G = gt.Graph(directed=True) G.gp["name"] = G.new_graph_property("string") G.ep["name"] = G.new_edge_property("string") G.vp["name"] = G.new_vertex_property("string")
# name the graph G.gp.name = "Test graph"
# add the vertices v = G.add_vertex(2)
# name the vertices names = ["A", "B"] for (_v, name) in zip(v, names):
... G.vp.name[_v] = name ...
# add the edge V = list(G.vertices()) e = G.add_edge(V[0], V[1])
# name the edge G.ep.name[e] = "0 -> 1"
# print the graph name print(G.gp.name)
Test graph
# print the vertex names for v in G.iter_vertices():
... print(v, G.vp.name[v]) ... 0 A 1 B
# print the edge names for e in G.iter_edges():
... print(e) ... print(G.ep.name[e]) ... [0, 1] Traceback (most recent call last): File "<stdin>", line 3, in <module> File "/usr/lib/python3.9/site-packages/graph_tool/__init__.py", line 887, in __getitem__ return self._PropertyMap__map[k] Boost.Python.ArgumentError: Python argument types in EdgePropertyMap<string>.__getitem__(EdgePropertyMap<string>, list) did not match C++ signature: __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::adj_edge_index_property_map<unsigned long> > > {lvalue}, graph_tool::PythonEdge<boost::filt_graph<boost::undirected_adaptor<boost::adj_list<unsigned long> >, graph_tool::detail::MaskFilter<boost::unchecked_vector_property_map<unsigned char, boost::adj_edge_index_property_map<unsigned long> > >, graph_tool::detail::MaskFilter<boost::unchecked_vector_property_map<unsigned char, boost::typed_identity_property_map<unsigned long> > > > const>) __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::adj_edge_index_property_map<unsigned long> > > {lvalue}, graph_tool::PythonEdge<boost::filt_graph<boost::reversed_graph<boost::adj_list<unsigned long>, boost::adj_list<unsigned long> const&>, graph_tool::detail::MaskFilter<boost::unchecked_vector_property_map<unsigned char, boost::adj_edge_index_property_map<unsigned long> > >, graph_tool::detail::MaskFilter<boost::unchecked_vector_property_map<unsigned char, boost::typed_identity_property_map<unsigned long> > > > const>) __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::adj_edge_index_property_map<unsigned long> > > {lvalue}, graph_tool::PythonEdge<boost::filt_graph<boost::adj_list<unsigned long>, graph_tool::detail::MaskFilter<boost::unchecked_vector_property_map<unsigned char, boost::adj_edge_index_property_map<unsigned long> > >, graph_tool::detail::MaskFilter<boost::unchecked_vector_property_map<unsigned char, boost::typed_identity_property_map<unsigned long> > > > const>) __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::adj_edge_index_property_map<unsigned long> > > {lvalue}, graph_tool::PythonEdge<boost::undirected_adaptor<boost::adj_list<unsigned long> > const>) __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::adj_edge_index_property_map<unsigned long> > > {lvalue}, graph_tool::PythonEdge<boost::reversed_graph<boost::adj_list<unsigned long>, boost::adj_list<unsigned long> const&> const>) __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::adj_edge_index_property_map<unsigned long> > > {lvalue}, graph_tool::PythonEdge<boost::adj_list<unsigned long> const>) __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::adj_edge_index_property_map<unsigned long> > > {lvalue}, graph_tool::PythonEdge<boost::filt_graph<boost::undirected_adaptor<boost::adj_list<unsigned long> >, graph_tool::detail::MaskFilter<boost::unchecked_vector_property_map<unsigned char, boost::adj_edge_index_property_map<unsigned long> > >, graph_tool::detail::MaskFilter<boost::unchecked_vector_property_map<unsigned char, boost::typed_identity_property_map<unsigned long> > > > >) __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::adj_edge_index_property_map<unsigned long> > > {lvalue}, graph_tool::PythonEdge<boost::filt_graph<boost::reversed_graph<boost::adj_list<unsigned long>, boost::adj_list<unsigned long> const&>, graph_tool::detail::MaskFilter<boost::unchecked_vector_property_map<unsigned char, boost::adj_edge_index_property_map<unsigned long> > >, graph_tool::detail::MaskFilter<boost::unchecked_vector_property_map<unsigned char, boost::typed_identity_property_map<unsigned long> > > > >) __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::adj_edge_index_property_map<unsigned long> > > {lvalue}, graph_tool::PythonEdge<boost::filt_graph<boost::adj_list<unsigned long>, graph_tool::detail::MaskFilter<boost::unchecked_vector_property_map<unsigned char, boost::adj_edge_index_property_map<unsigned long> > >, graph_tool::detail::MaskFilter<boost::unchecked_vector_property_map<unsigned char, boost::typed_identity_property_map<unsigned long> > > > >) __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::adj_edge_index_property_map<unsigned long> > > {lvalue}, graph_tool::PythonEdge<boost::undirected_adaptor<boost::adj_list<unsigned long> > >) __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::adj_edge_index_property_map<unsigned long> > > {lvalue}, graph_tool::PythonEdge<boost::reversed_graph<boost::adj_list<unsigned long>, boost::adj_list<unsigned long> const&> >) __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::adj_edge_index_property_map<unsigned long> > > {lvalue}, graph_tool::PythonEdge<boost::adj_list<unsigned long> >)
Am 25.08.21 um 05:19 schrieb ag@alan.gold:
# print the edge names for e in G.iter_edges():
... print(e) ... print(G.ep.name[e])
This should have been either:
for e in G.edges(): print(G.ep.name[e])
or
for s, t, n in G.iter_edges([G.ep.name]): print((s, t)) print(n)
Please read carefully the documentation to understand the difference between G.iter_edges() and G.edges().