Program to find whether an edge exists between two given vertices of a graph : I wrote the following code in C to find whether there exists an edge between two given vertices of a graph.Initially I ask user for inputs and then check whether there is a edge between two vertices using a BFS approach(queue).

This code is working fine for some testcases but throwing a segmentation fault in few. please tell me where Iam going wrong

        #include <stdio.h>
        #include <stdlib.h>
        int main()
        {
          int v,e,e1,e2,t1,t2;
          printf("Enter num of vertices and edges: ");
          scanf("%d %d",&v,&e);
          int maze[v][v];
          for(int i=0;i<v;i++)
           for(int j=0;j<v;j++)
            maze[i][j]=0;
          printf("Enter edges:\n")
          for(int i=0;i<e;i++)
          {
            scanf("%d %d",&e1,&e2);
            maze[e1-1][e2-1]=1;
            maze[e2-1][e1-1]=1;
          }
          printf("The maze looks like:\n");
          for(int i=0;i<v;i++)
          {
            for(int j=0;j<v;j++)
            {
              printf("%d ",maze[i][j]);
            }
            printf("\n");
           }
           printf("enter target edges: ");
           scanf("%d %d",&t1,&t2);
           //BFS starts from here.
           int queue[v*v];
           int k = 1;
           queue[0] = t1-1;
           for(int i=0;i<v;i++)
           if(maze[t1-1][i]==1)
           {
             queue[k] = i;
             k++;
           }
           int bp,ep;
           bp = 0;
           ep = k;
          while(bp<=ep)
         {
            if(queue[bp]+1==t2)
           {
            printf("\nroute exists\n");
            exit(0);
           }
           else
           {
             for(int i=0;i<v;i++)
                if(maze[queue[bp+1]][i]==1)
                {
                    queue[k] = i;
                    k++;
                }       
            }
           bp=bp+1;
           ep=k;
          }
         printf("\nroute does'nt exist\n");
         }


        Testcases for which this code is working:
        Testcase-1:
        4 2
        1 2
        3 2
        1 3
        Testcase-2:
        4 2
        1 2
        3 2
        1 4
        TestCase-3:
        7 6
        0 1
        0 2
        1 3
        1 4
        1 6
        5 6
        1 6
        Testcases for which Iam getting a segmentation fault:

        TestCase-4:
        7 6
        0 1
        0 2
        1 3
        1 4
        1 6
        5 6
        0 6
        TestCase-5:
        7 6
        0 1
        0 2
        1 3
        1 4
        1 6
        5 6
        2 4