Пример #1
0
def init():

    ui.clearScreen()
    print(ui.blue("-------------application start-------------"))

    l = inittializeControllers()

    #checkControllerSwitches();

    #network.createTopology()

    ui.pc("...Getting Topology Info...")

    network.createTopology()
    #network.buildGraphByControllers(controllers)
    network.buildGraph()

    #network.drawNetwork()

    #network.applyLayerTwoLinks()

    #paths = network.getShortestPathFor("3.6", "2.1")

    paths = network.getShortestPathFor("2.1", "2.2")
    eps = eligiblePaths(paths)
    ui.drawPaths(eps)
Пример #2
0
def main():
    readinData = pd.read_excel("Data/new_network_v2.xls")  # 修改读入的数据路径
    sourceList = selectSource(readinData)  # 修改目标人群
    levels = 4  # 修改运行的等级
    output = 'results/new_network_results.csv'  # 修改输出的结果路径
    output2 = 'results/new_circle_results.csv'  # 修改输出的结果路径
    grep = '房产'  # 修改需要的关键词信息
    option = [2,1] #根据列名从大到小排序, 其中 1为输出个数 2为被连接个数 3为间接中心性 4为紧密中心性
    network.buildGraph(readinData, sourceList, levels, output, grep)
    gcircle.buildCircle(readinData, sourceList, output2, option)
Пример #3
0
def networkMap():
    global second_layer_flag
    network.reset()
    network.createTopology()
    network.buildGraph()
    if second_layer_flag:
        network.applyLayerTwoLinks()
    return jsonify([{
        "nodes": network.getHosts(),
        "switches": network.getSwitches(),
        "edges": network.getEdges()
    }])
Пример #4
0
    def button1Clicked(self, sender):
        #print(self.m_comboBox1.GetValue())
        ui.clearScreen()
        print(ui.blue("-------------application start-------------"))

        l = inittializeControllers()
        #checkControllerSwitches()

        ui.pc("...Getting Topology Info...")
        network.createTopology()
        network.buildGraph()

        paths = network.getShortestPathFor(self.m_comboBox2.GetValue(),
                                           self.m_comboBox1.GetValue())
        eps = eligiblePaths(paths)
        ui.drawPaths(eps)
        distributePathForPush(eps)
Пример #5
0
def shortestPath():
    data = request.data.replace("{", "").replace("}", "").split(",")
    src = data[0].replace("'", "").replace('"', "").split(":")[1]
    des = data[1].replace("'", "").replace('"', "").split(":")[1]
    print(src)
    print(des)
    network.createTopology()
    network.buildGraph()

    if second_layer_flag:
        network.applyLayerTwoLinks()

    paths = []
    for path in network.getShortestPathFor(src, des):
        print(path)
        paths.append({"path": path})
    return jsonify([{"paths": paths}])
Пример #6
0
 def button2Clicked(self, sender):
     l = inittializeControllers()
     network.createTopology()
     network.buildGraph()
     network.drawNetwork()