blob: f52c4dd5e1fcd481f2c9773e03253607299f7181 [file] [log] [blame]
Andrey Komarov2398d962016-09-26 15:11:23 +03001/*
2 * Copyright 2014-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onlab.graph;
17
18/**
19 * Abstraction of a graph edge weight function.
20 */
21public interface EdgeWeigher<V extends Vertex, E extends Edge<V>> {
22
23 /**
24 * Returns the weight of the given edge.
25 *
26 * @param edge edge to be weighed
27 * @return edge weight
28 */
29 Weight weight(E edge);
30
31 /**
32 * Returns initial weight value (i.e. weight of a "path" starting and
33 * terminating in the same vertex; typically 0 value is used).
34 *
35 * @return null path weight
36 */
37 Weight getInitialWeight();
38
39 /**
40 * Returns weight of a link/path that should be skipped
41 * (can be considered as an infinite weight).
42 *
43 * @return non viable weight
44 */
45 Weight getNonViableWeight();
46}