Skip to content

Commit

Permalink
Test GSR is added
Browse files Browse the repository at this point in the history
  • Loading branch information
cengwins committed Jan 14, 2022
1 parent 55c63df commit 7784351
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Routing/testGSR.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from ahc.Ahc import Topology
from ahc.Channels.Channels import P2PFIFOPerfectChannel
import networkx as nx
from ahc.Routing.GSR.GSRTestingNodeComponent import GSRTestingNode
from ahc.Routing.GSR.RoutingGSRComponent import RoutingGSRComponent


# undirected graph
def draw_random_graph(n):
k = True
g_random = None
while k:
k = False
g_random = nx.gnp_random_graph(n, 0.3)
if not nx.is_connected(g_random):
k = True
return g_random


# undirected graph
NODE_COUNT = 10

if __name__ == "__main__":
graph = draw_random_graph(NODE_COUNT) # nx.Graph()
print(graph.edges)
# graph.add_edges_from(edges)

node_list = graph.nodes

print(RoutingGSRComponent.__name__)

topology = Topology()
topology.construct_from_graph(graph, GSRTestingNode, P2PFIFOPerfectChannel)
topology.start()

while True:
pass

0 comments on commit 7784351

Please sign in to comment.