dgf.plot
dgf.plot.plot_graph
Plots an in-memory graph.
Usage example:
import graphviz
schema = dgf.io.read_schema("path")
graph = dgf.io.tfgnn_graph_to_graph(...)
# Or use the in-memory sampler to generate in_memory_graphb5s.
dot = dgf.plot.plot_graph(graph, schema)
# Display in a colab
dot
# Save to file.
dot.render('in_memory_graph', format='png')
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
InMemoryGraph
|
The |
required |
schema
|
GraphSchema
|
The |
required |
features
|
bool
|
If true, display the node and edges features. |
True
|
Returns:
| Type | Description |
|---|---|
Digraph
|
A |
dgf.plot.plot_nx_graph
Helper function to draw an nx graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
g
|
Graph
|
The nx graph to draw. |
required |
label_name
|
Optional[str]
|
The name of the nx node data attribute to use as the name of the node in the visualization. If provided, nodes will be colored according to this label. |
None
|
ax
|
Optional[Axes]
|
The matplotlib axes to draw on. If not provided, a new figure and axes will be created. |
None
|
dgf.plot.plot_schema
Plots the graphschema's meta-graph (i.e., its nodesets and edgesets).
Usage example:
import graphviz
schema = dgf.io.read_schema("path")
# Or use "dgf.io.tfgnn_schema_to_schema" if you have a TF-GNN schema.
dot = dgf.plot.plot_schema(schema)
# Display in a colab
dot
# Save to file.
dot.render('in_memory_graph', format='png')
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema
|
GraphSchema
|
The |
required |
features
|
bool
|
If true, display the node and edges features. |
True
|
Returns:
| Type | Description |
|---|---|
Digraph
|
A |