本文整理匯總了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();
}
}
}
示例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();
}