Digraph.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:mrt_tools 作者: KIT-MRT 项目源码 文件源码
def add_edge(self, a, b):
        """checks if the edge already exists, if not, creates one from a2b
        :param a: Node a
        :param b: Node b
        """
        if a is None or b is None:
            return
        for edge_obj in self.graph.get_edge_list():
            if a.get_name() in edge_obj.obj_dict["points"] and \
                            b.get_name() in edge_obj.obj_dict["points"]:
                break
        else:
            # such an edge doesn't exist. create it
            self.graph.add_edge(pydot.Edge(a, b))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号