0% found this document useful (0 votes)
27 views18 pages

What Is A Graph in Graph Theory

Graph Theory Guide

Uploaded by

acedragon235
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views18 pages

What Is A Graph in Graph Theory

Graph Theory Guide

Uploaded by

acedragon235
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

WHAT IS A GRAPH IN GRAPH THEORY?

• A collection of vertices and edges


WHAT IS AN EDGE IN A GRAPH?

• It is a line connecting of two vertices


TYPES OF GRAPHS
IN GRAPH THEORY
1. Directed Graph – a graph in which edges have direction, i.e., the
edges have arrows indicating the direction of traversal.

2. Undirected Graph – a graph in which edge have no direction, i.e., the


edges do not have arrows indicating the direction of traversal.
If the edges in your graph have directionality then your graph is said to be
a directed graph (sometimes shortened to digraph). In a directed graph
all of the edges represent a one way relationship, they are a relationship
from one node to another node — but not backwards. In an undirected
graph all edges are bidirectional. It is still possible (even common) to
have bidirectional relationships in a directed graph, but that relationship
involves two edges instead of one, an edge from A to B and another edge
from B to A.
Directed edges have a subtle impact on the use of the term neighbors. If
an edge goes from A to B, then B is said to be A’s neighbor; but the
reverse is not true. A is not a neighbor of B unless there is an edge from B
to A.
Let’s use two social networks as examples. On Facebook the graph of friends is
undirected. If you are someone’s friend on Facebook they are your friend too —
friendship on Facebook is always bidirectional meaning the graph representation is
undirected. On Twitter, however, “following” someone is a one way relationship. If you
follow Beyoncé that doesn’t mean she follows you. The graph of Twitter users and
their followers is a directed graph.
3. Weighted Graph - A graph in which edges have weights or costs
associated with them.

Example: A road network graph where the weights can represent the
distance between two cities.
4. Unweighted Graph - A graph in which edges have no weights or costs
associated with them.

Example: A social network graph where the edges represent friendships.


If edges in your graph have weights then your graph is said to be a weighted
graph, if the edges do not have weights, the graph is said to be unweighted.
A weight is a numerical value attached to each individual edge. In a
weighted graph relationships between nodes have a magnitude and this
magnitude is important to the relationship we’re studying. In an
unweighted graph the existence of a relationship is the subject of our
interest.
As an example of a weighted graph, imagine you run an airline and you’d
like a model to help you estimate fuel costs based on the routes you fly. In
this example the nodes would be airports, edges would represent flights
between airports, and the edge weight would be the estimated cost of
flying between those airports. Such a model could be used to determine the
cheapest path between two cities, or run simulations of different potential
flight offerings.
An unweighted graph may be used because a relationship in terms of
magnitude doesn’t exist. For example, a graph representing college courses
and their prerequisites has this property — nodes are courses and edges
represent a prerequisite relationship between two classes. If a particular
course has two prerequisites it is wrong to say that one course is more of a
prerequisite than the other, you just have to pass both prerequisite courses
before taking the course in question.
5. Complete Graphs – A graph in which each vertex is connected to
every other vertex.

Example: A tournament graph where every player plays against every


other player.
6. Bipartite Graphs – is a graph whose vertices can be divided into two
independent sets, U and V such that every edge (u, v) either connects
a vertex from U to V or a vertex from V to U. In other words, for every
edge (u, v), either u belongs to U and v to V, or u belongs to V and v to
U. We can also say that there is no edge that connects vertices of same
set.
Example:
For example, we might have a number of job openings, and we want to
give each job to a person who is qualified for it. We might consider the
bipartite graph where vertices are jobs and people, and an edge
connects a job and a person whenever that person is qualified for that
job. For example, the graph might look like this:

JOBS

PEOPLE

You might also like