forked from cengwins/ahc_tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cengwins
committed
Jan 14, 2022
1 parent
55c63df
commit 7784351
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |