sfdp
Layout directed graphs
TLDR
Render a PNG image with a filename based on the input filename and output format (uppercase -O)
Render a SVG image with the specified output filename (lowercase -o)
Render the output in PS, PDF, SVG, Fig, PNG, GIF, JPEG, JSON, or DOT format
Render a GIF image using stdin and stdout
Display help
SYNOPSIS
sfdp [options] [file]
sfdp -?
sfdp -V
PARAMETERS
-T format
Sets the output format. Common formats include dot, png, svg, pdf, ps, etc.
-o file
Writes the generated graph layout to the specified output file. If omitted, output goes to standard output.
-s seed
Initializes the random number generator with a given seed, ensuring reproducible layouts for the same input graph.
-L len
Scales the desired edge length. A larger value tends to spread nodes out more.
-C
Tells sfdp to use cluster information for layout. Clusters are treated as rigid bodies during the initial phases.
-Gattribute=value
Sets a default graph attribute (e.g., -Gsplines=true).
-Nattribute=value
Sets a default node attribute (e.g., -Nshape=circle).
-Eattribute=value
Sets a default edge attribute (e.g., -Ecolor=blue).
-x xval
Sets the x-coordinate of the graph's center. Useful for specific placement in a larger drawing area.
-y yval
Sets the y-coordinate of the graph's center.
-w iterations
Sets the maximum number of iterations for the force-directed algorithm. More iterations can lead to better layouts but take longer.
-O overlap_mode
Specifies the overlap removal method. Options include scale, prism, voronoi, compress, etc.
-P
Generates a drawing that fills the page. This option can interact with other page-related attributes.
-q
Operates in quiet mode, suppressing non-essential messages.
-v
Prints the version information of sfdp and exits.
-?
Prints a usage message and exits.
DESCRIPTION
sfdp is a graph layout program provided by the Graphviz suite. It specializes in drawing large undirected graphs using a force-directed layout algorithm based on stress majorization. Unlike simpler force-directed algorithms, sfdp is designed for scalability, efficiently handling graphs with thousands or even millions of nodes and edges by employing a multilevel approach. It aims to minimize a global stress function, leading to layouts where nodes connected by edges are placed closer together, while maintaining overall graph structure and reducing overlaps. sfdp is particularly well-suited for visualizing complex networks, social graphs, and biological data, where the emphasis is on revealing inherent relationships and clusters within the data. It reads graph descriptions in the DOT language and outputs them in various graphical formats.
CAVEATS
Large graphs, while sfdp's specialty, can still be computationally intensive and require significant memory, especially during the force-directed layout and overlap removal phases.
The quality of the layout heavily depends on the graph structure and chosen parameters. Experimentation with options like -L, -w, and -O might be necessary to achieve desired visual results.
MULTILEVEL APPROACH
sfdp employs a multilevel algorithm, which works by creating a series of coarser approximations of the graph. It lays out the coarsest graph, then successively refines the layout by adding more detail from finer graphs. This hierarchical approach significantly reduces the computational complexity for large graphs.
STRESS MAJORIZATION
This is the core mathematical algorithm sfdp uses. It defines a 'stress' function that quantifies the discrepancy between ideal edge lengths (based on shortest path distances in the graph) and actual edge lengths in the layout. The algorithm iteratively adjusts node positions to minimize this stress, leading to a layout that accurately reflects the graph's underlying metric structure.
HISTORY
sfdp is an integral part of the Graphviz (Graph Visualization Software) project, which originated at AT&T Labs Research. It was developed to address the limitations of existing force-directed layout algorithms, such as those used by neato and fdp, when applied to very large graphs. Its development focused on leveraging multilevel techniques and the stress majorization algorithm to provide a more scalable and efficient solution, making it suitable for modern big data visualization challenges that involve extensive network analysis.