I want to align certain graph nodes into several 'lanes' like this
(source: jiscinfonet.ac.uk)
Any suitable algorithms (like force-based algorithms in general graph drawing)?
You can coerce GraphViz to draw what you want, and you should be able to call the libraries fairly easily. The homepage of their site has some useful references on the algorithms used.
Related
Here are two different ways of drawing the same hierarchy. Notice that in the "stacked" layout, nodes are always one layer higher than their highest "child" node. (Important: See edit at bottom of question for another example)
Do these two types of layered drawing methods have specific names? I'm trying to find existing algorithms for the "stacked" one, but can't seem to surface any info because I don't know what it's called.
If they don't have names to distinguish them because they rely on the same algorithm, are there well known sets of parameters for attaining the "stacked" version of the graph with existing algorithms? Thanks!
Edit: Although the above graphs are strict "trees", the algorithm I'm looking for should be able to handle cases where nodes have more than one parent, and cases where there is more than one path from root to leaf. Here's an example, and here's another.
Edit2: In case it's useful to anyone, a hacky (and slow) force-directed approach with pre-computed node layers (y-axis contraints) seems to work all right. Here's what it looks like. That example uses cytoscape.js and cola.js, and it's upside down. It's not at all a solution to this question so I'm just putting this here as an edit.
(SO wouldn't let me submit the JSBin link without a code block...)
I don't know of any specific names for the above. It looks like the layering algorithm in both cases is the longest path algorithm that minimizes height but essentially ignores width. If you layer the graph from the bottom-up and the graph has many sinks (vertices with zero out-degree) then you will get a wide bottom layer (a "stacked" layout?). If you layer the graph from the top-down and it has many sources (vertices with zero in-degree) then you will get a wide top layer (a "hanging" layout?).
I'm looking for a one-pass algorithm (or ideas of how to write it myself) that can calculate the two or three dimensional coordinates for a directed, unweighted graph.
The only metadata the vertices have are title and category.
I need to implement this algorithm in a way that vertices can be added/removed without recalculating the entire graph structure.
This algorithm has to be applied to a large (5gb) dataset which is constantly changing.
My Google skills have led me to n-pass algorithms which are not what what I am looking for.
I guess your question might still be an open issue. I know a research project called Tulip (http://tulip.labri.fr/TulipDrupal/) which is a (large-scale) graph viewer. A paper on the method is available at http://dept-info.labri.fr/~auber/documents/publi/auberChapterTulipGDSBook.pdf and surely you can find more algorithms browsing the personal web page of D. Auber and his colleagues.
There is a related question here:
https://cstheory.stackexchange.com/questions/11889/an-algorithm-to-efficiently-draw-a-extremely-large-graph-in-real-time
The top answer has a number of papers that might be of interest. I think one of the keys to the problem is to try and recompute the location of a reduced amount of nodes in your graph.
Are there any algorithms to minimize edge crossings in a graph? For example if I have a transition matrix of the graph.
I found methods like trying to place the nodes around the other node, but I'd like to know some other ideas.
There's a range of well established algorithms/libraries that have been developed for graph drawing applications, you can get a bit of background here.
To draw undirected graphs a popular choice is the force-based layout algorithm, in which graph edges are treated as springs (attractive forces) while the vertices are treated like charged particles (applying repulsive forces). The algorithm works by updating the vertex positions based on these forces until a steady-state is reached. You can read more about force based methods here. Since these algorithms search for an equilibrium solution they often result in pseudo-optimal layouts, without much edge tangling.
You might be interested in making use of one of the many graph drawing libraries that are available. The Graphviz package is generally pretty good and supports a number of different algorithms for different graph drawing applications.
What kind of data structures are these? Can someone please point out any links or books where I can read more about them.
You can also check out this paper. From DVK's answer and that link, it sounds like they're normal graphs, but with "attributes" on the nodes and edges. For example, if you were trying to build an image processor, you might initially construct a graph where each node represents a distinctly colored region (say, a person's face vs. their shirt) and then edges represent visual adjacency (likely, a person's head/neck is adjacent to both their shirt and the background of the image).
Then, you would assign attributes to the graph elements. The attribute for each region (node) could be its predominant color, and the attribute for each edge would be how much of their circumference the respective regions share.
As a different example, you a colored graph with edge weights is a simple example of an attributed graph.
Perhaps I could be more helpful with a little more information about why you're looking into ARGs, since they're defined pretty generally.
An explanation can be found in the paper titled "Recognition of shapes by morphological
attributed relational graphs", in the beginning of section "3 Generating the attributed relational graph"
In addition, Doxygen doc on an implementation can be found here:
http://brainvisa.info/doc/graph-3.2/doxygen/classGraph.html
The right url for the Doxygen doc on an implementation:
http://brainvisa.info/doc/graph-4.2/doxygen/classGraph.html
(graph-4.2 rather than graph-3.2)
What are some edge overlap minimization techniques when laying out a graph? (Preferably related to GraphViz) Also are there any existing software that can layout a graph in a planar fashion?
Current Layout - http://www.evecakes.com/doodles/master.gif
The pink section in the upper left hand corner looks fine while the light blue section has some avoidable edge overlaps.
For general graphs, the problem of a determining a planar layout of a graph with least edges crossing (the Crossing Number) is NP-hard. So some heuristic methods are used (like the Force based layout algorithms).
The page below briefly describes the graphviz algorithms and suggests some ways to use them for benefit. It also has links to the pdfs which should contain more information about the algorithms:
http://rss.acs.unt.edu/Rdoc/library/Rgraphviz/html/GraphvizLayouts.html
Hope that helps.
The following open source Java library has a couple of algorithms which may help in laying out planar graphs.
https://github.com/trickl/trickl-graph
In particular, the following classes provide analytic solutions to the problem:
ChrobakPayneLayout (based on the Boost C++ implementation by Aaron Windsor)
http://www.boost.org/doc/libs/1_37_0/libs/graph/doc/straight_line_drawing.html
FoldFreeLayout (based on Anchor-Free Distributed Localization in Sensor Networks
Nissanka B. Priyantha, Hari Balakrishnan, Erik Demaine, and Seth Teller)
What you might want to do is use something like this as the first "attempt" which ensures no overlaps, although may not look great. Then you can apply a force-directed algorithm to space out the nodes more fairly.
Unfortunately, the library has only just been released so is short on documentation. It might however be useful by providing some actual code rather than just theory.