本文整理汇总了Java中edu.uci.ics.jung.graph.DelegateForest类的典型用法代码示例。如果您正苦于以下问题:Java DelegateForest类的具体用法?Java DelegateForest怎么用?Java DelegateForest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DelegateForest类属于edu.uci.ics.jung.graph包,在下文中一共展示了DelegateForest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DerivationTreeTransformer
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
public DerivationTreeTransformer(DerivationTree t, Dimension d, boolean isAnchored) {
this.isAnchored = isAnchored;
anchorPoint = new Point2D.Double(0, 0);
graph = t;
DelegateForest<Node, DerivationTreeEdge> del = new DelegateForest<>(t);
del.setRoot(t.root);
del.setRoot(t.sourceRoot);
root = t.root;
sourceRoot = t.sourceRoot;
Y_DIST = d.getHeight() / (2 * (1 + distanceToLeaf(root)));
int leafCount = 0;
for (Node n : t.getVertices()) {
if (t.outDegree(n) == 0) leafCount++;
}
X_DIST = d.getWidth() / leafCount;
treeLayout = new TreeLayout<>(del, (int) Math.round(X_DIST));
}
示例2: backtrack
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
/**
* Initiates CSP-style backtracking search on the meta-CSP.
* @return <code>true</code> iff a set of assignments to all {@link MetaVariable}s which
* satisfies the {@link MetaConstraint}s was found.
*/
public boolean backtrack() {
g = new DelegateForest<MetaVariable,ConstraintNetwork>();
logger.info("Starting search...");
// preBacktrack();
MetaVariable conflict = null;
if ((conflict = this.getConflict()) != null) {
currentVertex = conflict;
if (backtrackHelper(conflict)) {
// postBacktrack();
logger.info("... solution found");
return true;
}
// postBacktrack();
return false;
}
// postBacktrack();
logger.info("... no conflicts found");
return true;
}
示例3: branchAndBound
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
/**
* Perform branch-and-bound search for an optimal solution to this meta-CSP. The cost
* of assignments is defined in the implementing class through the upper/lower-bound getter and
* setter methods.
* @return <code>true</code> iff IRAN: complete this please!
*/
public boolean branchAndBound() {
g = new DelegateForest<MetaVariable,ConstraintNetwork>();
//graph = new ObservableGraph<MetaVariable,ConstraintNetwork>(g);
logger.info("Starting search...");
// preBacktrack();
MetaVariable con = null;
if ((con = this.getConflict()) != null) {
currentVertex = con;
if (branchAndBoundHelper(con)) {
// postBacktrack();
logger.info("... solution found");
return true;
}
// postBacktrack();
return false;
}
// postBacktrack();
logger.info("... no conflicts found");
return true;
}
示例4: clearGraph
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void clearGraph() {
try {
if (this.graph == null) {
this.graph = new DelegateForest();
return;
}
Collection collection = this.graph.getRoots();
Iterator iCollection = collection.iterator();
while (iCollection.hasNext()) {
AbstractEntity entity = (AbstractEntity) iCollection.next();
if (entity != null) {
this.graph.removeVertex(entity);
}
}
} catch (Exception exc) {
this.graph = new DelegateForest();
}
}
示例5: createGraph
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
@Override
public Graph<String, String> createGraph() {
// edu.uci.ics.jung.graph.Tree<String,String> treeGraph = new DelegateTree<String,String>();
DirectedOrderedSparseMultigraph<String, String> treeGraph = new DirectedOrderedSparseMultigraph<String, String>();
Tree root = this.model.getRoot();
treeGraph.addVertex("Root");
vertexMap.put("Root", root);
addTree(treeGraph, root, "Root");
return new DelegateForest<String, String>(treeGraph);
// return treeGraph;
}
示例6: debug
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public String debug(IGraph<?, ?> graph) {
String ret = super.debug(graph);
if (graph instanceof DelegateForest) {
ret += StringUtil.SPACER + StringUtil.SPACER + "PARENT: " + ((DelegateForest)graph).getParent(this) + "\n";
}
return (ret);
}
示例7: factory
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
public static <V, E> GraphVisualizationPanel<V, E> factory(Graph<V, E> graph) {
Layout<V, E> layout = null;
if (graph instanceof DelegateForest) {
layout = new TreeLayout<V, E>((Forest<V, E>) graph);
} else if (graph instanceof MarkovGraph){
layout = new FRLayout<V,E>(graph);
} else if (graph instanceof ConflictGraph){
layout = new KKLayout<V, E>(graph);
} else if (graph instanceof AbstractDirectedGraph) {
layout = new DAGLayout<V, E>(graph);
} else {
layout = new CircleLayout<V, E>(graph);
}
return (new GraphVisualizationPanel<V, E>(layout, graph));
}
示例8: convertq
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
/**
* @see #convertq(edu.uci.ics.jung.graph.DirectedGraph, java.lang.Object)
*
* @param graph
* @param roots
* @return
*/
public Forest<V, E> convertq( DirectedGraph<V, E> graph, Collection<V> roots ) {
DelegateForest<V, E> newforest = new DelegateForest<>();
for ( V root : roots ) {
newforest.addTree( convertq( graph, root ) );
}
return newforest;
}
示例9: convert
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
public Forest<V, E> convert( DirectedGraph<V, E> graph, Collection<V> roots ) throws TreeConversionException {
DelegateForest<V, E> newforest = new DelegateForest<>();
for ( V root : roots ) {
newforest.addTree( convert( graph, root ) );
}
return newforest;
}
示例10: createGraph
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
@Override
public Graph<String, String> createGraph() {
DirectedOrderedSparseMultigraph<String, String> treeGraph = new DirectedOrderedSparseMultigraph<String, String>();
Tree root = this.model.getRoot();
treeGraph.addVertex("Root");
vertexMap.put("Root", root);
addTree(treeGraph, root, "Root", new ArrayList<>());
return new DelegateForest<String, String>(treeGraph);
}
示例11: createTree
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
/**
*
*/
private void createTree() {
// create a simple graph for the demo
graph = new DelegateForest<String,Integer>();
graph.addVertex(ComponentTreeCellRenderer.getFullTitle(sample, false));
/*graph.addEdge(edgeFactory.create(), "V0", "V1");
graph.addEdge(edgeFactory.create(), "V0", "V2");
graph.addEdge(edgeFactory.create(), "V1", "V4");
graph.addEdge(edgeFactory.create(), "V2", "V3");
graph.addEdge(edgeFactory.create(), "V2", "V5");
graph.addEdge(edgeFactory.create(), "V4", "V6");
graph.addEdge(edgeFactory.create(), "V4", "V7");
graph.addEdge(edgeFactory.create(), "V3", "V8");
graph.addEdge(edgeFactory.create(), "V6", "V9");
graph.addEdge(edgeFactory.create(), "V4", "V10");
graph.addVertex("A0");
graph.addEdge(edgeFactory.create(), "A0", "A1");
graph.addEdge(edgeFactory.create(), "A0", "A2");
graph.addEdge(edgeFactory.create(), "A0", "A3");
graph.addVertex("B0");
graph.addEdge(edgeFactory.create(), "B0", "B1");
graph.addEdge(edgeFactory.create(), "B0", "B2");
graph.addEdge(edgeFactory.create(), "B1", "B4");
graph.addEdge(edgeFactory.create(), "B2", "B3");
graph.addEdge(edgeFactory.create(), "B2", "B5");
graph.addEdge(edgeFactory.create(), "B4", "B6");
graph.addEdge(edgeFactory.create(), "B4", "B7");
graph.addEdge(edgeFactory.create(), "B3", "B8");
graph.addEdge(edgeFactory.create(), "B6", "B9");*/
}
示例12: draw
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
public static void draw(DelegateForest<MetaVariable,ConstraintNetwork> graph) {
SearchTreeFrame stf = new SearchTreeFrame(graph);
stf.setTitle(SearchTreeFrame.class.getSimpleName());
stf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
stf.pack();
stf.setVisible(true);
}
示例13: MetaConstraintSolver
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
protected MetaConstraintSolver(Class<?>[] constraintTypes, long animationTime, ConstraintSolver ... internalSolvers) {
super(constraintTypes, MetaVariable.class, internalSolvers, null);
g = new DelegateForest<MetaVariable,ConstraintNetwork>();
this.animationTime = animationTime;
this.resolvers = new HashMap<ConstraintNetwork,ConstraintNetwork>();
this.metaVarsToMetaCons= new HashMap<ConstraintNetwork, MetaConstraint>();
this.resolversInverseMapping = new HashMap<ConstraintNetwork,ConstraintNetwork>();
this.counterMoves=0;
}
示例14: failurePruning
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
public void failurePruning(int failure_time){
super.failurePruning(failure_time);
this.counterMoves=0;
this.g=new DelegateForest<MetaVariable,ConstraintNetwork>();
this.resolvers.clear();
this.metaVarsToMetaCons.clear();
}
示例15: initGraph
import edu.uci.ics.jung.graph.DelegateForest; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void initGraph() {
try {
labelMap = new HashMap();
iconMap = new HashMap();
graph = new DelegateForest();
treeLayout = new TreeLayout(graph);
balloonLayout = new BalloonLayout(graph);
vv = new VisualizationViewer(balloonLayout);
vv.setSize(new Dimension(800, 800));
refreshGraph();
vv.setBackground(Color.white);
vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.setVertexToolTipTransformer(new EntityTransformer());
graphPanel = new GraphZoomScrollPane(vv);
DefaultModalGraphMouse mouse = new DefaultModalGraphMouse();
vv.setGraphMouse(mouse);
mouse.add(new MemoriaGraphMouse(this));
// T O D O MemoriaPanel compile error suppress 2 lines
//VertexStringerImpl localVertexStringerImpl = new VertexStringerImpl(/*this.labelMap*/);
//this.vv.getRenderContext().setVertexLabelTransformer(new VertexStringerImpl(/*localVertexStringerImpl*/));
VertexIconShapeTransformer transformer = new VertexIconShapeTransformer(new EllipseVertexShapeTransformer());
DefaultVertexIconTransformer iconTransformer = new DefaultVertexIconTransformer();
transformer.setIconMap(iconMap);
iconTransformer.setIconMap(iconMap);
vv.getRenderContext().setVertexShapeTransformer(transformer);
vv.getRenderContext().setVertexIconTransformer(iconTransformer);
} catch (Exception exc) {
SbApp.error("MemoriaPanel.initGraph()",exc);
}
}