Exact diameter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Exact diameter

Kelly Trinh
Hi all,

Using python graph_tool library.  I see there is the pseudo_diameter method
but I was looking so something that can give me the exact diameter but
cannot seem to find.

Could anyone shine some light where this is (or why not included)?

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: Exact diameter

Tiago Peixoto
Administrator
Am 29.07.20 um 11:16 schrieb Kelly Trinh:
> Hi all,
>
> Using python graph_tool library.  I see there is the pseudo_diameter method
> but I was looking so something that can give me the exact diameter but
> cannot seem to find.
>
> Could anyone shine some light where this is (or why not included)?


You can get the diameter with a simple one-liner:

   max(shortest_distance(g, v).fa.max() for v in g.vertices())

But I suppose it makes sense to include a convenience function for it
(which could even run the main loop in parallel).

I'll include it in the next version. (If you want to help me not forget
it, please open an issue for it in the website.)

Best,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>


_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

signature.asc (849 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>