⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graph.java

📁 peersim最新版1.0.4
💻 JAVA
字号:
/* * Copyright (c) 2003-2005 The BISON Project * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */package peersim.graph;import java.util.Collection;/*** A general graph interface. It follows the following model:* the graph has n nodes which are indexed from 0 to n-1.* The parameters of operators refer to indices only.* Implementations might return objects that represent the* nodes or edges, although this is not required.** Undirected graphs are modelled by the interface as directed graphs in which* every edge (i,j) has a corresponding reverse edge (j,i).*/public interface Graph {	/**	* Returns true if there is a directed edge between node i	* and node j.	*/	boolean isEdge(int i, int j);	/**	* Returns a collection view to all outgoing edges from	* i. The collection should ideally be unmodifiable.	* In any case, modifying the returned collection is not safe and	* may result in unspecified behavior.	*/	Collection<Integer> getNeighbours(int i);	/**	* Returns the node object associated with the index. Optional	* operation.	*/	Object getNode(int i);		/**	* Returns the edge object associated with the index. Optional	* operation.	*/	Object getEdge(int i, int j);	/**	* The number of nodes in the graph.	*/	int size();	/**	* Returns true if the graph is directed otherwise false.	*/	boolean directed();	/**	* Sets given edge, returns true if it did not exist before.	* If the graph is	* undirected, sets the edge (j,i) as well. Optional operation.	*/	public boolean setEdge(int i, int j);	/**	* Removes given edge, returns true if it existed before. If the graph is	* undirected, removes the edge (j,i) as well. Optional operation.	*/	public boolean clearEdge(int i, int j);	/**	* Returns the degree of the given node. If the graph is directed,	* returns out degree.	*/	public int degree(int i);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -