Overview

The Graph class is used to represent and manipulate computational graphs.

The following is an example of calling basic graph operations:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from ge.graph import Graph, DataType, Format

# Create a graph.
graph = Graph("my_graph")

# Obtain all nodes.
nodes = graph.get_all_nodes()

# Set and obtain attributes.
graph.set_attr("my_attr", "value")
attr_value = graph.get_attr("my_attr")

# Export a graph.
graph.dump_to_file(format=DumpFormat.kReadable, suffix="debug")