Annotated Bibliography On Import Java

726 Words3 Pages
/*package adsa;*/

/** * * @author GOPIKRISHN */ import java.util.HashSet; import java.util.Iterator; import java.util.Random; import java.util.Set; import java.util.InputMismatchException;

public class AdjListGraph
{
private int distances[]; private int nodes; public static final int MAX_VALUE = 999; private Set<Integer> visited; private Set<Integer> unvisited; private int adjacencyMatrix[][]; public AdjListGraph(int nodes) //Constructor { this.nodes = nodes; distances = new int[nodes + 1]; visited = new HashSet<Integer>(); unvisited = new HashSet<Integer>(); adjacencyMatrix = new int[nodes + 1][nodes + 1]; } public void Dijkstra(int AdjacencyMatrix[][], int source) { int evaluationNode; for (int i = 1; i <= nodes; i++) for (int j = 1; j <= nodes; j++) adjacencyMatrix[i][j] = AdjacencyMatrix[i][j]; for (int i = 1; i <= nodes; i++) { distances[i] = Integer.MAX_VALUE; } unvisited.add(source); distances[source] = 0; while (!unvisited.isEmpty()) { evaluationNode = getNodeWithMinimumDistanceFromUnvisited(); unvisited.remove(evaluationNode); visited.add(evaluationNode); evaluateNeighbours(evaluationNode); } } private int getNodeWithMinimumDistanceFromUnvisited() { int min ; int

More about Annotated Bibliography On Import Java

Get Access