Skip to content

Commit

Permalink
append some examples and images
Browse files Browse the repository at this point in the history
  • Loading branch information
bda82 committed Oct 26, 2023
1 parent 012b0f1 commit 559b81a
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 0 deletions.
36 changes: 36 additions & 0 deletions stable_gnn/visualization/examples/draw_random_graph.py
Original file line number Diff line number Diff line change
@@ -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...")
35 changes: 35 additions & 0 deletions stable_gnn/visualization/examples/draw_random_hypergraph.py
Original file line number Diff line number Diff line change
@@ -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()
1 change: 1 addition & 0 deletions stable_gnn/visualization/examples/draw_simple_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 559b81a

Please sign in to comment.