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

# run によってログまたは使用された artifact を検索するにはどうすればよいですか？ artifact を生成または使用した run を検索するにはどうすればよいですか？

W\&B は、各 run によってログされた artifact と各 run で使用された artifact をトラッキングし、artifact グラフを構築します。このグラフは、run と artifact を表すノードで構成される二部の有向非巡回グラフです。例は [こちら](https://wandb.ai/shawn/detectron2-11/artifacts/dataset/furniture-small-val/06d5ddd4deeb2a6ebdd5/graph) で確認できます (グラフを展開するには "Explode" をクリックしてください) 。

Public API を使用して、artifact または run のどちらからでもプログラムでグラフをたどることができます。

<Tabs>
  <Tab title="Artifact から">
    ```python theme={null}
    api = wandb.Api()

    artifact = api.artifact("project/artifact:alias")

    # artifact からグラフを上方向にたどる:
    producer_run = artifact.logged_by()
    # artifact からグラフを下方向にたどる:
    consumer_runs = artifact.used_by()

    # run からグラフを下方向にたどる:
    next_artifacts = consumer_runs[0].logged_artifacts()
    # run からグラフを上方向にたどる:
    previous_artifacts = producer_run.used_artifacts()
    ```
  </Tab>

  <Tab title="Run から">
    ```python theme={null}
    api = wandb.Api()

    run = api.run("entity/project/run_id")

    # run からグラフを下方向にたどる:
    produced_artifacts = run.logged_artifacts()
    # run からグラフを上方向にたどる:
    consumed_artifacts = run.used_artifacts()

    # artifact からグラフを上方向にたどる:
    earlier_run = consumed_artifacts[0].logged_by()
    # artifact からグラフを下方向にたどる:
    consumer_runs = produced_artifacts[0].used_by()
    ```
  </Tab>
</Tabs>

***

<Badge stroke shape="pill" color="orange" size="md">[Artifacts](/ja/support/models/tags/artifacts)</Badge>
