diff --git a/Task2_FrontPage/Anshul Gupta/README.md b/Task2_FrontPage/Anshul Gupta/README.md new file mode 100644 index 0000000..dfe0b62 --- /dev/null +++ b/Task2_FrontPage/Anshul Gupta/README.md @@ -0,0 +1,9 @@ +# discreteStructures Slideshow Presentation +We have used HTML, CSS and JS for this presentation on Shortest path in a weighted graphs, Eulerian and Hamiltonian Path and Circuits and Konisberg Bridge to make it more attractive and interactive at the same time. +More Compatible at - PCs/Desktops. +All HTML CSS and JS work are mine own. +It can be viewed at https://anshulg954.github.io/Discrete-Structures/ +# Authors +* Aayushi Bansal +* Anshul Gupta +* Shriya Verma diff --git a/Task2_FrontPage/Anshul Gupta/images/Konigsberg_bridges.png b/Task2_FrontPage/Anshul Gupta/images/Konigsberg_bridges.png new file mode 100644 index 0000000..f6e5b7b Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/Konigsberg_bridges.png differ diff --git a/Task2_FrontPage/Anshul Gupta/images/addImages b/Task2_FrontPage/Anshul Gupta/images/addImages new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Task2_FrontPage/Anshul Gupta/images/addImages @@ -0,0 +1 @@ + diff --git a/Task2_FrontPage/Anshul Gupta/images/bg.jpg b/Task2_FrontPage/Anshul Gupta/images/bg.jpg new file mode 100644 index 0000000..3f5034b Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/bg.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/ccetLogoBlack.png b/Task2_FrontPage/Anshul Gupta/images/ccetLogoBlack.png new file mode 100644 index 0000000..b19f6da Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/ccetLogoBlack.png differ diff --git a/Task2_FrontPage/Anshul Gupta/images/comparison.jpg b/Task2_FrontPage/Anshul Gupta/images/comparison.jpg new file mode 100644 index 0000000..61e27eb Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/comparison.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/eg1.jpg b/Task2_FrontPage/Anshul Gupta/images/eg1.jpg new file mode 100644 index 0000000..ebca943 Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/eg1.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/eg2.jpg b/Task2_FrontPage/Anshul Gupta/images/eg2.jpg new file mode 100644 index 0000000..0ecdd61 Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/eg2.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/ex.jpg b/Task2_FrontPage/Anshul Gupta/images/ex.jpg new file mode 100644 index 0000000..607db7b Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/ex.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/ex1.jpg b/Task2_FrontPage/Anshul Gupta/images/ex1.jpg new file mode 100644 index 0000000..f8b48d4 Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/ex1.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/ex2.jpg b/Task2_FrontPage/Anshul Gupta/images/ex2.jpg new file mode 100644 index 0000000..2a391c8 Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/ex2.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/ex3.jpg b/Task2_FrontPage/Anshul Gupta/images/ex3.jpg new file mode 100644 index 0000000..13a082c Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/ex3.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/ex4.jpg b/Task2_FrontPage/Anshul Gupta/images/ex4.jpg new file mode 100644 index 0000000..a74f87b Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/ex4.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/ex5.jpg b/Task2_FrontPage/Anshul Gupta/images/ex5.jpg new file mode 100644 index 0000000..798a246 Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/ex5.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/graph.png b/Task2_FrontPage/Anshul Gupta/images/graph.png new file mode 100644 index 0000000..4cfeee3 Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/graph.png differ diff --git a/Task2_FrontPage/Anshul Gupta/images/ham.jpg b/Task2_FrontPage/Anshul Gupta/images/ham.jpg new file mode 100644 index 0000000..efcd282 Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/ham.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/ham1.jpg b/Task2_FrontPage/Anshul Gupta/images/ham1.jpg new file mode 100644 index 0000000..8889923 Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/ham1.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/koni2.png b/Task2_FrontPage/Anshul Gupta/images/koni2.png new file mode 100644 index 0000000..9511d44 Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/koni2.png differ diff --git a/Task2_FrontPage/Anshul Gupta/images/konibridge.jpeg b/Task2_FrontPage/Anshul Gupta/images/konibridge.jpeg new file mode 100644 index 0000000..4cc1107 Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/konibridge.jpeg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/map.png b/Task2_FrontPage/Anshul Gupta/images/map.png new file mode 100644 index 0000000..9bbf32d Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/map.png differ diff --git a/Task2_FrontPage/Anshul Gupta/images/pic1.jpg b/Task2_FrontPage/Anshul Gupta/images/pic1.jpg new file mode 100644 index 0000000..c2c586d Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/pic1.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/pic2.jpg b/Task2_FrontPage/Anshul Gupta/images/pic2.jpg new file mode 100644 index 0000000..16602ea Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/pic2.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/images/w1.png b/Task2_FrontPage/Anshul Gupta/images/w1.png new file mode 100644 index 0000000..f19529a Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/w1.png differ diff --git a/Task2_FrontPage/Anshul Gupta/images/w2.png b/Task2_FrontPage/Anshul Gupta/images/w2.png new file mode 100644 index 0000000..a14da6a Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/w2.png differ diff --git a/Task2_FrontPage/Anshul Gupta/images/x.jpg b/Task2_FrontPage/Anshul Gupta/images/x.jpg new file mode 100644 index 0000000..3b4dc4a Binary files /dev/null and b/Task2_FrontPage/Anshul Gupta/images/x.jpg differ diff --git a/Task2_FrontPage/Anshul Gupta/index.html b/Task2_FrontPage/Anshul Gupta/index.html new file mode 100644 index 0000000..dc1203f --- /dev/null +++ b/Task2_FrontPage/Anshul Gupta/index.html @@ -0,0 +1,485 @@ + + + +DISCRETE STRUCTURES + + + + + +
+ +

