Hello Tamás, thanks a lot for your quick reply. It turned out it really was stupidity on my side: I modified the graph during iteration, which of course yielded unexpected results. Now it works as expected. Sorry for the noise.
Regards Frederik Am Mittwoch, den 17.07.2013, 00:31 +0200 schrieb Tamás Nepusz: > Hello, > > Your code seems to be fine but I cannot reproduce the issue on my machine -- > neither with Python 2.7 nor with Python 3.3.1. Can you send me a > self-contained example that constructs the graph from scratch and reproduces > the problem on your machine? Also, it would be helpful to know as many > details about your platform as possible (i.e. operating system, whether this > is a 32-bit or 64-bit machine, whether you have compiled igraph yourself or > used an official pre-compiled package, and anything else that you may deem > relevant). > > The output from my igraph session is as follows: > > >>> import igraph > >>> g=igraph.Graph([(0,1),(1,2),(2,3)], directed=False) > >>> from itertools import combinations > >>> for s,t in combinations(g.vs, 2): > ... g.get_shortest_paths(s,t)[0] > ... > [0, 1] > [0, 1, 2] > [0, 1, 2, 3] > [1, 2] > [1, 2, 3] > [2, 3] > > All the best, > Tamas > > On 16 Jul 2013, at 21:44, Frederik Elwert <[email protected]> wrote: > > > Hello, > > > > I am new to igraph, so I might be getting something wrong. I am using > > igraph 0.6.5 with python3. > > > > I have a graph and want to calculate the shortest paths between all > > pairs of nodes: > > > >>>> graph.is_directed() > > False > >>>> graph.get_edgelist() > > [(0, 1), (1, 2), (2, 3)] > >>>> for source, target in combinations(graph.vs, 2): > > ... graph.get_shortest_paths(source, target)[0] > > [0, 1] > > [0, 1, 2] > > [0, 2, 3] > > [1, 2] > > [1, 0, 3] > > [2, 3] > > > > What bothers me: The paths [0, 2, 3] and [1, 0, 3] seem to be invalid. > > There should be no edge 0 -- 2 or 0 -- 3. > > > > Any hints? > > > > Regards, > > Frederik > > > > > > _______________________________________________ > > igraph-help mailing list > > [email protected] > > https://lists.nongnu.org/mailman/listinfo/igraph-help > > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
