1
가장자리 모으기를 수행하고 싶지만 문제가 있습니다. 가장자리 igraph 반환 에로 존재하지 않을 경우,정점 ID로 가장자리 무게 얻기
from igraph import *
g = Nexus.get("karate")
weight = g.es[g.get_eid(vertex, neighbor)]['weight']
그러나 :
첫째,이 시도. 예를 들어, 그게 단지 -1을 반환하고 싶습니다.
둘째로 IGRAPH에서 연산보다 연산이 더 효율적입니까?
get_eid(v1, v2, directed=True, error=True)
@param error: if C{True}, an exception will be raised when the
given edge does not exist. If C{False}, -1 will be returned in
that case.
따라서, 귀하의 경우 의미 :
weight = g.es[g.get_eid(vertex, neighbor, error=False)]['weight']