On 04/03/2014 10:44 AM, Pietro Battiston wrote: > I think there is some problem with add_edge_list. > > The following code: > > --------------------------------------------------------- > > from scipy import array > from graph_tool import Graph > from graph_tool.draw import graph_draw > > def blocks_star(transpose=False): > g = Graph() > members = array([0,1,2]) > edges_list = array([[0,1,2], [2,0,1]]).transpose() > edges_list_2 = array([[0,2],[1,0],[2,1]]) > print edges_list > print edges_list_2 > print all(edges_list == edges_list_2) > if transpose: > g.add_edge_list(edges_list) > else: > g.add_edge_list(edges_list_2) > graph_draw(g) > > --------------------------------------------------------- > > gives me a different result if called with True or False as argument > (with True, the resulting graph is disconnected), while the edges lists > are clearly identical. I guess this has to do with the fact that > transposing, for numpy, is just a change of view, not a relocation of > elements... but I see your code is based on boost, which I have no > experience with. I am using package python-graph-tool 2.2.31-1 from your > Debian sid repositories.
This is a bug. The strides of the numpy array are not propagated properly to the C++ side of things. I have fixed this now in the git version. > By the way: why "add_edge_list" rather than "add_edges_list"? True, > "add_vertex" can add multiple vertices, but then there is "clear_edges". > Not really crucial issue, but... later it would be too late to raise it! The only grammatically correct variations I see are "add edge list" or "add list of edges". The phrase "add edges list" does not seem right. Best, Tiago -- Tiago de Paula Peixoto <[email protected]>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ graph-tool mailing list [email protected] http://lists.skewed.de/mailman/listinfo/graph-tool
