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
7784351
commit feb7c3c
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 @@ | ||
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() |