DISCRETE STRUCTURES

+
+
+
1 / 23
+
+
+
2 / 23
+
+

Weighted Graph? + A graph having weights i.e. a certain value assigned to the edges.


+ +

+
+
+
+
3 / 23
+
+

Shortest Path
+ It is the path that one can take to travel the minimum distance in order to reach a particular destination.

+ +

+
+
+
4 / 23
+
+

Shortest Path In A Weighted Graph
+ In technical terms, it can be said as the shortest path that we can traverse between any two vertices starting from one and leading to other.

+ +

+
+
+
+
5 / 23
+
+

Shortest path in a weighted Graph(Hands On Implementation)
+

+ +

+
+
+
+
6 / 23
+ +
+

Step 1: Consider two sets P and T. P contains those points which have been used while the T contains unused points/value.
+ Step 2: Let the distance between adjacents of vertex 0 be
+ L(7)=weight=8;
+ L(1)=weight=4;// Also tells the distance between vertex 0 and vertex 1.
+ while others
+ L(2)=L(3)=L(4)=L(5)=L(6)=L(8)= infinite;
+ Step 3: Find the Element having minimum value among all and put it in the set P.
+ Now here P={0,1} T={2,3,4,5,6,7,8}
+ Step 4: Suppose we want to find shortest path from 0 to 4. So we need to find the element having minimum value + put it in P. Repeat until 4 comes in the set P.
+ +

+
+
+
7 / 23
+

+ Step 5: *IMPORTANT*FORMULA*
+ L1(x)=min[L(x),L(prev)+W(x,prev)], where x belongs to T and previous belong to P.
+ SO Here L1(2)=min[L(2),L(1)+8]=min[infinite,4+8]=12
+ Similarly,
+ L1(3)=min[infinite,4+infinite]=infinite
+ L1(4)=min[infinite,4+infinite]=infinite
+ L1(5)=min[infinite,4+infinite]=infinite
+ L1(6)=min[infinite,4+infinite]=infinite
+ L1(7)=min[8,4+11]=8
+ L1(8)=min[infinite,4+infinite]=infinite
+ Since L1(7) is minimum amongst all L1 so we put 7 in P i.e.
+ P={0,1,7} AND T={2,3,4,5,6,8}

+ +
+
+
+
8 / 23
+

