Wiki‎ > ‎

Network Visualization Techniques

There are many algorithms for creating pleasant visual networks representations. These network visualization techniques allow gaining insight into the network structure by placing nodes according to the topology of the network. NOESIS implements several network layout algorithms under the noesis.algorithms.visualization package. This sections is devoted to describing these techniques and providing examples of how to use them.

Applying a network layout

NOESIS provides several network visualization techniques under a unique interface defined by NetworkLayout. These implementations provide two layout methods. On the one hand, a layout method that only takes the network and assumes that node coordinates are encoded in two node attributes, named x and y. For example, in order to apply a hierarchical layout using this method, we would write the following code:
AttributeNetwork network = new AttributeNetwork();
HierarchicalLayout layout = new HierarchicalLayout();
layout.layout(network);

On the other hand, a layout method that takes the network and two node attributes, where the computed coordinates will be stored. The previous example, using this alternative, would be written as follows:
AttributeNetwork network = new AttributeNetwork();
Attribute<Double> x = new Attribute<Double>("x");
Attribute<Double> y = new Attribute<Double>("y");
HierarchicalLayout layout = new HierarchicalLayout();
layout.layout(network, x, y);

Creating a custom network layout

New network layouts can be implemented by extending the NetworkLayout class. Extending this class only requires implementing the layout method, which takes the network for which to compute the layout and the pair of node attributes where the obtained coordinates must be stored. A template for a custom layout would look as follows:
public class MyLayout extends NetworkLayout {

    @Override
    public void layout(AttributeNetwork network, Attribute<Double> x, Attribute<Double> y) {
        // Implement your layout here. Computed coordinates must be stored in x and y
        ...
    }

}

Creating a custom iterative network layout

Many layout algorithms are iterative and follow a similar structure. NOESIS simplifies their implementation by providing the IterativeNetworkLayout class. The interface provided by IterativeNetworkLayout requires implementing each of the stages separately. The init method is used for initializing the resources used by the implemented network layout algorithm. The actions performed in each iteration are implemented in the iterate method. These actions are repeated until a stop condition is met. This conditions is implemented using the stop method, which returns true is the layout has finished or false otherwise. Finally, the end method is used for releasing the resources used by the technique. The following code snippet shows a template for a custom iterative layout algorithm:
public class MyIterativeLayout extends IterativeNetworkLayout {
    /* NOTE: The network and the coordinate attributes are available in the protected members "network", "x", and "y", respectively. */
    @Override     public void init() {         // Initialize the resources used by the layout here         ...     }
    @Override
    public void iterate() {
        // Perform a layout iteration here
        ...
    }
    @Override     public boolean stop() { // Check if the algorithm has converged or finished here. Return true if converged, false otherwise return <true or false>;     }     @Override     public void end() { // Free the resources used by the layout here ...     } }

Supported network visualization techniques


Fruchterman-Reingold layout

The Fruchterman-Reingold technique is a force-directed layout algorithm, which models a physical system with attractive and repulsive forces between nodes. This physical system is iteratively updated until converge, when the system reaches an equilibrium state and nodes do not change their position between iterations. The following example shows how to compute a Fruchterman-Reingold layout for a given network with attributes:
AttributeNetwork network = ...
FruchtermanReingoldLayout layout = new FruchtermanReingoldLayout();
layout.layout(network);
Fruchterman-Reingold layout


Kamada-Kawai layout

The Kamada-Kawai layout is another force-directed graph layout technique. This approach minimizes the total energy of the simulated physical model by solving a system of partial differential equations using the Network-Raphson method and updating a node each time. An example of applying this layout technique is shown in the following code fragment:
AttributeNetwork network = ...
KamadaKawaiLayout layout = new KamadaKawaiLayout();
layout.layout(network);
Kamada-Kawai layout


Radial layout

A radial layout arranges nodes in different concentric rings starting from a root node. When the network has different components, a virtual root node is created and connected to each component real root. This layout supports different strategies for choosing the root node through the interface provided by SelectionStrategy. Currently, NOESIS provides two different strategies: the node with minimal average path length to other nodes, using MinAveragePathLengthSelectionStrategy, and the node with minimal eccentricity, using MinEccentricitySelectionStrategy. The following example shows how to compute a radial layout using the strategy based on minimal average path length:
AttributeNetwork network = ...
SelectionStrategy selectionStrategy = new MinAveragePathLengthSelectionStrategy();
RadialLayout layout = new RadialLayout(selectionStrategy);
layout.layout(network);
Radial layout


Hierarchical layout

In the hierarchical layout, nodes are arranged in different stacked layers composing a hierarchy. The ordering of the nodes within each layer is chosen to minimize the number of crossing links between layers. This layout can be applied to a network as shown in the following example:
AttributeNetwork network = ...
HierarchicalLayout layout = new HierarchicalLayout();
layout.layout(network);
Hierarhical layout


Regular layouts

NOESIS includes several regular network layouts, which are specially useful when dealing with regular networks. This section describes the different implemented techniques and how to use them.

Circular layout

In a circular layout, nodes are arraged in a circle or ring. This layout can be used as follows:
AttributeNetwork network = ...
CircularLayout layout = new CircularLayout();
layout.layout(network);
Circular layout


Star layout

The star layout is similar to the circular layout, but a node is placed in the center of the circle, creating a star. This layout can be applied as shown below:
AttributeNetwork network = ...
StarLayout layout = new StarLayout();
layout.layout(network);
Star layout



Mesh layout

The mesh layout arranges nodes in a grid-like structure. An example using this layout is shown below:
AttributeNetwork network = new AttributeNetwork();
MeshLayout layout = new MeshLayout();
layout.layout(network);
Mesh layout


Hypercube layout

The hypercube layout places the nodes as they were the corners of a hypercube embedded in a two-dimensional space. This layout can be used as follows:
AttributeNetwork network = new AttributeNetwork();
HypercubeLayout layout = new HypercubeLayout();
layout.layout(network);
Hypercube layout


Binary tree layout

The binary tree layout arranges nodes in different layers, similar to the hierarchical layout. However, in this case, the number of nodes in a layer is twice the number of nodes in the previous layer. The binary tree layout can be applied as shown below:
AttributeNetwork network = new AttributeNetwork();
BinaryTreeLayout layout = new BinaryTreeLayout();
layout.layout(network);
Binary tree layout


Toroidal layout

A toroidal layout places nodes in a grid-like structure, which would cover a torus. This layout is applied as follows:
AttributeNetwork network = new AttributeNetwork();
ToroidalLayout layout = new ToroidalLayout();
layout.layout(network);
Toroidal layout


Linear layout

The linear layout arranges nodes in a straight line. This layout can be applied as shown in the following code snippet.
AttributeNetwork network = new AttributeNetwork();
LinearLayout layout = new LinearLayout();
layout.layout(network);
Linear layout


Comments