shukdevdatta123 commited on
Commit
57e492d
·
verified ·
1 Parent(s): 2b5132f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -189,12 +189,20 @@ def display_simple_directed_graph():
189
 
190
  def display_custom_node_position():
191
  st.title("Drawing: Custom Node Position")
 
 
 
 
 
 
192
  pos = {"A": (1, 2), "B": (2, 3), "C": (3, 1)}
193
- G = nx.Graph(pos)
194
- nx.draw(G, pos=pos, with_labels=True)
 
195
  st.pyplot(plt)
196
 
197
 
 
198
  # Call the appropriate function based on sidebar selection
199
  if sidebar_option == "Basic: Properties":
200
  display_basic_properties()
 
189
 
190
  def display_custom_node_position():
191
  st.title("Drawing: Custom Node Position")
192
+
193
+ # Create a graph with a few nodes and edges
194
+ G = nx.Graph()
195
+ G.add_edges_from([("A", "B"), ("B", "C"), ("C", "A")])
196
+
197
+ # Define custom positions for the nodes
198
  pos = {"A": (1, 2), "B": (2, 3), "C": (3, 1)}
199
+
200
+ # Draw the graph with the custom positions
201
+ nx.draw(G, pos=pos, with_labels=True, node_color='lightblue', node_size=500, font_size=10, font_weight='bold')
202
  st.pyplot(plt)
203
 
204
 
205
+
206
  # Call the appropriate function based on sidebar selection
207
  if sidebar_option == "Basic: Properties":
208
  display_basic_properties()