graphstream/gs-core

Graph styling, unable to find documented method

Closed this issue · 2 comments

Hi,
I'm trying to style nodes in such a way that their size is proportional to some property (harmonic centrality, or degree, or just their index).
I'm following the guide at https://graphstream-project.org/doc/Tutorials/Graph-Visualisation/, but the Graph interface does not expose any addAttribute method to set the CSS. I can only add sinks.

What is the quickest method to add a different size (and color, maybe) to a node? Thanks

pigne commented

Docs are being updated. addAttribute was an alias to setAttribute and as been removed in 2.0. Just replace addAttribute with setAttribute.

Thanks!
I was also able to set attributes node by node. The CSS attribute is ui.style, so in order to set nodes as big as their edge count, one way is:

graph.forEach { it.setAttribute("ui.style", "size: ${it.edges().count()}px;") }