Skip to content

Launching a series on Graph Problem Solving. Exploring graph theory, algorithms, and practical techniques to master competitive coding and real-world problem-solving skills.

Notifications You must be signed in to change notification settings

Harshbhagat22/Graph-Problems-Solving-Series-2025

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Graph-Problems-Solving-Series-2025

Graph Used :

image

Graph Class :

class Graph {

  HashMap<String,List<String>>graph;
    public Graph(){
        graph = new HashMap<>();
    }
    
    public void addVertex(String v){
        graph.putIfAbsent(v,new ArrayList<>());
    }
    
    public void addEdge(String v1, String v2){
        graph.get(v1).add(v2);
    }
    
    public void printGraph(){
        for(String key : graph.keySet()){
            System.out.print(key+" : ");
            List<String> temp = graph.get(key);
            if(temp.isEmpty())System.out.print("NULL");
                for(String buff : temp){
                    System.out.print(buff+" ");
                }
                
            System.out.println();
        }
    }
}

GRAPH OUTPUT :

image

About

Launching a series on Graph Problem Solving. Exploring graph theory, algorithms, and practical techniques to master competitive coding and real-world problem-solving skills.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages