scion_topology_graphviz.py 文件源码

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

项目:scion-web 作者: netsec-ethz 项目源码 文件源码
def draw_SCION_topology(topology_dict, n_labels, e_labels):
    """
    Draws the Scion topology from a topology dictionary
    returned by parse_gen_folder.
    :param dictionary topology_dict: dictionary returned by parse_gen_folder,
            boolean ip_addresses: indicates if node labels are drawn,
            boolean edge_labels: indicates if edge labels are drawn
    :return Dot graph: graph of the SCION topology
    """
    isd_graphs = {}
    dot = Graph(name='topology',filename='topology.gv',comment='SCION-net')
    ISDs = topology_dict["ISD"]
    # draw each ISD graph
    for ISD in ISDs:
        isd_graphs[ISD] = draw_isd_graph(ISD, ISDs[ISD]["AS"], e_labels, n_labels)
    # put all isd graphs into the same graph
    for ISD in isd_graphs:
        dot.subgraph(isd_graphs[ISD])
    # add edges between ISDs
    dot = draw_inter_ISD_edges(dot, ISDs, e_labels)
    return dot
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号