to_edges

to_edges(poly: Poly) list[tuple[int, int]]

Convert a polynomial to its graph edge list.

Second-order terms are converted to edges, and first-order terms are represented as self-loops.

Parameters:

poly (Poly) – Polynomial to convert.

Returns:

Edges represented by node ID pairs.

Return type:

list[tuple[int, int]]