# Third-party sources and licenses

This document records every external source this repository derives from or
redistributes, as required for open source compliance review.

## 1. Upstream project being ported

| Field | Value |
|-------|-------|
| Project | **petgraph** |
| Link | https://github.com/petgraph/petgraph |
| License | Dual-licensed **MIT OR Apache-2.0** |
| Relationship | This repository is a **port**, not a fork or a vendored copy. |

### Scope of reference

The port is a re-implementation in MoonBit. No Rust source file is copied into
this repository; there is no vendored `petgraph` source tree and no generated
Rust-to-MoonBit transpiler output. What was taken from upstream is:

- **Algorithm semantics and data-structure design.** The adjacency-list
  representation in `src/graph/` follows petgraph's intrusive edge-list layout
  (`next_out` / `next_in` links, `swap_remove` index fix-ups) closely enough
  that observable behaviour — including neighbour iteration order and id
  invalidation — matches.
- **Public API naming.** Function and type names (`dijkstra`, `tarjan_scc`,
  `min_spanning_tree`, `Dfs`, `UnionFind`, …) intentionally mirror upstream so
  that petgraph users can transfer knowledge directly.
- **Test cases.** Files named `*_ported_test.mbt` are MoonBit adaptations of
  petgraph's own tests, under `crates/petgraph/tests/`. The original Rust test
  names are preserved so each case can be traced back to its source.

Deliberate divergences from upstream are documented in
[`DESIGN.md`](DESIGN.md); the headline ones are dropping the `Ix` / `Ty` type
parameters and collapsing upstream's `GraphBase` / `IntoNeighbors` / `Visitable`
trait hierarchy into a single `NeighborSource` trait.

Because this repository is distributed under the same dual MIT / Apache-2.0
terms as upstream, the port is license-compatible with petgraph. Both license
texts are included at the repository root:
[`LICENSE-MIT`](../LICENSE-MIT) and [`LICENSE-APACHE`](../LICENSE-APACHE).

## 2. Redistributed agent skills (`.claude/skills/`)

The repository ships agent skill definitions so that contributors get the same
MoonBit tooling guidance. These are **documentation, not part of the library**:
nothing under `.claude/` is compiled, imported, or published to mooncakes.io.

| Path | Source | License |
|------|--------|---------|
| `.claude/skills/moonbit-*`, `.claude/skills/make-moonbit-c-bindings`, `.claude/skills/ocaml2moonbit-migration` | https://github.com/moonbitlang/skills | Apache-2.0 / MIT, per-skill; original `LICENSE` files retained in place |
| `.claude/skills/osc2026-guide` | https://gitlink.org.cn/MilkyNatas/osc2026-guide | Apache-2.0; original `LICENSE` retained |

Each bundled skill directory keeps its upstream `LICENSE` file unmodified. No
skill content was altered.

If you would rather not redistribute these, deleting `.claude/` has no effect
on the build: `moon check`, `moon build` and `moon test` do not read it.

## 3. Test data and fixtures

All test graphs are constructed programmatically in MoonBit source. The
repository contains no binary fixtures, no scraped datasets, and no sample
files of external origin. The only non-source asset is
[`docs/demo-graph.svg`](demo-graph.svg), which is rendered by Graphviz from DOT
output produced by this library's own `@dot` package.

## 4. Generated files

`src/*/pkg.generated.mbti` are public-interface files generated by `moon info`
from this repository's own source. They are committed so that CI can verify the
public API has not drifted unnoticed.
