plot_graph: Plot Graph

View source: R/plot_graph.R

plot_graphR Documentation

Plot Graph

Description

Visualizes a graph using ggplot2. It plots nodes as points and edges as segments connecting these points.

Usage

plot_graph(z, size = 0.75)

Arguments

z

A list containing graph data. This list must have the following components:

  • sA An adjacency matrix or a sparse Matrix representation of the graph.

  • xy A matrix or dataframe containing the x and y coordinates of each node in the graph.

size

Numeric. Dot size for nodes. Default is 0.75.

Details

The function is primarily designed to work with the output from the download_graph function. This ensures that the graph visualization upholds the structure and properties of the retrieved graph. However, the function can also be utilized to visualize custom graph structures, provided they match to the input format.

Note

If node coordinates xy are not provided, they will be calculated using spectral methods spectral_coords. For large graphs, this can be computationally intensive and may take significant time. Use with caution for large graphs if node coordinates are not supplied.

See Also

download_graph, plot_signal, spectral_coords

Examples

data(grid1)
plot_graph(grid1)

gasper documentation built on Oct. 27, 2023, 1:07 a.m.