Skip to main content

Driver program to perform operations in graph

Driver program to perform operations in graph:-



package com.problems.graph;

public class GraphDriver {

 public static void main(String[] args)
 {
  BFSGraph g=new BFSGraph();
  g.addVertex('A');
  g.addVertex('B');
  g.addVertex('C');
  g.addVertex('D');
  g.addVertex('E');
  g.addVertex('F');
  g.addVertex('G');
  g.addVertex('H');
 
  g.addEdge(0, 1);
  g.addEdge(1, 2);
  g.addEdge(1, 7);
  g.addEdge(2, 3);
  g.addEdge(2, 4);
  g.addEdge(7, 4);
  g.addEdge(4, 5);
  g.addEdge(4, 6);
  g.bfs();
 }
 
}

Comments

.

Popular posts from this blog

5 steps to add existing project to your GIT HUB repository [Windows]

this tutorial will tell you how to add existing project to your git hub account. Step1. Go to your GITHUB account. Create New repository  add repository Step2. Fill the required details. ( uncheck create read me ). Add details   Step 3. Open GIT shell from your desktop. Step 4. Go to the directory of your project using cd  “path of the project” Initialize git by using command   git init Add your files by using command   git add . Commit your files by command git commit –m ‘first commit’ commands to add git   STEP 5 Select your repository Add using command git remote add origin https://github.com/username/projectname.git Now push the project to git git push -u origin master push command

Best LeetCode Lists for Interviews

Here is a list of some of the best questions asked in interviews Must do Top interview questions Top 100 liked Must do 75  Must do 60  Must do medium Data structures Tree Graph  Dynamic Programming Company Interviews FaceBook interviews Amazon Interviews Google Interviews Github master List