For discrete math uploau ally hles that you write to solve the problems. 1. lect
ID: 3840878 • Letter: F
Question
For discrete math uploau ally hles that you write to solve the problems. 1. lecture, we went through an example of finding an Euler Circuit for a given graph. We also looked at MATLAB code for an algorithm that would do it for us. The algorithm is in the textbook, but in MATLAB, it looks like this: function Circuit Euler (EG) You pass an nx2 matrix EG into Euler containing the edges of the graph G The function returns a sequence of edges forming an Euler circuit Circuit Makecircuit (EG, 1) Makes a circuit starting at edge 1 EH Remove Edges (EG Circuit); BRemoves edges in circuit from EG while length (EH) [v, nj Findvertex (circuit, EH) 6Find a vertex that is in circuit and EH Sub Circuit MakeCircuit (EH v) t Makes a circuit starting at edge v Circuit Merge circuits (Circuit subcircuit, n) SAdds the subcircuit to the circuit EH Remove Edges (EH, SubCircuit) endExplanation / Answer
(a) First, pick a vertex to the the “start vertex.”
(b) Find at random a cycle that begins and ends at the start vertex.
Mark all edges on this cycle. This is now your “curent circuit.”
(c) If there is not a vertex on the current circuit that is incident to
an unmarked edge, you are done. If there is such a vertex, find
a random cycle using unmarked edges that begin and ends at
this vertex. Mark the edges in this cycle as you find it. Splice
this cycle into the current circuit to make a new, larger current
circuit that begins and ends at the start vertex. Repeat this
step.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.