Skip to content

Instantly share code, notes, and snippets.

View MithraTalluri's full-sized avatar

Mithra Talluri MithraTalluri

View GitHub Profile
@MithraTalluri
MithraTalluri / GraphImplementation.java
Last active October 19, 2021 14:26
Basic Graph Implementation in Java
import java.util.HashSet;
import java.util.LinkedList;
class Vertex{
private String name;
private LinkedList<Edge> edgeList;
public Vertex(String name){
this.name = name;
edgeList = new LinkedList<>();
//new class to store level of each node along with the node
static class QueueNode{
Node node;
int level;
public QueueNode(Node node, int level){
this.node = node;
this.level = level;
}
}