Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Graph Theory Algorithm, Study Guides, Projects, Research of Algorithms and Programming

This project includes various problems in algorithm and their solutions some of which are TSP, BSF, Maxflow,etc

Typology: Study Guides, Projects, Research

2018/2019

Uploaded on 11/04/2019

ssamatkar
ssamatkar 🇮🇳

2 documents

1 / 24

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Graph Theory Algorithm
Prepared By:- 1.) Madhulika Tiwari
2.) Hema Das
3.) Priyanka Jadhav
4.) Sruti Samatkar
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download Graph Theory Algorithm and more Study Guides, Projects, Research Algorithms and Programming in PDF only on Docsity!

Graph Theory Algorithm

Prepared By:- 1.) Madhulika Tiwari

2.) Hema Das

3.) Priyanka Jadhav

4.) Sruti Samatkar

Travelling Salesman

Problem(TSP)

Q. Given a list of cities and the distances between

each pair of cities, what is the shortest possible

route that visits each city exactly once and returns

to the origin city?

A

B

C

D

What is an Eulerian Path?

  • (^) An Eulerian Path (or Eulerian Trail) is a path of edges

that visits all the edges in a graph exactly once.

  • (^) We can find an Eulerian path on the following graph,

but only if we start at specific nodes.

What is an Eularian Circuit?

An Eulerian Circuit(or Eulerian Cycle) is an

Eulerian path which starts and ends on the same

vertex.

What conditions are required for a

valid Eulerian Path/Circuit?

  • (^) That depends on what kind of graph you’re dealing with . Altogether there are four types of the Euler

path/circuit problem we care about:

EULERIAN CIRCUIT EULERIAN PATH

UNDIRECTED

GRAPH

Every vertex has an even

degree

Either every vertex has even degree or

exactly two vertices have odd degree

DIRECTED GRAPH Every vertex has equal

indegree and outdegree

At most one vertex has

(outdegree)-(indegree)=1.

and most one vertex has

(indegree)-(outdegree)=1.

And all other vertices have equal in and

out degrees.

Max Flow :

A Flow graph (flow network) is a directed graph where each

edge has certain capacity which can be receive a certain

amount of flow. The flow running through an edge must be

less than or equal to the capacity.

A network is a graph G = (V, E), where V is a set of vertices

and E is a set of V’s edges – a subset of V × V – together with

a non-negative function c: V × V → ℝ∞, called the capacity

function. Without loss of generality, we may assume that if (u,

v) ∈ E then (v, u) is also a member of E, since if (v, u) ∉ E

then we may add (v, u) to E and then set c(v, u) = 0.

To find the maximum flow (and min-cut as a by product) the Ford Fulkerson

method repeatedly finds argumenting paths through the :

Residua l Graph

Augmenting Path

Residua l Graph:

The residual capacity of an arc with respect to a pseudo-flow f,

denoted cf, is the difference between the arc's capacity and its flow.

That is, cf (e) = c(e) - f(e). From this we can construct a residual

network, denoted Gf (V, Ef), which models the amount of available

capacity on the set of arcs in G = (V, E). More formally, given a flow

network G, the residual network Gf has the node set V, arc set Ef =

{e ∈ V × V : cf (e) > 0} and capacity function cf.

Note that there can be a path from u to v in the residual network,

even though there is no path from u to v in the original network.

Since flows in opposite directions cancel out, decreasing the flow

Bipartite Graph :

  • (^) A bipartite graph is one whose vertices can be split into two

independent group U and V. In the mathematical discipline of graph

theory, a matching or independent edge set in a graph is a set of edges

without common vertices. Finding a matching in a bipartite graph can be

treated as a network flow problem.

Given a graph G = (V,E), a matching M in G is a set of pairwise non-

adjacent edges, none of which are loops; that is, no two edges share a

common vertex.

  • (^) A vertex is matched (or saturated) if it is an endpoint of one of the

edges in the matching. Otherwise the vertex is unmatched.

Maximal Matching:

  • (^) A maximal matching is a matching M of a graph G with the

property that if any edge not in M is added to M, it is no longer

a matching, that is, M is maximal if it is not a subset of any

other matching in graph G. In other words, a matching M of a

graph G is maximal if every edge in G has a non-empty

intersection with at least one edge in M.

Mice and Owls

  • (^) Que :- Suppose M mice are out on a field and there’s a

hungry owl about to make a move.

  • (^) Further suppose there are H holes Scattered across the

ground that the mice can hide in.

  • (^) Assume every mouse is capable of running a radius of r

before being caught by the owl.

  • (^) What is the maximum number of mice that can hide

safely?

Mice and Owls

  • (^) Step 1:- Figure out which holes each mouse can reach.( draw a circle

of radius r around the mice )

  • (^) Step 2:- Decide which mice should move to which holes to

maximize the overall safety of the group. The key realization to

make is that this graph is bipartite.

  • (^) Step 3:- Create flow graph setup :-

1.create M mice nodes (0 to M-1)

  1. create H hole nodes(M to M+H-1)

Elementary Math

  • (^) Problem Statement:- In each question , the students have to

add(+),multiply(*) or subtract(-) a pair of numbers. The answer of

each pair should differ from each other.

  • (^) Example:-

1__5= __

3__3= __

-1__-6= __

2__2= __

Elementary Math

  • (^) Step 1:- For every pair there must be 3 unique solutions.
  • (^) Step 2:- Separate the pairs on one side and the answer

node on the other side.

  • (^) Step 3:- Do Step 2 &3 for each pair given.
  • (^) Step 4:- Try finding the matching and add source node S

and sink node T.

  • (^) Steep 5:- Assign Capacities to the edges of the flow graph.
  • (^) Step 6:- Run a maximal algorithm and select the edges of

maximum flow.

  • (^) Step 7:- Check the operators.

ANSWERS

1 + 5 = 6

3 - 3 = 0

-1 + -6 = -

2 * 2 = 4

Capacity Scaling Algorithm

  • (^) Step 1:- Let U = The value of the largest edge capacity in the initial

flow graph.

Let = The largest power of 2 less than or equal

to U.

  • (^) Step 2:- The capacity scaling heuristic says that you should only take

edges whose remaining capacity is >= in order to achieve a

better runtime.

Capacity Scaling Algorithm

  • (^) Step 3:- The algorithm repeatedly finds augmenting paths

with remaining capacity >= until no more paths satisfy

this criteria, then decreasing the value of delta by dividing it

by 2( = /2) & repeat while >.

  • (^) Step 4:- The capacity scaling works very well in practice.

In terms of time complexity, capacity scaling with a DFS is

bounded by O(E

log(U)) or O(EVlog(U)) if the shortest

augmenting path is used.