LinuxCommandLibrary

fdp

Display disk partition table information

TLDR

Render a PNG image with a filename based on the input filename and output format (uppercase -O)

$ fdp -T png -O [path/to/input.gv]
copy

Render a SVG image with the specified output filename (lowercase -o)
$ fdp -T svg -o [path/to/image.svg] [path/to/input.gv]
copy

Render the output in a specific format
$ fdp -T [ps|pdf|svg|fig|png|gif|jpg|json|dot] -O [path/to/input.gv]
copy

Render a gif image using stdin and stdout
$ echo "[digraph {this -> that} ]" | fdp -T gif > [path/to/image.gif]
copy

Display help
$ fdp -?
copy

SYNOPSIS

fdp [options] [input_file]

PARAMETERS

-T format
    Specifies the output format (e.g., png, svg, pdf, ps, dot). This option is crucial for saving the graph in a usable image or document format.

-o output_file
    Writes the generated graph to the specified file. If this option is omitted, fdp writes its output to standard output (stdout).

-G attribute=value
    Sets a global graph attribute. This option can be used multiple times to set different attributes for the entire graph (e.g., -Gbgcolor=lightgrey).

-N attribute=value
    Sets a default node attribute. This allows you to define properties for all nodes unless overridden by specific node definitions (e.g., -Nshape=circle).

-E attribute=value
    Sets a default edge attribute. Similar to -N, this applies properties to all edges (e.g., -Ecolor=blue).

-q
    Suppresses warning messages during graph processing. Useful for scripting where warnings might clutter output.

-s [factor]
    Scales the output layout. If no factor is given, it attempts to scale the layout to fit within standard paper sizes or a default boundary.

-v
    Enables verbose output, displaying progress and layout details to stderr. Helpful for debugging or understanding layout phases.

-V
    Prints the version information of the fdp command and exits.

input_file
    The path to a file containing the graph definition in DOT language. If this argument is omitted, fdp reads the graph definition from standard input (stdin).

DESCRIPTION

fdp is a layout engine from the Graphviz suite, specifically designed for visualizing undirected graphs using a force-directed (or spring-model) algorithm. This method treats graph nodes as mutually repulsive particles and edges as attractive springs, iteratively adjusting their positions to achieve a visually balanced and stable layout. It is particularly effective for graphs where the overall structure, clustering, and relative proximity of nodes are more important than strict hierarchical or radial arrangements.

fdp reads graph descriptions in the DOT language, processes them, and outputs the rendered graph in various formats, including PNG, SVG, PDF, and PostScript. Its primary goal is to minimize edge crossings, place related nodes closer together, and distribute nodes evenly, thereby making complex graph structures more intelligible and aesthetically pleasing for analysis and presentation.

CAVEATS

Performance: For extremely large graphs (tens of thousands of nodes/edges), fdp can be computationally intensive and slow, as force-directed algorithms typically have higher complexity. For such cases, sfdp (Scalable Force Directed Placement) is often a more suitable and faster alternative.

Layout Determinism: While fdp aims for consistent layouts, minor changes in input or different Graphviz versions might lead to slightly varied layouts due to the iterative nature of the algorithm and potential floating-point precision differences.

Parameter Tuning: Achieving optimal or desired layouts often requires careful tuning of graph, node, and edge attributes (e.g., len, K, repulsiveforce), which can involve experimentation.

BEST USE CASES

fdp excels at visualizing undirected graphs where relationships are non-hierarchical, such as social networks, biological interaction maps, protein-protein interaction networks, or software dependency graphs. Its inherent ability to reveal clusters and highly connected components naturally makes it a powerful tool for exploring the intrinsic structure and organization of such data.

DOT LANGUAGE DEPENDENCY

Effective utilization of fdp heavily relies on understanding and correctly using the DOT language for graph description. Familiarity with DOT syntax for defining nodes, edges, and their attributes is essential for customizing the appearance and influencing the layout behavior of your graphs.

HISTORY

fdp is a foundational component of the open-source Graphviz (Graph Visualization Software) project, which originated at AT&T Labs Research in the mid-1990s. The project was conceived to automate graph drawing, a critical need for visualizing complex data structures. Along with dot and neato, fdp was among the early and core layout engines developed to address different graph structures and layout requirements. Its force-directed approach proved invaluable for effectively visualizing complex, non-hierarchical data, establishing it as a key tool for graph analysis and representation within the scientific, engineering, and data visualization communities.

SEE ALSO

dot(1), neato(1), twopi(1), circo(1), sfdp(1), graphviz(1)

Copied to clipboard