Connected graph

in the connected graph shown in the eg wherein nodes 1,2,3,4 are connected with each other and 5 is connected with 1.how can this be a connected graph?

hello @Senjuti256
we can reach to any node from any other node thats why it is called as connected graph.

how are we reaching in this eg pls can you help

draw the graph that u r talking on paper and share its photo with me.
it will explain u

How to share picture of the graph?

open this link .
and simply drag n drop ur picture

If we start from 0 how is it forming a connected graph?

from 0 we can reach to 1 ( by 0-> 1)
from 0 we can reach to 2( by 0->1->2 )
from 0 we can reach to 3 ( by 0-> 3)
from 0 we can reach to 4 ( by 0-> 4)

all nodes are rechable from 0.
and same holds for any other nodes that why we call it connected.

pls read this definition carefully->
a graph is said to be connected , if all nodes in that graph are reachable from all other nodes.

Ooo i thought that starting from a node on a single go i.e without picking the pen up the paper we have to visit all the nodes. So for connected graphs we need to check if we can visit all the nodes individually from the chosen source node right?

yeah , but u need check for each node(every node must be rechable from evry other node).

Actually I started from 0 and started looping through 1 2 and 3 but couldn’t reach 4 since there is no connection between 3 and 4

is it clear now . . . . ?

Yes I understood. Starting from a node I have to check if all other nodes can be visited from it individually. Thn repeat the process for all nodes in the graph?

yeah correct. . . . . .

If there are several connected components in the graph thn do we need to check if an element of a set has connection with another element of a different set of the same graph? Because they won’t be connected. Like my doubt is how to check and determine a connected graph that has several components

it is clear na , if there are more than one component in a given graph then it is not connected .
becuase we will not able to reach from any node in one component to any node in other component.

Oooo in those graphs the components are themselves connected but overall the graph is disconnected. Thnks I understood now