Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ import matplotlib.colors as mpl
|
|
12 |
|
13 |
# Sidebar for selecting an option
|
14 |
sidebar_option = st.sidebar.radio("Select an option",
|
15 |
-
["
|
16 |
"Basic: Read and write graphs", "Basic: Simple graph",
|
17 |
"Basic: Simple graph Directed", "Drawing: Custom Node Position",
|
18 |
"Drawing: Cluster Layout", "Drawing: Degree Analysis",
|
@@ -25,6 +25,48 @@ sidebar_option = st.sidebar.radio("Select an option",
|
|
25 |
"Graph: DAG - Topological Layout", "Graph: Erdos Renyi", "Graph: Karate Club", "Graph: Minimum Spanning Tree",
|
26 |
"Graph: Triads", "Algorithms: Cycle Detection", "Algorithms: Greedy Coloring"])
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
def plot_greedy_coloring(graph):
|
29 |
# Apply greedy coloring
|
30 |
graph_coloring = nx.greedy_color(graph)
|
|
|
12 |
|
13 |
# Sidebar for selecting an option
|
14 |
sidebar_option = st.sidebar.radio("Select an option",
|
15 |
+
["Introductory Tutorial", "Basic: Properties",
|
16 |
"Basic: Read and write graphs", "Basic: Simple graph",
|
17 |
"Basic: Simple graph Directed", "Drawing: Custom Node Position",
|
18 |
"Drawing: Cluster Layout", "Drawing: Degree Analysis",
|
|
|
25 |
"Graph: DAG - Topological Layout", "Graph: Erdos Renyi", "Graph: Karate Club", "Graph: Minimum Spanning Tree",
|
26 |
"Graph: Triads", "Algorithms: Cycle Detection", "Algorithms: Greedy Coloring"])
|
27 |
|
28 |
+
# Display content when "Select an option" is chosen
|
29 |
+
if sidebar_option == "Introductory Tutorial":
|
30 |
+
st.title("Graph Visualization and Analysis Options")
|
31 |
+
|
32 |
+
# Add content descriptions
|
33 |
+
descriptions = [
|
34 |
+
("Basic: Properties", "Explore fundamental properties of graphs, such as node count, edge count, and degree distribution."),
|
35 |
+
("Basic: Read and Write Graphs", "Load graphs from files or save current graphs for later use."),
|
36 |
+
("Basic: Simple Graph", "Generate undirected graphs for basic visualization."),
|
37 |
+
("Basic: Simple Graph Directed", "Create directed graphs to analyze workflows or dependencies."),
|
38 |
+
("Drawing: Custom Node Position", "Manually set node positions for custom layouts."),
|
39 |
+
("Drawing: Cluster Layout", "Visualize clusters to identify tightly connected groups."),
|
40 |
+
("Drawing: Degree Analysis", "Highlight node connections and identify hubs or influencers."),
|
41 |
+
("Drawing: Ego Graph", "Focus on a single node and its immediate connections."),
|
42 |
+
("Drawing: Eigenvalues", "Analyze graph structure using Laplacian eigenvalues."),
|
43 |
+
("Drawing: House With Colors", "Display a simple 'house graph' with colored nodes and edges."),
|
44 |
+
("Drawing: Labels and Colors", "Customize graph appearance with labels and colors."),
|
45 |
+
("Drawing: Multipartite Layout", "Visualize graphs with nodes divided into distinct layers."),
|
46 |
+
("Drawing: Node Colormap", "Apply gradient colors based on node properties."),
|
47 |
+
("Drawing: Rainbow Coloring", "Differentiate edges with colorful patterns."),
|
48 |
+
("Drawing: Random Geometric Graph", "Generate graphs based on spatial proximity."),
|
49 |
+
("Drawing: Self-loops", "Visualize and highlight self-loops in graphs."),
|
50 |
+
("Drawing: Simple Path", "Display linear connections or sequences."),
|
51 |
+
("Drawing: Spectral Embedding", "Visualize nodes in reduced-dimensional space."),
|
52 |
+
("Drawing: Traveling Salesman Problem", "Visualize optimized paths for visiting all nodes."),
|
53 |
+
("Drawing: Weighted Graph", "Show graphs with weighted edges."),
|
54 |
+
("3D Drawing: Animations of 3D Rotation", "Create rotating 3D graph visualizations."),
|
55 |
+
("3D Drawing: Basic Matplotlib", "Generate basic 3D graph plots."),
|
56 |
+
("Graph: DAG - Topological Layout", "Analyze directed acyclic graphs in topological order."),
|
57 |
+
("Graph: Erdos Renyi", "Generate random graphs with probabilistic connections."),
|
58 |
+
("Graph: Karate Club", "Visualize the classic 'Karate Club' benchmark graph."),
|
59 |
+
("Graph: Minimum Spanning Tree", "Find and display a graph's minimum spanning tree."),
|
60 |
+
("Graph: Triads", "Analyze three-node structures for relationships."),
|
61 |
+
("Algorithms: Cycle Detection", "Detect and highlight cycles in a graph."),
|
62 |
+
("Algorithms: Greedy Coloring", "Color nodes to prevent adjacent nodes from sharing colors.")
|
63 |
+
]
|
64 |
+
|
65 |
+
for title, desc in descriptions:
|
66 |
+
st.subheader(f"### {title}")
|
67 |
+
st.write(desc)
|
68 |
+
st.write("---")
|
69 |
+
|
70 |
def plot_greedy_coloring(graph):
|
71 |
# Apply greedy coloring
|
72 |
graph_coloring = nx.greedy_color(graph)
|