/**
 * Compressed Sparse Row representation of a weighted graph.
 *
 * The four parallel typed arrays — `edge_addresses`, `adjacency`,
 * `edge_weights`, `vertex_weights` — share a single `ArrayBuffer` so that
 * they are co-located in memory. This gives the allocator one allocation
 * instead of four, the GC one reference to track, and the cache one
 * contiguous region to prefetch when walking adjacency rows.
 *
 * Layout inside the buffer (all uint32, 4 bytes each):
 *   [0]                       edge_addresses, length vertex_count + 1
 *   [vertex_count + 1]        adjacency,      length adjacency_length
 *   [+adjacency_length]       edge_weights,   length adjacency_length
 *   [+adjacency_length]       vertex_weights, length vertex_count
 *
 * Conventions match `mesh_to_metis_graph`:
 *   - `edge_addresses[v]`     = start of vertex v's adjacency in `adjacency`
 *   - `edge_addresses[v + 1]` = end (exclusive)
 *   - `adjacency[k]`          = neighbour vertex id
 *   - `edge_weights[k]`       = weight of that edge
 *   - `vertex_weights[v]`     = vertex weight (default 1)
 *
 * The class deliberately exposes the raw typed arrays as fields rather than
 * via accessor methods. Hot loops in graph algorithms want
 * `for (let k = xadj[v]; k < xadj[v+1]; k++) { ... adj[k] ... }` patterns; a
 * callback-based iterator API would force a closure allocation per outer
 * iteration and defeat V8's inlining.
 *
 * @author Alex Goldring
 * @copyright Company Named Limited (c) 2026
 */
export class CSRGraph {
    /**
     * Construct a CSRGraph from existing arrays by COPYING into a new
     * shared-buffer instance. The input arrays are not retained.
     *
     * `vertex_weights` is optional — if not provided, the new graph keeps the
     * default all-1s vertex weights and `total_vertex_weight = vertex_count`.
     *
     * @param {number} vertex_count
     * @param {ArrayLike<number>} edge_addresses length vertex_count + 1
     * @param {ArrayLike<number>} adjacency length edge_addresses[vertex_count]
     * @param {ArrayLike<number>} edge_weights parallel to adjacency
     * @param {ArrayLike<number>} [vertex_weights] optional; length vertex_count
     * @returns {CSRGraph}
     */
    static fromArrays(vertex_count: number, edge_addresses: ArrayLike<number>, adjacency: ArrayLike<number>, edge_weights: ArrayLike<number>, vertex_weights?: ArrayLike<number>): CSRGraph;
    /**
     * @param {number} vertex_count
     * @param {number} adjacency_length total length of the adjacency list
     *   (each undirected edge appears twice for symmetric graphs)
     */
    constructor(vertex_count: number, adjacency_length: number);
    /** @type {number} */
    vertex_count: number;
    /** @type {number} */
    adjacency_length: number;
    /**
     * Single backing buffer for all four arrays.
     * @type {ArrayBuffer}
     * @private
     */
    private __data_buffer;
    /**
     * CSR row pointers. Length = vertex_count + 1; the final entry equals
     * adjacency_length.
     * @type {Uint32Array}
     */
    edge_addresses: Uint32Array;
    /**
     * CSR column indices — neighbour vertex ids.
     * @type {Uint32Array}
     */
    adjacency: Uint32Array;
    /**
     * Edge weights parallel to `adjacency`.
     * @type {Uint32Array}
     */
    edge_weights: Uint32Array;
    /**
     * Per-vertex weight. Initialised to all-1s; overwrite via direct
     * indexing or `vertex_weights.set(...)` if your domain needs non-uniform
     * weights. Remember to call `refresh_total_vertex_weight()` after.
     * @type {Uint32Array}
     */
    vertex_weights: Uint32Array;
    /**
     * Cached `Σ vertex_weights[v]`. Kept in sync via `refresh_total_vertex_weight()`.
     * @type {number}
     */
    total_vertex_weight: number;
    /**
     * The underlying shared buffer. Useful for fast bulk operations and for
     * passing the graph between Web Workers via transfer.
     * @returns {ArrayBuffer}
     */
    get arrayBuffer(): ArrayBuffer;
    /**
     * Degree of vertex `vertex` (number of outgoing edges in the CSR).
     * @param {number} vertex
     * @returns {number}
     */
    degree_of(vertex: number): number;
    /**
     * Sum of all entries in `edge_weights[0..adjacency_length)`.
     * Each undirected edge contributes twice for a symmetric graph.
     * @returns {number}
     */
    sum_of_edge_weights(): number;
    /**
     * Recompute and store `total_vertex_weight` from the current `vertex_weights`.
     */
    refresh_total_vertex_weight(): void;
    /**
     * Shrink `adjacency` and `edge_weights` in place to `new_adjacency_length`.
     *
     * Use after a worst-case allocation has been partially filled (e.g. during
     * coarse-graph contraction where the exact edge count is only known after
     * the merge pass). Reallocates the shared buffer at the smaller size and
     * recreates all four typed-array views; existing references to
     * `this.adjacency` etc. are invalidated.
     *
     * Vertex-side data (`edge_addresses`, `vertex_weights`) and
     * `total_vertex_weight` are preserved.
     *
     * No-op if `new_adjacency_length === adjacency_length`.
     *
     * @param {number} new_adjacency_length must be <= current `adjacency_length`
     */
    truncate_adjacency(new_adjacency_length: number): void;
    /**
     * Copy the contents of `other` into `this`. Other must have matching
     * `vertex_count` and `adjacency_length` (so the layouts align).
     *
     * Performed as a single bulk Uint32Array `.set()` thanks to the shared
     * buffer layout — significantly faster than copying the four arrays
     * individually.
     *
     * @param {CSRGraph} other
     */
    copy(other: CSRGraph): void;
    /**
     * Deep copy. Returns a new `CSRGraph` with independent buffers.
     * @returns {CSRGraph}
     */
    clone(): CSRGraph;
    /**
     * Structural equality — same shape and same buffer contents.
     * @param {CSRGraph} other
     * @returns {boolean}
     */
    equals(other: CSRGraph): boolean;
    /**
     * 32-bit hash mixing the metadata fields and the entire buffer contents.
     * Uses meep's standard `(h*31 + element)` convention via `uint32_array_hash`.
     *
     * @returns {number}
     */
    hash(): number;
    /**
     * Type-check marker — avoids `instanceof` across module realms while still
     * letting us assert "is a CSRGraph" cheaply.
     * @readonly
     * @type {boolean}
     */
    readonly isCSRGraph: boolean;
}
//# sourceMappingURL=CSRGraph.d.ts.map