Skip to content

Commit

Permalink
CGSR test is added
Browse files Browse the repository at this point in the history
  • Loading branch information
cengwins committed Jan 14, 2022
1 parent 27bb6fb commit ed9ca69
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Routing/testCGSR.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import os
import sys
import random

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

import networkx as nx
import matplotlib.pyplot as plt

from ahc.Channels.Channels import P2PFIFOPerfectChannel,Channel
from ahc.Ahc import Topology
from ahc.Ahc import ComponentRegistry
from ahc.Routing.CGSR.CGSRNode import CGSRNode

registry = ComponentRegistry()

def main():

G = nx.random_geometric_graph(5, 0.5)
topo = Topology()
topo.construct_from_graph(G, CGSRNode, P2PFIFOPerfectChannel)
nx.draw(G, with_labels=True, font_weight='bold')
plt.draw()
# for ch in topo.channels:
# topo.channels[ch].setPacketLossProbability(random.random())
# topo.channels[ch].setAverageNumberOfDuplicates(0)

ComponentRegistry().print_components()

topo.start()
# while (True): pass
topo.plot()
plt.show()
print(topo.nodecolors)
for component in registry.components:
print(component)


if __name__ == "__main__":
main()

0 comments on commit ed9ca69

Please sign in to comment.