<commit_before>package com.tinkerpop.furnace.algorithms;

import static org.junit.Assert.assertEquals;

import java.util.Map;

import org.junit.Test;

import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Graph;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.tg.TinkerGraph;

public class DijkstrasAlgorithmTest {

	@Test
	public void dijkstrasSimpleTest() {
		Graph graph = new TinkerGraph();
		Vertex vertex1 = graph.addVertex(null);
		Vertex vertex2 = graph.addVertex(null);
		Vertex vertex3 = graph.addVertex(null);

		Edge edge1 = vertex1.addEdge("TO", vertex2);
		Edge edge2 = vertex2.addEdge("TO", vertex3);

		edge1.setProperty("weight", 1);
		edge2.setProperty("weight", 1);

		DijkstrasAlgorithm da = new DijkstrasAlgorithm(graph);
		Map<Vertex, Long> shortMap = da.compute(vertex1, "weight");
		assertEquals(shortMap.get(vertex1), new Long(0));
		assertEquals(shortMap.get(vertex2), new Long(1));
		assertEquals(shortMap.get(vertex3), new Long(2));
	}

	@Test
	public void dijkstrasSinkTest() {
		Graph graph = new TinkerGraph();
		Vertex vertex1 = graph.addVertex(null);
		Vertex vertex2 = graph.addVertex(null);
		Vertex vertex3 = graph.addVertex(null);

		Edge edge1 = vertex2.addEdge("TO", vertex1);<commit_msg>added test cases<commit_after>package com.tinkerpop.furnace.algorithms;

import static org.junit.Assert.assertEquals;

import java.util.Map;

import org.junit.Test;

import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Graph;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.tg.TinkerGraph;
import com.tinkerpop.furnace.algorithms.shortestpath.DijkstrasAlgorithm;

public class DijkstrasAlgorithmTest {

	@Test
	public void dijkstrasSimpleTest() {
		Graph graph = new TinkerGraph();
		Vertex vertex1 = graph.addVertex(null);
		Vertex vertex2 = graph.addVertex(null);
		Vertex vertex3 = graph.addVertex(null);

		Edge edge1 = vertex1.addEdge("TO", vertex2);
		Edge edge2 = vertex2.addEdge("TO", vertex3);

		edge1.setProperty("weight", 1);
		edge2.setProperty("weight", 1);

		DijkstrasAlgorithm da = new DijkstrasAlgorithm(graph);
		Map<Vertex, Long> shortMap = da.compute(vertex1, "weight");
		assertEquals(shortMap.get(vertex1), new Long(0));
		assertEquals(shortMap.get(vertex2), new Long(1));
		assertEquals(shortMap.get(vertex3), new Long(2));
	}

	@Test
	public void dijkstrasSinkTest() {
		Graph graph = new TinkerGraph();
		Vertex vertex1 = graph.addVertex(null);
		Vertex vertex2 = graph.addVertex(null);
		Vertex vertex3 = graph.addVertex(null);

		Edge edge1 = vertex2.addEdge("TO", vertex1);
{'fraction_non_alphanumeric': 0.12662090007627766, 'fraction_numerical': 0.019832189168573607, 'mean_word_length': 5.5575, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5630949', 'n_tokens_mistral': 939, 'n_tokens_neox': 871, 'n_words': 179}