最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - How to apply Gephi layouts using Jython - Stack Overflow

programmeradmin2浏览0评论

I'm generating and updating multiples graphs and I'm setting features like text labels, size and color nodes. Besides I need the same process of layout Yifan Hu (It is nice, the best!) and some cases rotates and expand nodes.

However, I had not template to apply, then I tried console plugin Jython. But, I could not to find how to apply layouts.

thanks for any help.

I'm generating and updating multiples graphs and I'm setting features like text labels, size and color nodes. Besides I need the same process of layout Yifan Hu (It is nice, the best!) and some cases rotates and expand nodes.

However, I had not template to apply, then I tried console plugin Jython. But, I could not to find how to apply layouts.

thanks for any help.

Share Improve this question asked Mar 30 at 18:16 TushinTushin 586 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

Sorry guys, but I got something.

I've been trying for a few days but it's gone now.
Applying Yifan Hu layout below:

from .gephi.layout.api import LayoutController, LayoutModel
from .gephi.layout.plugin.force.yifanHu import YifanHu
from .openide.util import Lookup

lc = Lookup.getDefault().lookup(LayoutController)
model = lc.getModel()

yifan_builder = YifanHu()

yifan_layout = model.getLayout(yifan_builder)

yifan_layout.setOptimalDistance(100.0)

lc.setLayout(yifan_layout)

lc.executeLayout(10)

I still need some features like size nodes and colors, but I guess that is easier.

from .openide.util import Lookup
from .gephi.graph.api import GraphController
from .gephi.label.api import LabelController
from java.awt import Color

for node in graph.getNodes():
    node.setSize(20.0)
    node.setColor(Color(80, 100, 180)) # blue
    node.setFixed(False) 

Setting size and color.

发布评论

评论列表(0)

  1. 暂无评论