diff --git a/stable_gnn/visualization/examples/draw_random_graph.py b/stable_gnn/visualization/examples/draw_random_graph.py new file mode 100644 index 0000000..54ca6c1 --- /dev/null +++ b/stable_gnn/visualization/examples/draw_random_graph.py @@ -0,0 +1,36 @@ +from torch import tensor + +from stable_gnn.visualization.contracts.graph_contract import GraphContract +from stable_gnn.visualization.contracts.graph_visualization_contract import GraphVisualizationContract +from stable_gnn.visualization.graph_visualization import GraphVisualizer + +from stable_gnn.visualization.data_generation.graph_generator import GraphGenerator + +VERTEX_NUM = 1000 +EDGE_NUM = 1200 + + +generator = GraphGenerator(vertex_num=VERTEX_NUM, edge_num=EDGE_NUM) +generated_data = generator() + +generated_edge_weights = [1.0 for _ in range(len(generated_data))] + + +graph_contract: GraphContract = GraphContract( + vertex_num=VERTEX_NUM, + edge_list=( # noqa + generated_data, + generated_edge_weights + ), + edge_num=EDGE_NUM, + edge_weights=tensor( # noqa + generated_edge_weights * 2 + ) +) +vis_contract: GraphVisualizationContract = GraphVisualizationContract(graph=graph_contract) + +vis: GraphVisualizer = GraphVisualizer(vis_contract) +fig = vis.draw() +fig.show() + +print("Complete...") diff --git a/stable_gnn/visualization/examples/draw_random_hypergraph.py b/stable_gnn/visualization/examples/draw_random_hypergraph.py new file mode 100644 index 0000000..e1985f3 --- /dev/null +++ b/stable_gnn/visualization/examples/draw_random_hypergraph.py @@ -0,0 +1,35 @@ +from torch import tensor + +from stable_gnn.visualization.config.parameters.generator_methods import GeneratorMethods +from stable_gnn.visualization.contracts.hypergraph_contract import HypergraphContract +from stable_gnn.visualization.contracts.hypergraph_visualization_contract import HypergraphVisualizationContract +from stable_gnn.visualization.hypergraph_visualization import HypergraphVisualizer + +from stable_gnn.visualization.data_generation.hypergraph_generator import HypergraphGenerator + + +VERTEX_NUM = 500 +EDGE_NUM = 300 + +generator = HypergraphGenerator(vertex_num=VERTEX_NUM, edge_num=EDGE_NUM, generation_method=GeneratorMethods.uniform) +generated_data = generator() + +generated_edge_weights = [1.0 for _ in range(len(generated_data))] + + +graph_contract: HypergraphContract = HypergraphContract( + vertex_num=VERTEX_NUM, + edge_list=( # noqa + generated_data, + generated_edge_weights + ), + edge_num=EDGE_NUM, + edge_weights=tensor( # noqa + generated_edge_weights * 2 + ), +) +vis_contract: HypergraphVisualizationContract = HypergraphVisualizationContract(graph=graph_contract) + +vis: HypergraphVisualizer = HypergraphVisualizer(vis_contract) +fig = vis.draw() +fig.show() diff --git a/stable_gnn/visualization/examples/draw_simple_graph.py b/stable_gnn/visualization/examples/draw_simple_graph.py index a5f8202..cd0ed61 100644 --- a/stable_gnn/visualization/examples/draw_simple_graph.py +++ b/stable_gnn/visualization/examples/draw_simple_graph.py @@ -4,6 +4,7 @@ from stable_gnn.visualization.contracts.graph_visualization_contract import GraphVisualizationContract from stable_gnn.visualization.graph_visualization import GraphVisualizer + graph_contract: GraphContract = GraphContract( vertex_num=10, edge_list=( # noqa diff --git a/stable_gnn/visualization/examples/images/graph_1000_1200.png b/stable_gnn/visualization/examples/images/graph_1000_1200.png new file mode 100644 index 0000000..cd5fa4f Binary files /dev/null and b/stable_gnn/visualization/examples/images/graph_1000_1200.png differ diff --git a/stable_gnn/visualization/examples/images/graph_100_120.png b/stable_gnn/visualization/examples/images/graph_100_120.png new file mode 100644 index 0000000..aecd4c4 Binary files /dev/null and b/stable_gnn/visualization/examples/images/graph_100_120.png differ diff --git a/stable_gnn/visualization/examples/images/graph_10_12.png b/stable_gnn/visualization/examples/images/graph_10_12.png new file mode 100644 index 0000000..76ae02f Binary files /dev/null and b/stable_gnn/visualization/examples/images/graph_10_12.png differ diff --git a/stable_gnn/visualization/examples/images/hypergraph_100_50.png b/stable_gnn/visualization/examples/images/hypergraph_100_50.png new file mode 100644 index 0000000..f37bb9a Binary files /dev/null and b/stable_gnn/visualization/examples/images/hypergraph_100_50.png differ diff --git a/stable_gnn/visualization/examples/images/hypergraph_10_15.png b/stable_gnn/visualization/examples/images/hypergraph_10_15.png new file mode 100644 index 0000000..5446d8b Binary files /dev/null and b/stable_gnn/visualization/examples/images/hypergraph_10_15.png differ diff --git a/stable_gnn/visualization/examples/images/hypergraph_500_300.png b/stable_gnn/visualization/examples/images/hypergraph_500_300.png new file mode 100644 index 0000000..3f82b4a Binary files /dev/null and b/stable_gnn/visualization/examples/images/hypergraph_500_300.png differ