https://scrapbox.io/shokai/2_hop_link
以下2つの関係があるとき、`A -> B`を関連としてとらえたリンクのこと。
- `A -> C`
- `B -> C`
[[Scrapbox]]で提唱されていた概念である。
## 具体例
以下のようなリンク関係があるとする。
```mermaid
flowchart LR
D[Dog] --> A[Animal]
C[Cat] --> A
O[Owl] --> A
```
`Dog`から見た関連は`Animal`だけである。
```mermaid
flowchart LR
D[Dog]:::focus --> A[Animal]
C[Cat]
O[Owl]
classDef focus fill:#f96
```
[[2 hop link]]は`Animal`へのリンクを持つノードも対象に入るので...
```mermaid
flowchart LR
D[Dog]:::focus --> A[Animal]
C[Cat] --> A
O[Owl] --> A
classDef focus fill:#f96
```
`Dog`から見た[[2 hop link]]は以下のようになる。
```mermaid
flowchart LR
D[Dog]:::focus --> A[Animal]
D[Dog]:::focus --> C[Cat]
D[Dog]:::focus --> O[Owl]
classDef focus fill:#f96
```
### 複雑な例
もう少し複雑なケース。
```mermaid
flowchart LR
Dog:::base --> Animal
Dog --> Masaru
Zagitova --> Masaru
Masaru --> Akita-inu
Cat --> Animal
Owl --> Animal
Tama --> Cat
Mike --> Cat
Animal --> Zoo
Zoo --> Animal
Mahjong --> Zoo
Animal --> Coffee
classDef base fill:cyan
```
`Dog`のリンク先が重要。
```mermaid
flowchart LR
Dog:::base --> Animal:::focus
Dog --> Masaru:::focus
Zagitova --> Masaru
Masaru --> Akita-inu
Cat --> Animal
Owl --> Animal
Tama --> Cat
Mike --> Cat
Animal --> Zoo
Zoo --> Animal
Mahjong --> Zoo
Animal --> Coffee
classDef focus fill:#f96
classDef base fill:cyan
```
ここへリンクしているものをが[[2 hop link]]の対象。
```mermaid
flowchart LR
Dog:::base --> Animal:::focus
Dog --> Masaru:::focus
Zagitova:::twohop --> Masaru
Masaru --> Akita-inu
Cat:::twohop --> Animal
Owl:::twohop --> Animal
Tama --> Cat
Mike --> Cat
Animal --> Zoo
Zoo:::twohop --> Animal
Mahjong --> Zoo
Animal --> Coffee
classDef focus fill:#f96
classDef base fill:cyan
classDef twohop fill:#fb8
```