+ Step 6: Find L2
+ L2(x)=min[L1(x),L1(prev)+W(x,prev)], where x belongs to T and previous belong to P.
+ SO Here L2(2)=min[L(2),L1(7)+infinite]=min[12,8+infinite]=12
+ Similarly,
+ L2(3)=min[infinite,8+infinite]=infinite
+ L2(4)=min[infinite,8+infinite]=infinite
+ L2(5)=min[infinite,8+infinite]=infinite
+ L2(6)=min[infinite,8+1]=9
+ L2(8)=min[infinite,8+7]=15
+ Since L2(6) is minimum amongst all L2 so we put 6 in P i.e.
+ P={0,1,7,6} AND T={2,3,4,5,8}

+ +
+
+
+
9 / 23
+

+ Step 7: Find L3
+ L3(x)=min[L2(x),L2(prev)+W(x,prev)], where x belongs to T and previous belong to P.
+ SO Here L3(2)=min[L2(2),L2(6)+W(2,6)]=min[12,9+infinite]=12
+ Similarly,
+ L3(3)=min[infinite,9+infinite]=infinite
+ L3(4)=min[infinite,9+infinite]=infinite
+ L3(5)=min[infinite,9+2]=11
+ L3(8)=min[15,9+6]=15
+ Since L3(5) is minimum amongst all L3 so we put 5 in P i.e.
+ P={0,1,7,6,5} AND T={2,3,4,8}

+ +
+
+
+
10 / 23
+

+ Step 8: Find L4
+ L4(x)=min[L3(x),L3(prev)+W(x,prev)], where x belongs to T and previous belong to P.
+ SO Here L4(2)=min[L3(2),L3(5)+W(2,5)]=min[12,11+4]=12
+ Similarly,
+ L4(3)=min[infinite,11+14]=25
+ L4(4)=min[infinite,11+10]=21
+ L4(8)=min[15,11+infinite]=15
+ Since L4(2) is minimum amongst all L4 so we put 2 in P i.e.
+ P={0,1,7,6,5,2} AND T={3,4,8}

+
+
+
+
11 / 23
+

+ Step 9: Find L5
+ L5(x)=min[L4(x),L4(prev)+W(x,prev)], where x belongs to T and previous belong to P.
+ SO Here L5(3)=min[L4(3),L4(2)+W(3,2)]=min[25,12+7]=19
+ Similarly,
+ L5(4)=min[21,12+infinite]=21
+ L5(8)=min[15,12+2]=14
+ Since L5(8) is minimum amongst all L5 so we put 8 in P i.e.
+ P={0,1,7,6,5,2,8} AND T={3,4}

+
+
+ +
+
12 / 23
+

+ Step 10: Find L6
+ L6(x)=min[L5(x),L5(prev)+W(x,prev)], where x belongs to T and previous belong to P.
+ SO Here L6(3)=min[L5(3),L5(8)+W(3,8)]=min[19,14+infinite]=19
+ Similarly,
+ L6(4)=min[21,14+infinite]=21
+ Since L6(3) is minimum amongst all L6 so we put 3 in P i.e.
+ P={0,1,7,6,5,2,8,3} AND T={4}

+
+
+
+
13 / 23
+

+ Step 11: Find L7
+ L7(x)=min[L6(x),L6(prev)+W(x,prev)], where x belongs to T and previous belong to P.
+ SO Here L7(4)=min[L6(4),L6(3)+W(4,3)]=min[21,19+9]=21
+ Since there are no elements left so we put 4 in P i.e.
+ P={0,1,7,6,5,2,8,3,4} AND T={}
+ SO, Now we can say starting from 0TH vertex, the shortest distance between
+ V(0,1)= 4 UNITS [PATH BEING 0->1]
+ V(0,2)= 12 UNITS [PATH BEING 0->1->2]
+ V(0,3)= 19 UNITS [PATH BEING 0->1->2->3]
+ V(0,4)= 21 UNITS [PATH BEING 0->7->6->5->4]
+ V(0,5)= 11 UNITS [PATH BEING 0->7->6->5]
+ V(0,6)= 9 UNITS [PATH BEING 0->7->6]
+ V(0,7)= 8 UNITS [PATH BEING 0->7]
+ V(0,8)= 14 UNITS [PATH BEING 0->1->2->8]
+

