This course is an introduction to graph theory.
Below is a summary of what we did in class, plus any relevant
news and/or information.
# SAGE Tutorial for Math 3V03 # # Inputting a Graph via a list g = Graph({0:[1,2,3,4], 1:[2,5], 2:[5], 3:[4,5], 4:[5]}) # Inputting a Graph via built-in commands I h = graphs.HeawoodGraph() # Inputting a Graph via built-in commands II l = graphs.CompleteGraph(7) # The plot command plot(g) plot(h) plot(l) # The show command show(g) show(h) show(l) # how to save a graph plot(h).save('graphHeawood.pdf') # basic commands # list edges g.edges() h.edges() l.edges() # list vertices and degrees g.vertices() g.degree() g.degree(2) # checking k-regular g.is_regular() h.is_regular() # computing girth g.girth() h.girth() # chromatic number g.chromatic_number() h.chromatic_number() h.is_bipartite() # Sec 1.1 - Degree Sequences DS = DegreeSequences(7) [5,4,4,3,2,1,1] in DS m = graphs.DegreeSequence([5,4,4,3,2,1,1]) plot(m) [6,3,3,3,3,3,3] in DS plot(graphs.DegreeSequence([6,3,3,3,3,3,3])) # Sec 1.2 - Subgraphs gg =g.subgraph([0,1,2,5]) plot(gg) # Sec 1.3 - Trees k=g.spanning_trees() g.spanning_trees_count() plot(k[1]) # sample loop for i in range(10): plot(k[i]) # Sec 2.1 - Colouring g.chromatic_number() gg.chromatic_number() h.chromatic_number() # Sec 2.2 - Edge Colouring from sage.graphs.graph_coloring import edge_coloring edge_coloring(g) # Sec 2.3 - Hamiltonian Cycles h.hamiltonian_cycle() h.hamiltonian_cycle(algorithm='backtrack') # Sec 2.4 - Bridges g.bridges() f = graphs.FibonacciTree(5) plot(f) f.bridges() # Sec 3.1 - Eulerian circuits g.eulerian_circuit() h.eulerian_circuit() l.eulerian_circuit() |
A1 = Matrix(6,[0,1,1,1,1,0, 1,0,0,0,0,0, 1,0,0,0,0,0, 1,0,0,0,0,0, 1,0,0,0,0,1, 0,0,0,0,1,0]) print(A1) T = Graph(A1) plot(T) W1 = Matrix(6,[0,1,3,5,2,0, 1,0,0,0,0,0, 3,0,0,0,0,0, 5,0,0,0,0,0, 2,0,0,0,0,4, 0,0,0,0,4,0]) T1 = Graph(W1) plot(T1) L = T1.degree() print(L) print len(L) S = set(L) # get unique elements print(S) print len(S) len(L) == len(S) # A bad labelling W2 = Matrix(6,[0,1,5,4,2,0, 1,0,0,0,0,0, 5,0,0,0,0,0, 4,0,0,0,0,0, 2,0,0,0,0,3, 0,0,0,0,3,0]) print(W2) T2 = Graph(W2) show(T2) L = T2.degree() print(L) print len(L) # print out the degrees = sum of labels S = set(L) # get unique elements print(S) print len(S) # count the number of unique elemetns len(L) == len(S) # Will be false because two of the vertices have the same degree |
# Graphs and Adjaceny Matrices T = Graph({1:[2,3,4,5],5:[6]}) plot(T) W = T.adjacency_matrix() print(W) # A way to give a tree a labelling # replacing 1's in adjacency matrix with labels 1n count = 1 for i in range(0,5): for j in range(i+1,6): if W[i,j] <> 0: W[i,j] = count W[j,i] = count count = count+1 print(W) ## Here's what the above graph looks like TT=Graph(W) plot(TT) # # Combine with code from last class # to check if labelling gives anti-magic labelling L = TT.degree() print(L) print len(L) S = set(L) # get unique elements print(S) print len(S) len(L) == len(S) # Exercise W = Matrix(6,[0,1,0,1,0,0, 1,0,1,0,1,0, 0,1,0,0,0,1, 1,0,0,0,0,0, 0,1,0,0,0,0, 0,0,1,0,0,0]) T = Graph(W) plot(T) count = 1 for i in range(0,5): for j in range(i+1,6): if W[i,j] <> 0: W[i,j] = count W[j,i] = count count = count+1 print(W) TT = Graph(W) plot(TT) L = TT.degree() print(L) print len(L) S = set(L) # get unique elements print(S) print len(S) len(L) == len(S) # We can access lots of graphs via SAGE ListOfTrees = graphs.trees(6) for T in ListOfTrees: print T.adjacency_matrix() # combine all the pieces # to find many anti-magic labellings at once ListOfTrees = graphs.trees(6) for T in ListOfTrees: W= T.adjacency_matrix() T = Graph(W) plot(T) count = 1 for i in range(0,5): for j in range(i+1,6): if W[i,j] <> 0: W[i,j] = count W[j,i] = count count = count+1 print(W) TT = Graph(W) plot(TT) L = TT.degree() print(L) print len(L) S = set(L) # get unique elements print(S) print len(S) len(L) == len(S) if len(L) == len(S): print 'Found an anti-magic labelling :-) ' else: print 'Did not find anti-magic labelling :-( ' print # Variation -- put numbers in reverse order ListOfTrees = graphs.trees(6) for T in ListOfTrees: W= T.adjacency_matrix() T = Graph(W) plot(T) count = 5 for i in range(0,5): for j in range(i+1,6): if W[i,j] <> 0: W[i,j] = count W[j,i] = count count = count-1 print(W) TT = Graph(W) plot(TT) L = TT.degree() print(L) print len(L) S = set(L) # get unique elements print(S) print len(S) len(L) == len(S) if len(L) == len(S): print 'Found an anti-magic labelling :-) ' else: print 'Did not find anti-magic labelling :-( ' print |
Here are some websites that you may find helpful for learning more about graph theory (please send me your favourites).
Academic dishonesty is to knowingly act or fail to act in a way that
results or could result in unearned academic credit or advantage. This
behaviour can result in serious consequences, e.g. the grade of zero
on
an assignment, loss of credit with a notation on the transcript
(notation reads: Grade of F assigned for academic dishonesty),
and/or suspension or expulsion from the university.
It is your responsibility to understand what constitutes academic
dishonesty. For information on the various types of academic
dishonesty
please refer to the Academic Integrity Policy, located at:
http://www.mcmaster.ca/academicintegrity/
The following illustrates only three forms of academic dishonesty:
2. Policy regarding missed work.
If you have missed work, it is your responsibility to take action.
If you are absent from the university for
medical and non-medical (personal) situations,
lasting fewer than 3 days, you may report your absence, once per term,
without documentation, using the McMaster Student Absence Form
(MSAF). See
Requests
for Relief for Missed Academic Term Work
Absences for a longer duration or for other reasons must be reported
to
your Faculty/Program office, with documentation, and relief from term
work
may not necessarily be granted.
In Math 3V03, the percentages of the missed work will be
transferred
to the final examination.
Please note that the MSAF may not be used for term work worth 25% or
more,
nor can it be used for the final examination.
3. Student Accessibility Services.
Students who require academic accommodation must contact Student
Accessibility
Services (SAS) to make arrangements with a Program Coordinator.
Academic accommodations must be arranged for each term of study.
Student Accessibility Services can be contacted by phone
905-525-9140 ext. 28652 or e-mail sas@mcmaster.ca.
For further information, consult McMaster University's Policy for
Academic Accommodation of Students with Disabilities.
4. Important Message.
The instructor and university reserve the right to modify elements of
the course during the term. The university may change the dates and
deadlines for any or all courses in extreme circumstances. If either type of
modification becomes necessary, reasonable notice and communication
with the students will be given with explanation and the opportunity to
comment on changes. It is the responsibility of the student to check
their McMaster email and course websites weekly during the term and
to note any changes.
Course Information |
Instructor: Adam Van Tuyl
Office: Hamilton Hall 419
Office Hours: MW 12:30-1:30
Email: vantuyl@math.mcmaster.ca
Place and Time:
Class: MTTh 10:30-11:20 in Hamilton Hall 217
Textbook:
Perals in Graph Theory
by Nora Hartsfield and Gerhard Ringel
Homework Assignments |
Homework is given out every Thursday, and will be due, at the beginning of class, the following Thursday. Assignments must conform to the guidelines in the course outline. Assignments are posted below.
Assignment 1 (Due: Sept 17)
Sec. 1.1 -- 2,4,5,6,7
Sec. 1.2 -- 1,2,5,7,9
Assignment 2 (Due: Sept 24) [REVISED!]
Sec. 1.3 -- 4,5,8,9
Sec. 2.1 -- 3,5,12,16
Sec. 2.2 -- 5,6,8,11
Assignment 3 (Due: October 1) [REVISED!]
Sec. 2.3 -- 7,15,17
Sec. 2.4 -- 2,4,10
Sec. 3.1 -- 5,6,9
Sec. 3.2 -- 1,2,8
Assignment 4 (Due: October 22)
Sec. 4.1 -- 2,4,8
Sec. 4.2 -- 1,2,6ab,7
Use SAGE to do 2.3.5, 2.3.6, 2.3.7, 3.1.1
Assignment 5 (Due: October 29)
Sec. 4.3 -- 1,4,5
Sec. 5.1 -- 2,3,4,12
Sec. 5.2 -- 1,2b,3,4,9
Assignment 6 (Due: November 5)
Sec. 5.3 -- 1,4,5,9
Sec. 6.1 -- 1,2,8,10
Sec. 6.2 -- 2d,4,8,9
Assignment 7 (Due: November 19)
Sec. 7.1 -- 1b,2,6,8
Sec. 7.2 -- 2
Sec. 7.3 -- 1,3,5
Working in groups up to three, verify
anti-magic conjecture for all 47 non-isomorphic
trees on 9 vertices. SAGE is required.
Assignment 8 (Due: November 26)
Sec. 8.1 -- 5,6,11,15,16
Sec. 8.2 -- 1,2,3
Sec. 8.3 -- 1,3,7
Assignment 9 (Due: December 3)
Sec. 8.4 -- 1,2,4,8,11
Sec. 9.1 -- 1,5,6,8,10,11
Sec. 9.2 -- 2,4,5
Sec. 9.3 -- 1,5
Handouts |
All class handouts are available as PDF files.
Course Information
Course handout from first day of class
Midterm 1 Information Sheet
Handout describing first midterm
Midterm 1 Solutions
Solutions to the first midterm
Midterm 2 Information Sheet
Handout describing second midterm
Midterm 2 Solutions
Solutions to the second midterm
Final Exam Information Sheet
Handout describing final exam
Grading Scheme |
Homework = 20%
Midterm (x2)= 30%
Project = 10%
Final Exam = 40%
Important Dates |
Sept. 8, 2015
First semester classes begin
Oct. 8, 2015
Midterm 1
Oct. 9, 2015
Project topic due
Oct. 12-16, 2015
Fall Midterm Break (no classes)
Nov. 5, 2015
Project draft due
Nov. 12, 2015
Midterm 2
Nov. 13, 2015
Last day for cancelling courses without
failure by default
Dec. 3, 2015
Project Due
Dec. 7, 2015
First semester classes end
Dec. 11, 2015
Final Exam at 9:00AM in BSB 120