I was trying to implement graphs(to check if a path..) using vectors in cpp. Why does not the "addNewEdge" function add values to the adjacency list?

  adjacency-list, c++, graph
#include <bits/stdc++.h>
using namespace std;

//This function does not work as i intended it to. It should add the node a to the list of b and vice versa(an undirected graph.

void addNewEdge(vector<vector <int>> adjacencyList,int a,int b, vector<bool> isVisited){
    isVisited[a] = false;
    isVisited[b] = false;

//the following function is meant to mark a node as visited and all the nodes present in the list(i.e. those connected by edges) as  visited.

void Explore(vector<vector <int>> adjacencyList,int a,vector<bool> isVisited){
    isVisited[a] = true;
    auto itr = adjacencyList[a].begin();
    while (itr!=adjacencyList[a].end()){
        if (!isVisited[*itr])


int main(){
    //m is the no of vertices and n the no. of edges
    int m,n,i,a,b,node_1,node_2;
    cin >> m >> n;
    //cout << m << n;
    vector<vector <int>> adjacencyList(m+1);
    vector<bool> isVisited(m+1);

// it is where the magic was supposed to happen. Sadly the integer b does not push_back to the vector adjacencyList[a]

    for (i=0;i<n;++i){
        cin >> a >> b ;
        //cout << a << b << i;
    cin >> node_1 >> node_2;
    if(isVisited[node_2]) cout << "A path exists.";
    else cout << "No path exists";

Source: Windows Questions C++