#### Kahns Algorithm

A
```package com.thealgorithms.datastructures.graphs;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Set;

/**
* A class that represents the adjaceny list of a graph
*/
class AdjacencyList<E extends Comparable<E>> {

}

/**
* This function adds an Edge to the adjaceny list
*
* @param from , the vertex the edge is from
* @param to, the vertex the edge is going to
*/
void addEdge(E from, E to) {
try {
} catch (Exception E) {
}
}
}

/**
* @param v, A vertex in a graph
* @return returns an ArrayList of all the adjacents of vertex v
*/
ArrayList<E> getAdjacents(E v) {
}

/**
* @return returns a set of all vertices in the graph
*/
Set<E> getVertices() {
}
}

class TopologicalSort<E extends Comparable<E>> {

Map<E, Integer> inDegree;

this.graph = graph;
}

/**
* Calculates the in degree of all vertices
*/
void calculateInDegree() {
inDegree = new HashMap<>();
for (E vertex : graph.getVertices()) {
if (!inDegree.containsKey(vertex)) {
inDegree.put(vertex, 0);
}
try {
} catch (Exception e) {
}
}
}
}

/**
* Returns an ArrayList with vertices arranged in topological order
*/
ArrayList<E> topSortOrder() {
calculateInDegree();
Queue<E> q = new LinkedList<E>();

for (final var entry : inDegree.entrySet()) {
if (entry.getValue() == 0) {
}
}

ArrayList<E> answer = new ArrayList<>();

while (!q.isEmpty()) {
E current = q.poll();
if (inDegree.get(adjacent) == 0) {
}
}
}

}
}

/**
* A driver class that sorts a given graph in topological order.
*/
public final class KahnsAlgorithm {
private KahnsAlgorithm() {
}

public static void main(String[] args) {
// Graph definition and initialization