@@ -35,13 +35,13 @@ import requests
35
35
%matplotlib inline
36
36
```
37
37
38
- ### Greedy Colouring :
38
+ ### Greedy Coloring :
39
39
40
- The priority of colours /labels assigned is given by the strategies. Below is the list of strategies in networkx.
40
+ The priority of colors /labels assigned is given by the strategies. Below is the list of strategies in networkx.
41
41
You can also add your custom strategy.
42
42
43
43
``` {code-cell}
44
- # Load the stratagies for the greedy colouring present in the networkx library
44
+ # Load the stratagies for the greedy coloring present in the networkx library
45
45
strategies = nx.coloring.greedy_coloring.STRATEGIES
46
46
```
47
47
@@ -96,20 +96,20 @@ nx.draw(random_graph, with_labels=True)
96
96
97
97
+++
98
98
99
- ![ png] ( graph-colouring/graph_colouring_files /graph-colouring/graph_colouring_7_0 .png )
99
+ ![ png] ( graph-coloring/graph_coloring_files /graph-coloring/graph_coloring_7_0 .png )
100
100
101
101
102
102
103
103
``` {code-cell}
104
- # Get the greedy colouring for all the strategies
104
+ # Get the greedy coloring for all the strategies
105
105
colors = {
106
106
current_strategy: nx.greedy_color(random_graph, strategy=current_strategy)
107
107
for current_strategy in strategies
108
108
}
109
109
```
110
110
111
111
``` {code-cell}
112
- # Show the greedy colouring for selected strategy: DSATUR
112
+ # Show the greedy coloring for selected strategy: DSATUR
113
113
selected_strategy = "DSATUR"
114
114
115
115
# Get the position of the nodes
@@ -157,7 +157,7 @@ nx.draw_networkx_edges(random_graph, pos=pos)
157
157
158
158
159
159
160
- ![ png] ( graph-colouring/graph_colouring_files /graph-colouring/graph_colouring_9_1 .png )
160
+ ![ png] ( graph-coloring/graph_coloring_files /graph-coloring/graph_coloring_9_1 .png )
161
161
162
162
163
163
+++
@@ -231,7 +231,7 @@ ani = animation.FuncAnimation(
231
231
232
232
``` {code-cell}
233
233
# Save the animation as gif
234
- gif_file_path = r"greedy_colouring .gif"
234
+ gif_file_path = r"greedy_coloring .gif"
235
235
writergif = animation.PillowWriter(fps=1)
236
236
ani.save(gif_file_path, writer=writergif)
237
237
```
@@ -252,7 +252,7 @@ display_animation(gif_file_path)
252
252
253
253
+++
254
254
255
- ![ png] ( graph-colouring/graph_colouring_files /graph-colouring/graph_colouring_16_0 .png )
255
+ ![ png] ( graph-coloring/graph_coloring_files /graph-coloring/graph_coloring_16_0 .png )
256
256
257
257
258
258
+++
@@ -291,7 +291,7 @@ state_data = gpd.read_file(indian_map_url)
291
291
292
292
+++
293
293
294
- ![ png] ( graph-colouring/graph_colouring_files /graph-colouring/graph_colouring_21_0 .png )
294
+ ![ png] ( graph-coloring/graph_coloring_files /graph-coloring/graph_coloring_21_0 .png )
295
295
296
296
297
297
@@ -326,7 +326,7 @@ nx.draw(indian_states, with_labels=True)
326
326
327
327
+++
328
328
329
- ![ png] ( graph-colouring/graph_colouring_files /graph-colouring/graph_colouring_26_0 .png )
329
+ ![ png] ( graph-coloring/graph_coloring_files /graph-coloring/graph_coloring_26_0 .png )
330
330
331
331
332
332
@@ -365,15 +365,15 @@ patch = nx.draw_networkx_edges(indian_states, pos=pos)
365
365
366
366
+++
367
367
368
- ![ png] ( graph-colouring/graph_colouring_files /graph-colouring/graph_colouring_29_0 .png )
368
+ ![ png] ( graph-coloring/graph_coloring_files /graph-coloring/graph_coloring_29_0 .png )
369
369
370
370
371
371
372
372
``` {code-cell}
373
373
state_data["color"] = state_data["ID_1"].map(india_state_colors[selected_strategy])
374
374
state_data["color"].fillna(
375
375
0, inplace=True
376
- ) # assigning default colour to states without any neighbours
376
+ ) # assigning default color to states without any neighbours
377
377
```
378
378
379
379
``` {code-cell}
@@ -404,4 +404,4 @@ folium.LayerControl().add_to(m) # use folium to add layer control
404
404
405
405
+++
406
406
407
- ![ png] ( graph-colouring/graph_colouring_files /graph-colouring/graph_colouring_32_0 .png )
407
+ ![ png] ( graph-coloring/graph_coloring_files /graph-coloring/graph_coloring_32_0 .png )
0 commit comments