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 badges2 Answers
Reset to default 0Sorry 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.