本文整理匯總了Java中edu.uci.ics.jung.graph.Graph.removeEdge方法的典型用法代碼示例。如果您正苦於以下問題:Java Graph.removeEdge方法的具體用法?Java Graph.removeEdge怎麽用?Java Graph.removeEdge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edu.uci.ics.jung.graph.Graph
的用法示例。
在下文中一共展示了Graph.removeEdge方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: reverseEdges
import edu.uci.ics.jung.graph.Graph; //導入方法依賴的package包/類
/**
* This method reverse the path "path" in the graph "graph" and returns it.
*
* @param graph
* the input graph which will not be changed.
* @param path
* the path to reverse
* @return a new graph with the reversed path
*/
private Graph<V, E> reverseEdges(Graph<V, E> graph, List<E> path) {
if (graph == null || path == null)
throw new IllegalArgumentException();
Graph<V, E> clone = new DirectedOrderedSparseMultigraph<V, E>();
for (V v : graph.getVertices())
clone.addVertex(v);
for (E e : graph.getEdges())
clone.addEdge(e, graph.getEndpoints(e));
for (E link : path) {
V src = clone.getSource(link);
V dst = clone.getDest(link);
clone.removeEdge(link);
clone.addEdge(link, dst, src, EdgeType.DIRECTED);
}
return clone;
}