-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_diff_graphs.py
More file actions
62 lines (51 loc) · 1.1 KB
/
plot_diff_graphs.py
File metadata and controls
62 lines (51 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#Plotting Different Types of Graphs
import networkx as nx
import matplotlib.pyplot as plt
options_1 = {
'with_labels': False,
'node_color': 'black',
'node_size': 50,
'width': 1,
}
options_2 = {
'with_labels': False,
'node_color': 'grey',
'node_size': 10,
'linewidths': 0,
'width': 0.1,
}
options_3 = {
'with_labels': False,
'node_color': 'grey',
'node_size': 10,
'linewidths': 0,
'width': 0.1,
'alpha': 0.3
}
# Drawing Complete Graph
G=nx.complete_graph(6)
plt.figure()
nx.draw_circular(G)
plt.savefig("complete_graph.png")
# Cycle Graph
G=nx.cycle_graph(10)
plt.figure()
nx.draw_circular(G)
plt.savefig("cycle_graph.png")
# lollipop Graph
G = nx.lollipop_graph(5, 2)
plt.figure()
nx.draw_circular(G)
plt.savefig("lollipop.png")
# petersen_graph
G= nx.petersen_graph()
plt.figure()
nx.draw_circular(G)
plt.savefig("Peterson_graph.png")
# barabasi_albert_graph
G = nx.barabasi_albert_graph(100, 3)
nx.draw_circular(G, **options_2)
plt.savefig("barabasi.png")
G = nx.complete_bipartite_graph(25,26)
nx.draw_shell(G, nlist=[range(0,25), range(25,51)], **options_3)
plt.savefig("complete_bipartite.png")