WATCH MLB LIVE STREAM

Watch MLB STREAMS on MLBSHOW for Free. Reddit MLB STREAMS is the best one stop solution for all MLB games live streams with 100+ links With mlbshow.pro, you might observe free high-goal MLB live…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Breaking the Ice with Graphs

An Introduction to Graph Theory in Programming Part-1

Algorithms and Data Structures can be a scary place for anyone new to Computer Science and Competitive Coding. Graphs are often considered to be one of the scarier data structures out there.

But graphs are super fun once you get a hang of them.😃

Let’s get started.

A graph is a tool in mathematics that is used to depict the relationship between entities.

The circles are called vertices and represent some entities. These could be anything ranging from stations in a rail network to members of a family.

The lines are called edges and represent some relation.

There are 2 types of graphs — directed graphs and undirected graphs. The one shown above is directed, which means that the edges go in 1 direction. So I can go from 1 to 2 but not 2 to 1. Getting rid of the arrows would make it an undirected graph which would mean all edges are 2-way.

Graphs are extremely useful wherever we have to solve problems involving objects related to each other. In the real world computer networks, social networks, cities connected by highways can all be analyzed as graph problems. The applications are endless — from calculating the similarity between 2 twitter users or calculating the optimal path a delivery truck must take to city planning and water supply management.

Basic Terms:

There are 2 popular ways to represent a graph in code:

Add a comment

Related posts:

Awesome climate solutions that no one seems to be talking about

When we heard of climate change solutions, common things come up: Wind, solar and nuclear. Beyond Meat, Impossible Burgers and other meat alternatives. Electric cars. LED lights. Grow trees. But…

Why have we stopped talking about mobile?

Major news conferences are now tackling shiny new tech topics like bots and AI, and mixed, augmented and virtual reality, for journalism. While these are important topics that have their place in the…

Refusing To Accept Their Rejection

The letter said it nicely, but it still said no. “Thank you for your application for our opening, however….” You know how the rest of the letter went: flood of applicants; so many well-qualified…