Ejemplo n.º 1
0
def main():
    topo = Topology()
    topo.construct_single_node(Node, 0)
    topo.start()

    while True:
        pass
Ejemplo n.º 2
0
def main():
    topo = Topology()

    topo.construct_sender_receiver(Sender, Receiver, P2PFIFOFairLossChannel)
    nx.draw(topo.G, with_labels=True, font_weight='bold')
    plt.draw()
    topo.channels["0-1"].setPacketLossProbability(0.1)
    topo.channels["0-1"].setAverageNumberOfDuplicates(0)

    # topo.computeForwardingTable()

    topo.start()
    plt.show()
    while (True):
        pass  #plt.show() handles this
Ejemplo n.º 3
0
def main():
    # G = nx.Graph()
    # G.add_nodes_from([1, 2])
    # G.add_edges_from([(1, 2)])
    # nx.draw(G, with_labels=True, font_weight='bold')
    # plt.draw()
    G = nx.random_geometric_graph(19, 0.5)
    nx.draw(G, with_labels=True, font_weight='bold')
    plt.draw()

    topo = Topology()
    topo.construct_from_graph(G, AdHocNode, P2PFIFOPerfectChannel)
    topo.start()

    plt.show()  # while (True): pass
    while (True):
        pass
Ejemplo n.º 4
0
def main():
  # G = nx.Graph()
  # G.add_nodes_from([1, 2])
  # G.add_edges_from([(1, 2)])
  # nx.draw(G, with_labels=True, font_weight='bold')
  # plt.draw()
  G = nx.random_geometric_graph(19, 0.5)
  topo = Topology()
  topo.construct_from_graph(G, AdHocNode, P2PFIFOFairLossChannel)
  for ch in topo.channels:
    topo.channels[ch].setPacketLossProbability(random.random())
    topo.channels[ch].setAverageNumberOfDuplicates(0)

  ComponentRegistry().print_components()

  topo.start()
  topo.plot()
  plt.show()  # while (True): pass

  print(topo.nodecolors)
Ejemplo n.º 5
0
def main():
    # G: nx.Graph= nx.random_geometric_graph(5, 0.5, seed=3)
    # G: nx.Graph = nx.random_geometric_graph(14, 0.4, seed=1)
    # G: nx.Graph = nx.random_geometric_graph(15, 0.4, seed=3)
    # G: nx.Graph = nx.random_geometric_graph(20, 0.4, seed=3)
    # G: nx.Graph = nx.random_geometric_graph(10, 0.5, seed=3)
    # G: nx.Graph = nx.random_geometric_graph(30, 0.35, seed=3)
    # G: nx.Graph = nx.random_geometric_graph(6, 0.6, seed=3)
    G: nx.Graph = nx.random_geometric_graph(40, 0.25)
    for (u, v) in G.edges:
        G.get_edge_data(u, v)['weight'] = random.randint(1, len(G.nodes))   # u + v + u * v # TODO

    topo = Topology()
    topo.construct_from_graph(G, Node, NodeChannel)
    topo.start()

    drawGraph(G, isTopologyGraph=True)

    while True:
        userInput = input("\nUser Command:\n")
        processUserCommand(userInput, topo)