簡體   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