Interior Design Service Website Design Free Download

How to create a completely responsive Online Interior Design Service – Architecture Website Design Template – Using HTML CSS JavaScript. Interior Design Service Website Design Free Download

Feeling confused? No problem, we will graphically understand the matter now, as well as see the code. In the beginning, no one is anyone’s friend. Then everyone is in a different set. And since sets have only one member, that member will be the representative of the set.

We will always color the representative of the set yellow.

I would implement this part like this:

#Python2.7.6

#assume a=1,b=2,c=3,d=4,e=5

element=5

par=[None]*(element+1) #Creating an array with 6 elements

def makeset(n):

par[n]=n

for i in range(1,element+1):

makeset(i)

We will create the set with the array called par. In the beginning he himself is the parent of all. Parent refers to who the node is connected to. We’ll build the entire structure using just one simple array! It is a kind of tree structure.

Now a and b suddenly decide that they will be friends. Then they must come from the same set. If a decides to make b’s representative its own representative, then they will end up in the same set. So a comes and joins with b because the representative of b is b itself.

Now c thought he would also be a’s friend. Now c will be added below? c will not be added under a, c will be added under the representative of a, i.e. under b.

Make d,e friends too:

Check out the next step. Now we will make e and c friends. c is the representative of the set b. With that we will add the representative of e. Representative of e is d. Make b the parent of d. Then b is now also representative of e.

Interior Design Service Website Design Free Download

Let’s look at some code again:

#Python2.7.6

def union(a,b):

u=find(a)

v = find(b)

if u==v:

print “They are already friends”

else:

par[u]=v #Or you can write par[v]=u too

We get the representative of the two nodes we want to make friends by calling the find() function. (I will see the definition of the function later) Now I made one the parent of the other.

Now the question is how to find a representative? If you read carefully till now, one thing should be noticed, the parent of the representative element of a set is the element itself, that is, if the element is r then par[r]=r. Let’s look at a slightly larger graph. I think a,b,c,d,e’s friends have moved in:

disjointset7(1)

Only some nodes are added to the previous set to facilitate the understanding of the next part. Let’s find the representative of f. The parent of f is not itself, then we check the parent of its parent to find its representative. The parent of f is c. c is also not representative because it is not its own parent, c’s parent is b and b itself is its own parent. Then b is representative. Let’s write the function:

#python2.7.6

def find(r):

if par[r]==r: return r

return find(par[r])

The function climbs up the tree until the representative is found. The previous two functions (union and makeset) did their actual work in O(1). The complexity’r question has come to the find() function. In the worst case, O(n) time may be required for the above find() function, the greater the depth of the tree, the more time it will take. This is fine for code written in a university lab, but in contests or elsewhere, if there are too many nodes, performance will suffer.

Here is a nice optimization. In fact this optimization is the beauty of the disjoint set structure. With each find() function call, we will modify the graph in such a way that the depth decreases. To find the representative of g we call g’s parent f. f returns the representative by calling its parent.

The return value is written below each node. Each node performs its previous function returning the same value, which we finally get, this value is representative. What would happen if we first wrote par[r]=find(par[r]) and then wrote “return par[r]” instead of return find(par[r])? When returning, the return value was made its parent, that is, everyone made the representative their parent!

The depth of the tree is reduced, isn’t it? This is called path compression. Later, when we look for the representative of f, there is only one more edge to climb. The wiki puts it nicely:

Graph Theory Tutorial 5: Minimum Spanning Tree (Prim Algorithm)

Interior Design Service Website Design Free Download

A new graph created from a graph with some nodes and edges is called a subgraph. A spanning tree is a subgraph such that:

  * The subgraph is a tree. A tree never has a cycle, has n−1 edges

where t is n

  is the number of nodes.

A graph can have many spanning trees, the minimum spanning tree is the one whose edges have the lowest cost/weight sum. In this article we will learn how to find Minimum Spanning Tree using Prim Algorithm.

Assume that each node in the graph below is a house. We need to install telephone lines between our houses. We want to install the line at the lowest cost. The wet line of the edges indicates the installation cost:

mst wiki

We could line up in many ways. The image shows one way of placing telephone lines with a red edge. The telephone lines form a subgraph that must be n−1

There is t edge, there is no bicycle because if we add extra edge, our cost will increase, there will be no profit. While extracting the minimum spanning tree we take the edges in such a way that the sum of their edges is minimized.

Now how do we find the minimum spanning tree from the graph below?

The greedy approach can be used to find the minimum spanning tree very easily. We will now see how Prim’s Algorithm works. If you want to learn Kruskal first, no problem, you can skip straight to the next part.

We will first take any one source node. Let the source be 1. We add the minimum number of edges from 1 to the subgraph. A blue edge in the image below means that the edge is added to the subgraph

Now take the minimum of the total number of edges from source 1 and node 5 (including previous edges):

Now let’s take the total number of edges from nodes 1, 2 and 5 (including the previous edges) and the minimum among them:

The next step is important. The minimum of the edges from 1, 2, 5, 4 is 2-4, but the node number 2 and node number 4 are already part of the subgraph, they are already connected, adding them will create a cycle in the subgraph, so the edge 2-4 We will not benefit from it. We take an edge every time a new node is added to the subgraph. Then 4-8 will be our next choice.

Then add 8-6:

Then 6-7:

Finally add 4-3:

This subgraph in blue is our minimum spanning tree. If the remaining edges are deleted:

Then total cost of installing telephone line: 4 + 2 + 5 + 11 + 9 + 2 + 1 = 34. A graph can have one or more minimum spanning trees.

Our sudocode will be like this:

* Input: A non-empty connected weighted graph with vertices V and edges E (the weights can be negative).

* Initialize: Vnew = {x}, where x is an arbitrary node (starting point) from V, Enew = {}

* Repeat until Vnew = V:

Interior Design Service Website Design Free Download

Before Download

You must Join our Facebook Group and Subscribe YouTube Channel

All Links in Below:






Join Our FreeWebsiteCreate Facebook Group to get an instant update for projects, templates, design resources, and solutions.

Join Our YouTube Channel & Subscribe with Bell Icon for New Video:

Join Our Official Facebook Page For the Latest updates All Code Projects are Free:

Visit our service page to get premium services.

Free Website Create – HTML CSS, PHP, JavaScript Programming Projects For Free

Follow Us

Thank You,

Stay with FreeWebsiteCreate.net

Share the post if necessary.

Before Download

You must Join our Facebook Group and Subscribe YouTube Channel




FreeWebsiteCreate.net tries to provide HTML, CSS, SCSS, JavaScript, React, Android Studio, Java, PHP, Laravel, Python, Django, C#(C Sharp), and ASP.net-related projects 100% free. We try to make learning easier. Free Website Create always tries to give free projects to new learners. Free projects and source code will help to learn quickly.

They can save time and learn more. In this post, we share a free portfolio project website code with HTML and CSS. This free code portfolio contains a single landing page with a responsive design. In this post, we get a free best carpenter and craftsman service website designed by FreeWebsiteCreate with HTML, CSS, Bootstrap, and JavaScript.

To get a free website project code,

Keep bookmarking our website, Save categories links, Follow Social Media, Follow the youtube channel Join Facebook groups.

Stay with FreeWebsiteCreate.net

Share the post if necessary.

Leave a Comment