graflo.cli.plot_manifest¶
manifest visualization tool for graph databases.
This module provides functionality for visualizing graph database schemas using Graphviz. It includes tools for plotting vertex-to-vertex relationships, vertex fields, and resource mappings. The module supports various visualization options and graph layout customization.
Key Components
- manifestPlotter: Main class for manifest visualization
- knapsack: Utility for optimizing graph layout
- plot_manifest: CLI command for manifest visualization
Graphviz Attributes Reference
Example
plot_manifest(manifest_path="manifest.yaml", figure_output_path="manifest.png")
knapsack(weights, ks_size=7)
¶
Split a set of weights into groups of at most threshold weight.
This function implements a greedy algorithm to partition weights into groups where each group's total weight is at most ks_size. It's used for optimizing graph layout by balancing node distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weights
|
List of weights to partition |
required | |
ks_size
|
Maximum total weight per group (default: 7) |
7
|
Returns:
| Type | Description |
|---|---|
|
list[list[int]]: List of groups, where each group is a list of indices from the original weights list |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any single weight exceeds ks_size |
Example
weights = [3, 4, 2, 5, 1] knapsack(weights, ks_size=7) [[4, 0, 2], [1, 3]] # Groups with weights [6, 7]
Source code in graflo/cli/plot_manifest.py
plot_manifest(manifest_path, figure_output_path, prune_low_degree_nodes, group_vc_by_level, color_vc_by_level, include_all_vertices, output_format, output_dpi)
¶
Generate visualizations of the graph database manifest.
This command creates multiple visualizations of the manifest: 1. Vertex-to-vertex relationships 2. Vertex fields and their relationships 3. Resource mappings
The visualizations are saved to the specified output path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest_path
|
Path to the manifest configuration file |
required | |
figure_output_path
|
Path where the visualization will be saved |
required | |
prune_low_degree_nodes
|
Whether to remove nodes with low connectivity from the visualization (default: False) |
required | |
group_vc_by_level
|
Whether to cluster vc2vc by inferred graph level |
required | |
color_vc_by_level
|
Whether to color vc2vc nodes by inferred graph level |
required | |
include_all_vertices
|
Whether to include isolated vertex collections |
required | |
output_format
|
Output image format (pdf or png) |
required | |
output_dpi
|
DPI for raster outputs (png) |
required |
Example
$ uv run plot_manifest -c manifest.yaml -o output_dir
Source code in graflo/cli/plot_manifest.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |