> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-feat-cli-docs-generator.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# グラフ

<Card title="View the source code" href="https://www.github.com/wandb/wandb/tree/637bddf198525810add5804059001b1b319d6ad1/wandb/sdk/data_types/graph.py#L245-L405" icon="github" />

グラフ用の Wandb クラス。

```python theme={null}
Graph(
    format="keras"
)
```

このクラスは通常、ニューラルネットモデルを保存し表示するために使用されます。ツリーをノードとエッジの配列として表現します。ノードには、wandb で可視化できるラベルを持たせることができます。

#### 例:

Keras モデルをインポート:

```
Graph.from_keras(keras_model)
```

## メソッド

### `add_edge`

[ソースを見る](https://www.github.com/wandb/wandb/tree/637bddf198525810add5804059001b1b319d6ad1/wandb/sdk/data_types/graph.py#L330-L334)

```python theme={null}
add_edge(
    from_node, to_node
)
```

### `add_node`

[ソースを見る](https://www.github.com/wandb/wandb/tree/637bddf198525810add5804059001b1b319d6ad1/wandb/sdk/data_types/graph.py#L318-L328)

```python theme={null}
add_node(
    node=None, **node_kwargs
)
```

### `from_keras`

[ソースを見る](https://www.github.com/wandb/wandb/tree/637bddf198525810add5804059001b1b319d6ad1/wandb/sdk/data_types/graph.py#L336-L366)

```python theme={null}
@classmethod
from_keras(
    model
)
```

### `pprint`

[ソースを見る](https://www.github.com/wandb/wandb/tree/637bddf198525810add5804059001b1b319d6ad1/wandb/sdk/data_types/graph.py#L312-L316)

```python theme={null}
pprint()
```

### `__getitem__`

[ソースを見る](https://www.github.com/wandb/wandb/tree/637bddf198525810add5804059001b1b319d6ad1/wandb/sdk/data_types/graph.py#L309-L310)

```python theme={null}
__getitem__(
    nid
)
```
