Graphs Lecture
Graphs Lecture
Graphs Lecture
GRAPHS
• A graph can be thought of as a data structure that is used to
describe relationships between entities.
• An entity can be any item that has a distinctive and independent
existence. It could either be an actual physical object or an
abstract idea. For example, an entity can be a person, place or an
organization about which data can be stored.
GRAPHS
•In the computing world, graphs have become ubiquitous
owing to their ability to not only provide abstractions to real
life but also demonstrate complicated relationships with ease.
As such, a variety of practical problems can be represented as
graphs. For example, a linked structure of websites can be
viewed as a graph.
• Every graph is a set of points referred to as vertices or nodes which are connected
using lines called edges. The vertices represent entities in a graph. Edges, on the
other hand, express relationships between entities. Hence, while nodes model
entities, edges model relationships in a network graph. A graph G with a set
of V vertices together with a set of E edges is represented as G= (V, E). Both
vertices and edges can have additional attributes that are used to describe the
entities and relationships. Figure 1 depicts a simple graph with five nodes and six
edges.
• In real-world applications of graphs, an edge might represent professional
relationships that exist between people in linkedin or a personal relationship
on a social media platform such as facebook or instagram.
• Graphs can broadly be categorized into undirected (fig 2a)
or directed (fig 2b). An undirected graph is directionless. This means that
the edges have no directions. In other words, the relationship is mutual.
For example, a facebook or a linkedin connection. Contrarily, edges of
directed graphs have directions associated with them. An asymmetric
relationship between a boss and an employee or a teacher and a student
can be represented as a directed graph in data structure. Graphs can also
be weighted (fig 2c) indicating real values associated with the edges.
Depending upon the specific use of the graph, edge weights may
represent quantities such as distance, cost, similarity etc.
REPRESENTING GRAPHS
• Https://www.Mygreatlearning.Com/blog/representing-grap
hs-in-data-structures/