Skip to content

Commit

Permalink
LDR test is added
Browse files Browse the repository at this point in the history
  • Loading branch information
cengwins committed Jan 14, 2022
1 parent 7784351 commit feb7c3c
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Routing/testLDR.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import os
import sys
import time
import random
from enum import Enum

sys.path.insert(0, os.getcwd())

import networkx as nx
import matplotlib.pyplot as plt

from ahc.Ahc import ComponentModel, Event, ConnectorTypes, Topology
from ahc.Ahc import ComponentRegistry
from ahc.Ahc import GenericMessagePayload, GenericMessageHeader, GenericMessage, EventTypes
from ahc.Channels.Channels import P2PFIFOPerfectChannel
from ahc.Routing.LDR.RoutingLdrComponent import LDRnode

registry = ComponentRegistry()

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(10, 0.5)
nx.draw(G, with_labels=True, font_weight='bold')
plt.draw()

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

plt.show() # while (True): pass

if __name__ == "__main__":
main()

0 comments on commit feb7c3c

Please sign in to comment.