繁体   English   中英

如何在TreeLayout JUNG中更改边的长度?

[英]How to change the length of an edge in TreeLayout JUNG?

我知道如何更改顶点的大小,但是当我这样做时,TreeLayout会放置节点,以使边缘消失,即。 节点重叠且边缘不可见。 如果更改布局(更改为KKLayout),则边缘会自动变大,并且图形看起来很干净。 我想知道是否可以在TreeLayout本身中将节点隔开/增加边缘的长度? (任何其他维护树层次结构的建议也都不错)

构造TreeLayout时,可以定义节点之间的空间。 这将增加边缘长度:

TreeLayout treeLayout = new TreeLayout<String, Integer>(graph, 500, 500);

如果不输入distxdisty的值,则默认为50。构造函数:

/**
 * Creates an instance for the specified graph, X distance, and Y distance.
 */
public TreeLayout(Forest<V,E> g, int distx, int disty) {
    if (g == null)
        throw new IllegalArgumentException("Graph must be non-null");
    if (distx < 1 || disty < 1)
        throw new IllegalArgumentException("X and Y distances must each be positive");
    this.graph = g;
    this.distX = distx;
    this.distY = disty;
    buildTree();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM