Python Dato Graphlab检查边缘是否存在

Python Dato Graphlab检查边缘是否存在,python,networkx,graphlab,Python,Networkx,Graphlab,我刚刚安装了Graphlab,正在尝试将NetworkX代码转换为Graphlab。在Graphlab文档中,我很难找到与NetworkX相当的G.has_edge()。如果不存在类似的函数,如何检查图形中是否已经存在Graphlab边?可以使用SGraph.get_edges方法检查特定边是否存在。在下面的示例中,我创建了一个“链”图,其中具有连续整数的顶点由一条边连接 >>> import graphlab >>> g = graphlab.SGraph(

我刚刚安装了Graphlab,正在尝试将NetworkX代码转换为Graphlab。在Graphlab文档中,我很难找到与NetworkX相当的
G.has_edge()
。如果不存在类似的函数,如何检查图形中是否已经存在Graphlab边?

可以使用
SGraph.get_edges
方法检查特定边是否存在。在下面的示例中,我创建了一个“链”图,其中具有连续整数的顶点由一条边连接

>>> import graphlab
>>> g = graphlab.SGraph().add_edges(
        [graphlab.Edge(i, i+1) for i in range(4)])

# Edge does exist.
>>> test1 = g.get_edges(src_ids=[0], dst_ids=[1])
>>> test1.num_rows()
1

# Edge does *not* exist.
>>> test2 = g.get_edges(src_ids=[0], dst_ids=[2])
>>> test2.num_rows()
0
这里是指向
get\u edges
的API文档的链接: