Comments (11)
If you want to see your graph with many different layouts, I pushed a demo called ShowLayoutsWithIO7MGraph to the master branch.
from jungrapht-visualization.
Thanks for your interest!
There are 2 demos:
L2RTreeLayoutDemo
TidierL2RTreeLayoutDemo
The code that maps the layout L2R is this:
vv.getVisualizationModel()
.getLayoutModel()
.getLayoutStateChangeSupport()
.addLayoutStateChangeListener(
evt -> {
if (!evt.active) {
LayoutModel<String> layoutModel = evt.layoutModel;
layoutModel
.getLocations()
.forEach(
(v, p) -> layoutModel.set(v, Point.of(p.y, layoutModel.getWidth() - p.x)));
}
});
If you want to go from right to left, like your example image, change it like this:
.forEach(
(v, p) -> layoutModel.set(v, Point.of(
layoutModel.getHeight() - p.y, p.x)));
from jungrapht-visualization.
Ah, thanks, I'll give it a try!
I've been unable to get any of the demo code to run as the latest Intellij IDEA seems to have serious problems opening the project. For whatever reason, it consistently manages to open the modules in a broken state.
from jungrapht-visualization.
I use Intellij IDEA for development, so I run the demos with it all the time.
I just downloaded the latest version (2022.3.2) and did not have any problems.
To test it everything, I did this:
git clone [email protected]:tomnelson/jungrapht-visualization.git
cd jungrapht-visualization
mvn clean install
After building it, I used File -> Open
and made a new project like this:
from jungrapht-visualization.
Following those exact steps, I get a project that has no Maven modules and no source directories configured:
It's possible to go through and manually set source directories, but notice that it also fails to include any Maven dependencies, and even the "Repair IDE..." option that takes me through a ton of steps to clear indices, reindex, etc, fails in the end.
I've not seen this happen with a Maven project before.
from jungrapht-visualization.
Checking to see if this is still the case on the latest version... ⌛
from jungrapht-visualization.
Mine looks like this, in the maven panel:
You might try invalidating the caches and loading the project again. I can't think of any other things to try.
I've never manually set source directories.
from jungrapht-visualization.
It appears it was a bug with the 2022.2.4
version. It imports fine with 2022.3.2
. Sorry for the noise!
from jungrapht-visualization.
Glad you found a solution.
For what its worth, your question led me to think of a way to change the layout direction within the
jungrapht-layout module. I want the layouts to be independent of the visualization layer and any awt classes, so the layouts can be used with a different rendering system.
The layout algorithms can take an 'after' function (a Runnable) that runs when they are done.
I pushed some changes to the master branch. I think this approach is better.
from jungrapht-visualization.
I'm still working on this, although I've not been able to tune the code sufficiently to get the sort of output I'm looking for yet.
To clarify, I'm working on a patch editor for some audio effects hardware. The signal chain on the hardware is configured as a simple directed graph with a fixed number of possible branches. I wrote a very simple stack-based graph layout algorithm here:
This produces output like this:
This is fine, but there are occasionally graphs for which the algorithm breaks. Rather than try to exhaustively track down every last edge case, I thought it might be a better idea to look at a general purpose graph layout library. I've not yet been able to get jungrapht
to produce graphs that are as compact, but I'll try to post some code when I have something concrete that gets most of the way there. 🙂
Edit: I do my own edge rendering, so I actually only need the vertex positions.
from jungrapht-visualization.
I don't have a layout algorithm that would produce that output. If I had an Orthogonal layout algorithm, it could be close, but you need to make some placement decisions based on the types of the endpoints.
This is the closest I could get, using the EiglspergerLayoutAlgorithm and rotating it:
from jungrapht-visualization.
Related Issues (17)
- Longest Path layering HOT 1
- Compaction Graph integration HOT 1
- Orthogonal Layout HOT 3
- Vertex-rendering HOT 5
- Single Axis Scaling should not scale the 'view' transform HOT 11
- Add better Graph Vertex Clustering support HOT 1
- Create rectangular shaped magnification view lens HOT 1
- Tree Layouts fail to find roots for directed graphs with cycles
- Hi, can this library be used just to get layout coordinates given a dependency graph, which I want to use to layout in a different front end setup? HOT 2
- Sugiyama layout algorithm only seems to work when the application is running with headlessmode = false HOT 2
- Is it possible to get a deterministic calculation of the locations when running e.g. Sugiyama layout algorithm HOT 2
- SugiyamaLayoutAlgorithm performance and visual improvements HOT 2
- Edge Label positioning for articulated edges HOT 1
- Improve CircularLayoutAlgorithm to reduce edge crossing HOT 1
- Add Getter for mass in org.jungrapht.visualization.layout.quadtree.ForceObject HOT 1
- Releases frequency HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jungrapht-visualization.