本文整理汇总了Java中org.jgrapht.graph.Pseudograph类的典型用法代码示例。如果您正苦于以下问题:Java Pseudograph类的具体用法?Java Pseudograph怎么用?Java Pseudograph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pseudograph类属于org.jgrapht.graph包,在下文中一共展示了Pseudograph类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GKAGraph
import org.jgrapht.graph.Pseudograph; //导入依赖的package包/类
private GKAGraph(GraphType type){
this.type = type;
// Choose if it will be directed or undirected
if (isDirected()){
jGraph = new ListenableDirectedGraph<>(new DirectedPseudograph<>(GKAEdge.class));
}else{
jGraph = new ListenableUndirectedGraph<>(new Pseudograph<>(GKAEdge.class));
}
// JGXAdapter for showing the Graph in Swing
mxgraph = new JGraphXAdapter<>(getjGraph());
// Changing EdgeStyle when is undirected
if (!isDirected()){
getMxgraph().getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_ENDARROW, "none");
}
setGraphConfig();
}
示例2: Graph
import org.jgrapht.graph.Pseudograph; //导入依赖的package包/类
public Graph(GeometryCollection lines) {
graph = new Pseudograph<>(LineString.class);
int nLines = lines.getNumGeometries();
for (int i = 0; i < nLines; i++) {
LineString line = (LineString) lines.getGeometryN(i);
addEdge(line);
}
fixConnectivity();
assert (testConnectivity());
}
示例3: DataSet
import org.jgrapht.graph.Pseudograph; //导入依赖的package包/类
/**
* Base constructor.
*/
public DataSet() {
this.superNetwork = new Variable<SuperNetwork>(new SuperNetwork(null, new Pseudograph<HNode, DefaultEdge>(DefaultEdge.class)));
this.nodeMap = new Variable<Map<CyNode, HNode>>(new HashMap<CyNode, HNode>());
this.minScore = new Variable<Double>(0.);
this.maxScore = new Variable<Double>(1.);
this.categories = new Variable<Map<String, HCategory>>(new HashMap<String, HCategory>());
this.setMap = new Variable<Map<CyNode, HSet>>(new HashMap<CyNode, HSet>());
}
示例4: Model
import org.jgrapht.graph.Pseudograph; //导入依赖的package包/类
public Model() {
this.selection = new Selection(this);
this.openedCategories = new VolatileSet<HCategory>();
this.orderedCategories =
new Variable<List<HCategory>>(Collections.<HCategory>emptyList());
this.highlightedProteins = new VolatileSet<HNode>();
this.highlightedInteractions = new VolatileSet<DefaultEdge>();
this.highlightedSets = new VolatileSet<HSet>();
this.activeNetwork = new Variable<Network>(new SuperNetwork(null,
new Pseudograph<HNode, DefaultEdge>(DefaultEdge.class)));
this.selectionMode = Constants.Selection.NONE;
}
示例5: step1
import org.jgrapht.graph.Pseudograph; //导入依赖的package包/类
/**
* Construct the complete undirected distance graph G1=(V1,EI,d1) from G and S.
* @return
*/
private Pseudograph<Node, DefaultLink> step1() {
logger.debug("<enter");
Pseudograph<Node, DefaultLink> g =
new Pseudograph<Node, DefaultLink>(DefaultLink.class);
for (Node n : this.steinerNodes) {
g.addVertex(n);
}
BellmanFordShortestPath<Node, DefaultLink> path;
for (Node n1 : this.steinerNodes) {
path = new BellmanFordShortestPath<Node, DefaultLink>(this.graph, n1);
for (Node n2 : this.steinerNodes) {
if (n1.equals(n2))
continue;
if (g.containsEdge(n1, n2))
continue;
DefaultLink e = new DefaultLink();
g.addEdge(n1, n2, e);
g.setEdgeWeight(e, path.getCost(n2));
}
}
logger.debug("exit>");
return g;
}
示例6: step2
import org.jgrapht.graph.Pseudograph; //导入依赖的package包/类
/**
* Find the minimal spanning tree, T1, of G1. (If there are several minimal spanning trees, pick an arbitrary one.)
* @param g1
* @return
*/
private WeightedMultigraph<Node, DefaultLink> step2(Pseudograph<Node, DefaultLink> g1) {
logger.debug("<enter");
KruskalMinimumSpanningTree<Node, DefaultLink> mst =
new KruskalMinimumSpanningTree<Node, DefaultLink>(g1);
// logger.debug("Total MST Cost: " + mst.getSpanningTreeCost());
Set<DefaultLink> edges = mst.getEdgeSet();
WeightedMultigraph<Node, DefaultLink> g2 =
new WeightedMultigraph<Node, DefaultLink>(DefaultLink.class);
List<DefaultLink> edgesSortedById = new ArrayList<DefaultLink>();
for (DefaultLink e : edges)
edgesSortedById.add(e);
Collections.sort(edgesSortedById);
for (DefaultLink edge : edgesSortedById) {
g2.addVertex(edge.getSource());
g2.addVertex(edge.getTarget());
g2.addEdge( edge.getSource(), edge.getTarget(), edge);
}
logger.debug("exit>");
return g2;
}