Fetch all the edges between given two vertices
Dear all, I am analyzing a multigraph and I would like to fetch all the edges between given two vertices during runtime. I haven't been able to figure out an easy way to do this. For now, there are two possible ways: 1. Iterate over all the edges and catch the ones which connect vertices u and v 2. Go through all the neighbours of u and find out all the occurrences of v Both these operations, especially the first one, is expensive. Also, `g.edge(u,v)` seems to return only one edge without any information about which one it is. How can I solve this problem? Best regards, SMS -- Snehal M. Shekatkar https://inferred.in PGP key -> https://inferred.in/snehal_pub_key.txt
Am 09.03.22 um 12:50 schrieb Snehal Shekatkar:
Both these operations, especially the first one, is expensive. Also, `g.edge(u,v)` seems to return only one edge without any information about which one it is. How can I solve this problem?
Just call: g.edge(u, v, all_edges=True) -- Tiago de Paula Peixoto <tiago@skewed.de>
Wow! Didn't know this. Thanks so much for the quick reply. On 09/03/22 18:06, Tiago de Paula Peixoto wrote:
Am 09.03.22 um 12:50 schrieb Snehal Shekatkar:
Both these operations, especially the first one, is expensive. Also, `g.edge(u,v)` seems to return only one edge without any information about which one it is. How can I solve this problem?
Just call: g.edge(u, v, all_edges=True)
-- Snehal M. Shekatkar https://inferred.in PGP key -> https://inferred.in/snehal_pub_key.txt
participants (2)
-
Snehal Shekatkar -
Tiago de Paula Peixoto