1 /* ========================================== 2 * JGraphT : a free Java graph-theory library 3 * ========================================== 4 * 5 * Project Info: http://jgrapht.sourceforge.net/ 6 * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh) 7 * 8 * (C) Copyright 2003-2006, by Barak Naveh and Contributors. 9 * 10 * This library is free software; you can redistribute it and/or modify it 11 * under the terms of the GNU Lesser General Public License as published by 12 * the Free Software Foundation; either version 2.1 of the License, or 13 * (at your option) any later version. 14 * 15 * This library is distributed in the hope that it will be useful, but 16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 18 * License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public License 21 * along with this library; if not, write to the Free Software Foundation, 22 * Inc., 23 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 24 */ 25 /* ------------------ 26 * DirectedGraph.java 27 * ------------------ 28 * (C) Copyright 2003-2006, by Barak Naveh and Contributors. 29 * 30 * Original Author: Barak Naveh 31 * Contributor(s): Christian Hammer 32 * 33 * $Id: DirectedGraph.java 504 2006-07-03 02:37:26Z perfecthash $ 34 * 35 * Changes 36 * ------- 37 * 24-Jul-2003 : Initial revision (BN); 38 * 11-Mar-2004 : Made generic (CH); 39 * 07-May-2006 : Changed from List<Edge> to Set<Edge> (JVS); 40 * 41 */ 42 package org.jgrapht; 43 44 import java.util.*; 45 46 47 /** 48 * A graph whose all edges are directed. This is the root interface of all 49 * directed graphs. 50 * 51 * <p>See <a HREF="http://mathworld.wolfram.com/DirectedGraph.html"> 52 * http://mathworld.wolfram.com/DirectedGraph.html</a> for more on directed 53 * graphs.</p> 54 * 55 * @author Barak Naveh 56 * @since Jul 14, 2003 57 */ 58 public interface DirectedGraph<V, E> 59 extends Graph<V, E> 60 { 61 62 //~ Methods --------------------------------------------------------------- 63 64 /** 65 * Returns the "in degree" of the specified vertex. An in degree of a vertex 66 * in a directed graph is the number of inward directed edges from that 67 * vertex. See <a HREF="http://mathworld.wolfram.com/Indegree.html"> 68 * http://mathworld.wolfram.com/Indegree.html</a>. 69 * 70 * @param vertex vertex whose degree is to be calculated. 71 * 72 * @return the degree of the specified vertex. 73 */ 74 public int inDegreeOf(V vertex); 75 76 /** 77 * Returns a set of all edges incoming into the specified vertex. 78 * 79 * @param vertex the vertex for which the list of incoming edges to be 80 * returned. 81 * 82 * @return a set of all edges incoming into the specified vertex. 83 */ 84 public Set<E> incomingEdgesOf(V vertex); 85 86 /** 87 * Returns the "out degree" of the specified vertex. An out degree of a 88 * vertex in a directed graph is the number of outward directed edges from 89 * that vertex. See <a HREF="http://mathworld.wolfram.com/Outdegree.html"> 90 * http://mathworld.wolfram.com/Outdegree.html</a>. 91 * 92 * @param vertex vertex whose degree is to be calculated. 93 * 94 * @return the degree of the specified vertex. 95 */ 96 public int outDegreeOf(V vertex); 97 98 /** 99 * Returns a set of all edges outgoing from the specified vertex. 100 * 101 * @param vertex the vertex for which the list of outgoing edges to be 102 * returned. 103 * 104 * @return a set of all edges outgoing from the specified vertex. 105 */ 106 public Set<E> outgoingEdgesOf(V vertex); 107 } 108