Skip to content
This repository was archived by the owner on Sep 19, 2023. It is now read-only.

Commit cb9b8f1

Browse files
committed
update course material
1 parent 8f40b92 commit cb9b8f1

File tree

180 files changed

+6355783
-20
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+6355783
-20
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
**/out
22
**/.idea
33
**/*.class
4-
others/
4+
others/
5+
.DS_Store

BattleShip/grade.png

337 KB
Loading

ConwayGameOfLife/grade.png

334 KB
Loading

ConwayGameOfLifeWithGUI/grade.png

247 KB
Loading

EpidemicSimulation/grade.png

303 KB
Loading

FarmerMarket/grade.pdf

266 KB
Binary file not shown.

Rainbow.png

178 KB
Loading

TeamProject/grade.pdf

532 KB
Binary file not shown.
18.8 KB
Binary file not shown.

course_material/BAGraph.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import networkx as nx
2+
import csv
3+
4+
if __name__ == "__main__":
5+
print('This program will generate a Barabási–Albert preferential attachment graph '
6+
'and save it in the adjacency list format.')
7+
n, m = [int(val) for val in input("Enter the values for n and m: ").split()]
8+
output_file_name = input("Enter the name for the output file: ")
9+
# G = nx.complete_graph(10)
10+
G = nx.barabasi_albert_graph(n, m)
11+
print(str(len(G.nodes())) + ' nodes and ' + str(len(G.edges())) + " edges")
12+
G1 = nx.relabel_nodes(G, {label: '"' + str(label) + '"' for label in G.nodes()})
13+
nx.write_edgelist(G1, output_file_name, delimiter=',', data=False)

0 commit comments

Comments
 (0)