+ +
+
+ +
+
14 / 23
+

Euler Paths and Circuits

+ An Euler path is a path using every +edge of the graph G exactly once.
+An Euler circuit is an Euler path +that returns and end at the same vertex. +

+ + +
+
+
+
15 / 23
+
+

Necessary and Sufficient Conditions

+ The graph must be connected.
+ THEOREM 1- A connected multigraph with at least two vertices has an Euler circuit if and only if each of its vertices has even degree.
+ THEOREM 2 - A connected multigraph has an Euler path but not an Euler circuit if and only if it has exactly two vertices of odd degree. +

+
+
+
16 / 23
+

Examples

+

Which of the following graphs has an Euler path?

+ +

Which of the following graphs has an Euler circuit?

+

+
+
+
17 / 23
+

Hamiltonian Paths And Hamiltonian Circuits

+ A Hamiltonian path in a graph G is a path which visits every vertex in G exactly once.
+A Hamiltonian circuit is a circuit that visits every vertex in G exactly and starts and ends at the same vertex.

+ + +
+
+
+
18 / 23
+
+

Sufficient Conditions
+ Dirac’s Theorem-If G is a simple graph with n vertices with n ≥ 3 such that the degree of every vertex in G is at least n/2, then G has a Hamiltonian circuit.

+ Ore’s Theorem-Let G be a connected graph with n vertices then G is Hamiltonian if n ≥ 3 and n ≤ degree(u) + degree(v) for every pair of non-adjacent vertices u and v in G. +

+
+
+
+
19 / 23
+
+

Comparison between both the circuits

+ There is a one-word difference between Euler paths/circuits and Hamilton paths/circuits: The former covers all edges; the latter covers all vertices.
+

+ +
+
+
+
20 / 23
+

Königsberg Bridge
+ Königsberg was a city in Prussia situated on the Pregel River.
+ In Konigsberg, Germany, a river ran through the city such that in its center was an island, and after passing the island, the river broke into two parts. Seven bridges were built so that the people of the city could get from one part to another. + It became a tradition to try to walk around the town in a way that only crossed each bridge once, but it proved to be a difficult problem.

+ +

+ +
+
+
+
21 / 23
+

QUESTION
+ Determine whether it’s possible to walk across all the bridges exactly once in returning back to the starting land area?
+
In 1736 Euler proved that the walk was not possible to do + He proved this by inventing a kind of diagram called a network, that is made up of vertices (dots where lines meet) and arcs (lines). Define the degree of a vertex to be the number of edges incident to it. + +He used four dots (vertices) for the two riverbanks and the two islands. These have been marked A, B and C, D.

+ Euler showed that there is a walk starting at any vertex, going through each edge exactly once and terminating at the start vertex iff the degree of each vertex is even. This walk is called Eulerian.
+
The seven lines (arcs) are the seven bridges.
+ + +

+ +
+
+
+
22/ 23
+

3 bridges (arcs) join to riverbank A, and 3 join to riverbank B. 5 bridges (arcs) join to island C, and 3 join to island D. +
+ +
All the vertices have an odd number of arcs, so they are called odd vertices. (An even vertex would have to have an even number of arcs joining to it). + +

+ +
+
+
+
23 / 23
+
+

+

REFERENCES

+ --> GeeksforGeeks
+ -->W3Schools (for slideshow work only)
+ -->Slide Share
+ -->Discrete Mathematics and Its Applications (McGraw-Hill International Editions: Mathematics Series) Jun 1999 +by Kenneth H. Rosen.
+ Thanks A Lot Folks!
+ That's all for today.
+ Follow us on Github at:
+ -->anshulg954
+ -->aayushi1499
+ -->shriyaverma
+

+ +
+
+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+

Shortest Path In Weighted Graphs|Eulerian & Hamiltonian
Paths & Circuits|Konigsberg Bridge

+ +

Anshul Gupta|Aayushi Bansal|Shriya Verma

+

CO18311|CO18303|CO18347

+

Faculty Mentor: Mr. Amit Chabbra

+
+ + +