File: Distance.java

package info (click to toggle)
geogebra 4.0.34.0%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 23,680 kB
  • sloc: java: 221,001; xml: 786; sh: 116; makefile: 26
file content (41 lines) | stat: -rw-r--r-- 1,186 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * Created on Apr 2, 2004
 *
 * Copyright (c) 2004, the JUNG Project and the Regents of the University 
 * of California
 * All rights reserved.
 *
 * This software is open-source under the BSD license; see either
 * "license.txt" or
 * http://jung.sourceforge.net/license.txt for a description.
 */
package edu.uci.ics.jung.algorithms.shortestpath;

import java.util.Map;


/**
 * An interface for classes which calculate the distance between
 * one vertex and another.
 * 
 * @author Joshua O'Madadhain
 */
public interface Distance<V>
{
    /**
     * Returns the distance from the <code>source</code> vertex 
     * to the <code>target</code> vertex.  If <code>target</code> 
     * is not reachable from <code>source</code>, returns null.
     */ 
     Number getDistance(V source, V target);

    /**
     * <p>Returns a <code>Map</code> which maps each vertex 
     * in the graph (including the <code>source</code> vertex) 
     * to its distance (represented as a Number) 
     * from <code>source</code>.  If any vertex 
     * is not reachable from <code>source</code>, no 
     * distance is stored for that vertex.
     */
     Map<V,Number> getDistanceMap(V source);
}