What are Attribute Relational Graphs? - data-structures

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)

Related

Standard names for "stacked" versus "hanging" layered graph drawing algorithms?

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?).

Arranging nodes-edges for 'good looking' graph layout

I came across following graph layout proposed in the paper NodeTrix :
The big blocks that are visible are nodes themselves (A sort of composite node of a sub-graph).
I see that the edges are some sort of curves which seem to not intersect too much among themselves. Also, the nodes and edges don't intersect among themselves. Paper doen't talk about it btw.
I was hoping to implement this visualization. I have following doubts:
Q1. Is this some specific algorithm to arrange Nodes-Edges so that the graph look good, as shown in this paper ? Any other algorithm in general ?
Q2. Is there some special algorithm for the curved edges shown above as well ?
It would be great if someone could figure out the exact algorithm in the above figure visually, but some general similar algorithm should also do.
One algorithm is Force-directed graph drawing. It will produce an output very different from the posted picture, but it is quite popular and might give you a place to start looking.
To be honest, I suspect that the shown graph is manually laid out.
EDIT: Answer to comment
In the example all nodes are square boxes, and the edges start/end diagonal to the sides of the boxes. A way to to this could be
Place boxes using force-direction (or likely some customized version of it, forces depend on the size of the box)
Imagine a "guide-edge" going directly between the centers of the boxes
Calculate the the places where the guide-edge intersects the boxes, and use that as the start/end points of the real, drawn edge.
Make the real edge start diagonal to the sides, and use bezier curves to draw the curve.
You probably want to represent this as some vector format, that has bezier cures built in, e.g., svg.

algorithm: from adjacency list to visual map

I'm writing a Risk-like board game in java. A feature is that players can design their own maps which they store in a text file. The text file lists all territories (== countries) in the world map followed by their direct neighbors. The game then scans the file and creates a collection of the territories with their corresponding adjacency lists.
The next step would be to translate this graph into a graphical representation. That means I want to represent each territory by a rectangle or some other simple shape. I don't want to go into complex, edgy borders between territories yet. So basically the territories will look like some African or North American nations with horizontal and vertical borders.
Now my problem is: While it would be easy to visualize a graph where the borders are represented by drawn edges between them, I find it difficult to place the territories (== vertices) directly adjacent to each other. In other words the territories should "touch" each other, like in the real world.
In particular, it is difficult because of such places where 4 or more territories border with each other (Consider Four Corners in USA with Arizona, Colorado, New Mexico, and Utah).
Now I was wondering if anybody ever tried to do something similar or if there are even existing algorithms dealing with this problem. I would appreciate any help and creative input. Thanks!
If you can use a graph layout tool like graphviz to get a planar projection of your graph, then you can look into computing the voronoi diagram of the points on your graph, which you could then distort to make things more visually interesting. (You may also need to watch out to make sure that you don't end up changing the adjacency properties when you compute the voronoi diagram, since it depends on the relative spacing of the points. You will probably also have to detect places where an "ocean" cell will have to be inserted in order to make two territories non-adjacent.)
GMap is exactly what I want. They're combining a variety of techniques, including Voronoi diagrams (here's a paper on the algorithm). Now I just have to figure out how to get it...

align graph nodes in several swimlines

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.

Planar Graph Layouts

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.

Resources