Am 25.09.18 um 00:51 schrieb Ozgun Altunkaya:
> Hi,
>
> Thanks for the reply. I've got two more questions:
>
> edges = g.edge(1, 536)
> for e in edges:
> print(e)
>
> returns None because there's no such edge. However, when I run
>
> gt.shortest_distance(g, 1, 536)
>
> it returns 2, but there shouldn't exist a path with length 2 between those
> points, am I wrong about this? What am I missing?
The existence of an edge between two nodes means that they are at a distance
one from one another. The absence of an edge means the distance must be 2 or
larger. A distance of 2 just means they share a neighbor.
> Also, slightly related, I added those points with
> g.add_edge_list(my_edge_list), which is a list of integer couples between 1
> and 18000. Is there a way to run shortest_path just by using those numbers,
> without indexes?
>
> Like, gt.shortest_path(g, 1, 536)
>
> The above returns
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File
> "/opt/anaconda3/lib/python3.6/site-packages/graph_tool/topology/__init__.py",
> line
> 1882, in shortest_path
> for e in v.in_edges() if g.is_directed() else v.out_edges():
> AttributeError: 'int' object has no attribute 'in_edges'
The function expects vertex descriptors:
shortest_path(g, g.vertex(1), g.vertex(536))
I'll fix it so that it accept indices for convenience.
Best,
Tiago
_______________________________________________
graph-tool mailing list
[email protected]
https://lists.skewed.de/mailman/listinfo/graph-tool