The document discusses elements and operations related to graphs. It defines key graph elements like vertices, edges, loops, and degrees of vertices. It also describes operations on graphs such as finding paths and circuits, determining connectivity, and extracting subgraphs. Various graph types and conversions between directed and undirected graphs are also covered.
11. ELEMENT OF GRAPH
Elements of Graph
Identify the vertices, edges, and loops of a graph
Identify the degree of a vertex
Identify and draw both a path and a circuit through a
graph
Determine whether a graph is connected or
disconnected
Find the shortest path through a graph using
Dijkstra’s Algorithm
13. Graphs, Vertices, and Edges
A graph consists of a set of dots, called vertices,
and a set of edges connecting pairs of vertices.
While we drew our original graph to correspond
with the picture we had, there is nothing particularly
important about the layout when we analyze a graph.
Both of the graphs below are equivalent to the one
drawn above.
GRAPHS VERTICES AND EDGES
14. VERTEX
Vertex
A vertex is a dot in the graph that could represent an
intersection of streets, a land mass, or a general
location, like “work” or “school”. Vertices are often
connected by edges. Note that vertices only occur
when a dot is explicitly placed, not whenever two
edges cross. Imagine a freeway overpass—the
freeway and side street cross, but it is not possible to
change from the side street to the freeway at that
point, so there is no intersection and no vertex would
be placed.
15. EDGES
Edges
Edges connect pairs of vertices. An edge can
represent a physical connection between locations,
like a street, or simply that a route connecting the
two locations exists, like an airline flight.
16. LOOP
Loop
A loop is a special type of edge that connects a vertex
to itself. Loops are not used much in street network
graphs.
17. DEGREE OF A VERTEX
Degree of a vertex
The degree of a vertex is the number of edges
meeting at that vertex. It is possible for a vertex to
have a degree of zero or larger.
Degree 4
Degree 3
Degree 2
Degree 1
18. PATH
Path
A path is a sequence of vertices using the edges.
Usually we are interested in a path between two
vertices. For example, a path from vertex A to vertex
M is shown below. It is one of many possible paths in
this graph.
19. CIRCUIT
Circuit
A circuit is a path that begins and ends at the same
vertex. A circuit starting and ending at vertex A is
shown below.
20. CONNECTED
Connected
A graph is connected if there is a path from any
vertex to any other vertex. Every graph drawn so far
has been connected. The graph below is
disconnected; there is no way to get from the
vertices on the left to the vertices on the right.
21. WEIGHTS
Weights
Depending upon the problem being solved,
sometimes weights are assigned to the edges. The
weights could represent the distance between two
locations, the travel time, or the travel cost. It is
important to note that the distance between vertices
in a graph does not necessarily correspond to the
weight of an edge.
22. GRAPH OPERATIONS
Graph Operations – Extracting sub graphs
In this section we will discuss about various types of
sub graphs we can extract from a given Graph.
Sub graph
Getting a sub graph out of a graph is an interesting
operation. A sub graph of a graph G(V,E) can be
obtained by the following means:
Removing one or more vertices from the vertex set.
Removing one or more edges from the edge family.
Removing either vertices or edges from the graph.
23. VERTICES&EDGES
The vertices of sub graphs are subsets of the original
vertices
The edges of sub graphs are subsets of the original
edges
24. NEIGHBIURHOOD GRAPH
Neighbourhood graph
The neighbourhood graph of a graph G(V,E) only makes
sense when we mention it with respect to a given vertex
set. For e.g. if V = {1,2,3,4,5} then we can find out the
Neighbourhood graph of G(V,E) for vertex set {1}.
So, the neighbourhood graphs contains the vertices 1 and
all the edges incident on them and the vertices connected
to these edges.
Below is a graph and its neighbourhood graphs as
described above.
26. SPANNING TREE
Spanning Tree
A spanning tree of a connected graph G(V,E) is a sub
graph that is also a tree and connects all vertices in V.
For a disconnected graph the spanning tree would be the
spanning tree of each component respectively.
There is an interesting set of problems related to finding
the minimum spanning tree (which we will be discussing
in upcoming posts). There are many algorithms available
to solve this problem, for e.g.: Kruskal’s, Prim’s etc. Note
that the concept of minimum spanning tree mostly
makes sense in case of weighted graphs. If the graph is
not weighted, we consider all the weights to be one and
any spanning tree becomes the minimum spanning tree.
28. GRAPH OPERATIONS
Graph Operations – Conversions of Graphs
In this section we discuss about converting one graph into
another graph. Which means all the graphs can be converted
into any of the below forms.
Conversion from Directed Graph to Undirected graph
This is the simplest conversions possible. A directed graph has
directions represented by arrows, in this conversion we just
remove all the arrows and do not store the direction
information. Below is an example of the conversion.
Please note that the graph remains unchanged in terms of its
structure. However, we can choose to remove edges if there
are multi edges. But it is strictly not required.
29. GRAPH OPERATIONS
Conversion from Undirected Graph to Directed
graph
This conversion gives a directed graph given an
undirected graph G(V,E). It is the exact reverse of
the above. The trick to achieve this is to add one edge
for each existing edge in the edge family E. Once the
extra edges are added, we just assign opposite
direction to each pair of edges between connecting
vertices.