Skip to content

Instantly share code, notes, and snippets.

View BZHugs's full-sized avatar

JOUET Romain BZHugs

View GitHub Profile
@gennad
gennad / Dijkstra.java
Created January 23, 2011 09:36
Dijkstra algorithm java implementation
import java.util.*;
public class Dijkstra {
// assumes Nodes are numbered 0, 1, ... n and that the source Node is 0
ArrayList<Node> findShortestPath(Node[] nodes, Edge[] edges, Node target) {
int[][] Weight = initializeWeight(nodes, edges);
int[] D = new int[nodes.length];
Node[] P = new Node[nodes.length];
ArrayList<Node> C = new ArrayList<Node>();