當前位置: 首頁>>代碼示例>>Java>>正文


Java EdgeRejectedException類代碼示例

本文整理匯總了Java中org.graphstream.graph.EdgeRejectedException的典型用法代碼示例。如果您正苦於以下問題:Java EdgeRejectedException類的具體用法?Java EdgeRejectedException怎麽用?Java EdgeRejectedException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EdgeRejectedException類屬於org.graphstream.graph包,在下文中一共展示了EdgeRejectedException類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addEdge

import org.graphstream.graph.EdgeRejectedException; //導入依賴的package包/類
/**
    * Fügt eine Kante dem Graphen hinzu
    * @param 	source			Quellknoten
    * @param 	destination		Zielknoten
    */
public synchronized void addEdge(FacebookProfile source, 
		FacebookProfile destination) {
	try {
		this.graph.addEdge(
				source.getUserID() + "--" + destination.getUserID(),
				source.getUserID(), destination.getUserID());
	} catch (IdAlreadyInUseException | ElementNotFoundException
			| EdgeRejectedException err) {
		if (FacePath.DEBUG >= 4) {
			err.printStackTrace();
		}
	}
}
 
開發者ID:fabiogermann,項目名稱:zhaw-facepath,代碼行數:19,代碼來源:FacebookNetwork.java

示例2: runPartition

import org.graphstream.graph.EdgeRejectedException; //導入依賴的package包/類
/**
 * Performs the partitioning of the graph given by the {@link FileInputStream} in the constructor.
 * It first tries to read the number of nodes and edges that the graph should contains, then starts
 * loading and partitioning the graph according to the {@link SGPHeuristic} given in the constructor.
 * For every node that load in the stream, it retrieve the partition in which it should be and then 
 * assign the node to the partition and write this information on the {@link FileOutputStream} given to
 * the constructor.
 * @throws IOException 
 * @throws EdgeRejectedException 
 * @throws ElementNotFoundException 
 * @throws IdAlreadyInUseException 
 */
public void runPartition() throws IdAlreadyInUseException, ElementNotFoundException, EdgeRejectedException, IOException {

	nodeNumbers = -1;
	edgeNumbers = -1;
	Integer nodeCount = 1;

	//read the first line
	//go on until there are no comments
	String line = "";
	readFirstLine();
	
	if (!thereIsC) {
		capacity = (int)Math.ceil((double)(nodeNumbers)/K);//+1;
	}
	//create graph
	this.graphPartitionator = new StreamingGraphPartitionator(K, heuristic, capacity);
	this.gr = graphPartitionator.getGraph();
	//read the whole graph
	
	while((line = scanner.readLine()) != null) {
		
		line = line.trim();
		if (line.startsWith("%")) { //it is a comment
			continue;
		}

		Long startTime = System.currentTimeMillis();
		String[] nNodes = line.split(" ");
		Node v = gr.addNode(Integer.toString(nodeCount++));
		gr.addNode(v.getId());

		for (String s : nNodes) {
			gr.addNode(s);
			gr.addEdge(v.getId()+"-"+s, v.getId(), s);
		}
		int uPartition = graphPartitionator.getPartitionNode(v);
		Long endTime = System.currentTimeMillis();
		partTime += (endTime - startTime);
		printerOut.println(uPartition);
	}

	printerOut.flush();
	printerOut.close();
	scanner.close();
}
 
開發者ID:isislab-unisa,項目名稱:streaminggraphpartitioning,代碼行數:58,代碼來源:SimpleGraphLoader.java


注:本文中的org.graphstream.graph.EdgeRejectedException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。