Search code examples
layoutgraphjung

jung ObservableCachingLayout vs staticLayout


i m trying to get the x and y cordinate from the layout but when geting the layout from a VisualizationViewer the returned type is not staticLayout but ObservableCachingLayout (of course it couldn't be casted to static). Is there a way to get the staticlayout from a VisualizationViewer ? Or a way to get the x and y from the viz ? thx


Solution

  • To get the x and y coordinate from the Layout, you call layout.transform(vertex). (A Layout is a Transformer from vertices to Point objects.)

    StaticLayout is an instance of Layout that allows the user to easily specify the coordinates of each vertex; it's intended for the case in which you already have coordinates and don't need an algorithm to determine them.