Skip to content

Graphs and symbolic mathematics: API index

Find an operation by its purpose. Entries link to the complete signature and contract.

HMath.DataStructure

API Purpose
Fenwick Persistent exact-Integer prefix-sum tree with zero-based updates and half-open queries.
fenwick Build an immutable Fenwick prefix-sum tree from at most 1048576 Integers.
fenwickAdd Given zero-based index,delta,then Fenwick tree, return a new tree with that value incremented.
fenwickPrefix Given exclusive end then tree, return exact sum over [0,end).
fenwickRange Given lo,hi,then tree, return exact half-open sum over [lo,hi).
SegmentTree Persistent exact-Integer range-sum tree.
segmentTree Build an immutable Integer sum segment tree from at most 1048576 values.
segmentSet Given zero-based index,new Integer,then segment tree, return an updated tree.
segmentRange Given lo,hi,then segment tree, return Integer sum over [lo,hi).
SparseTable Immutable precomputed range-minimum table for nonempty half-open queries.
sparseTable Precompute range minima for at most 1048576 Integers.
sparseMinimum Given lo,hi,then sparse table, return minimum over nonempty [lo,hi).
DisjointSparseTable Immutable disjoint range-sum table supporting constant-query arithmetic.
disjointSparseTable Suffix/prefix blocks for associative integer addition, O(n log n) build and O(1) arithmetic for nonempty queries.
disjointRange Given lo,hi,then disjoint sparse sum table, return exact sum over [lo,hi).
monotonicMinima Sliding minima using an increasing deque of indices; output windows are complete only.
nextGreater For each list position, return Maybe index of its first strictly greater element to the right, using a monotone stack.
Heap Leftist binary min heap, O(log n) mergeinsertdelete-min comparisons.
emptyHeap Construct an empty persistent leftist min-heap. heapPop returns Nothing until values are inserted.
heapInsert Given value then persistent min-heap, return a new heap containing it.
heapPop Return Nothing for empty heap, otherwise Just (smallest value,remaining heap).
heapFromList Build a persistent min-heap from a finite list, retaining all elements including duplicates.
BinaryHeap Complete binary min heap in an array.
binaryHeap Build an array-backed Integer min-heap from at most 1048576 values.
binaryInsert Given Integer then binary heap, return a persistent updated min-heap.
binaryPop Return Nothing if empty, otherwise the smallest Integer and a new binary heap containing the remaining values.
IndexedHeap An indexed priority queue backed by an ordered map and a binary heap.
indexedHeap Construct an empty indexed priority queue.
indexedSet Given Int key,Integer priority,then indexed heap, set or replace that key's priority.
indexedPop Return Just ((key,priority),remaining queue) for the minimum (priority,key) pair, or Nothing if empty.
UnionFind Persistent disjoint-set partition of zero-based indices, constructed with unionFind and updated by union.
unionFind Construct disjoint singleton sets for n zero-based elements, requiring n in [0,1048576].
findRoot Given element index then union-find structure, return representative root.
union Given two valid indices then union-find, return a new structure merging their components by size.
connected Given two indices then union-find, return whether their roots match.
components Return all disjoint components as lists of zero-based element indices, including singleton sets.
Bloom Immutable probabilistic membership filter; False is definitive and True may be a false positive.
bloom Given bit count m in [1,1048576] then hash count k in [1,64], construct an empty Bloom filter.
bloomInsert Given Word64 key then Bloom filter, set its k hash positions and return updated filter.
bloomMember Test a Word64 key against all Bloom hash positions.
bloomFalsePositiveBound Conservative union bound min(1,kn/m)^k under independent uniform query hashes, since at most kn bits can be occupied.
CountMin Immutable frequency sketch with nonnegative updates and possible collision overestimation.
countMin Given positive width and depth with product<=1048576, construct an empty count-min sketch.
countMinAdd Given Word64 key,nonnegative Integer increment,then sketch, increment its hash counters.
countMinEstimate Given Word64 key then sketch, return minimum associated counter as an Integer frequency estimate.
countMinErrorBound (additive error, failure probability) under the uniform-hash model.
HyperLogLog Immutable probabilistic distinct-cardinality sketch, constructed with hyperLogLog.
hyperLogLog Construct an empty cardinality sketch from precision p in [4,16], using 2^p registers.
hllAdd Given Word64 item then HyperLogLog sketch, hash and update its register maximum.
hllEstimate HyperLogLog with linear-counting small-range correction.
Reservoir Seeded bounded Algorithm-R stream sample state.
reservoir Given sample capacity in [0,1048576] then Word64 seed, construct an empty deterministic Algorithm-R reservoir.
reservoirAdd Algorithm R with rejection sampling (no modulo bias).
reservoirValues Return retained reservoir sample values.
OnlineQuantiles Exact online order statistics with an explicit memory cap.
onlineQuantiles Given exact-storage cap in [0,1048576], create an empty online order-statistics container.
quantileAdd Given finite Double then quantile container, insert in sorted order.
onlineQuantile Given finite q in [0,1] then nonempty quantile container, linearly interpolate order statistics at q*(n-1).

HMath.Discrete

API Purpose
MultiSet Finite multiset with exact nonnegative multiplicities.
multiset Construct a finite multiset by counting equal ordered values with exact nonnegative Integer multiplicities.
multiplicity Given value then multiset, return its Integer frequency, or zero when absent.
multisetEntries Return (value,positive multiplicity) pairs in ascending value order.
multisetInsert Given value then multiset, increment its multiplicity by one and return a new multiset.
multisetDelete Given value then multiset, remove one occurrence, deleting its entry at zero.
multisetUnion Add multiplicities of two multisets, retaining all distinct values.
multisetIntersection Return shared values with minimum of the two multiplicities.
multisetDifference Subtract right multiplicities from left, truncating at zero and removing empty entries.
BitSet Opaque arbitrary-size dynamic bitset; bits outside its width are zero.
bitSet Given width in [0,1048576] then nonnegative Integer less than 2^width, construct an opaque bitset.
bitWidth Return declared number of bits, including leading zeros.
bitValue Return unsigned Integer value of all bits within the declared width.
bitMember Given bitset then zero-based bit index, return membership.
bitInsert Given bitset then valid bit index, return a new bitset with that bit set.
bitDelete Given bitset then valid bit index, return a new bitset with that bit cleared.
bitUnion Return bitwise OR of equal-width bitsets.
bitIntersection Return bitwise AND of equal-width bitsets; mismatched widths fail.
bitDifference Return left bits with right bits cleared, requiring equal widths.
resizeBitSet Shrinking explicitly discards high bits.
populationCount Count set bits within declared width, returning Int.
leadingZeros Count high-end zero bits within declared width.
trailingZeros Count low-end zero bits; an all-zero bitset returns its declared width.
rotateBits Given signed rotation count then bitset, rotate left modulo width (negative counts rotate right).
reverseBits Reverse exactly the declared width of bits, preserving width and leading/trailing zero positions.
grayEncode Return width-preserving reflected Gray code v xor (v shifted right one).
grayDecode Decode reflected Gray bits to the corresponding width-preserving binary value.
hammingDistance Count differing bit positions between equal-width bitsets.
setUnion Treat lists as finite sets and return their sorted unique union; input order and multiplicity are discarded.
setIntersection Return sorted unique values present in both input lists.
setDifference Return sorted unique left values absent from the right list.
symmetricDifference Return sorted unique values present in exactly one input list.
transitiveClosure Warshall closure.
equivalenceClosure Given square Bool relation matrix, add reflexivity and symmetry then compute transitive closure.
isEquivalence Return whether a bounded square Bool relation is already reflexive, symmetric and transitive.
booleanMultiply Multiply compatible square Bool relation matrices over OR/AND, representing relational composition.
Prop Boolean proposition tree.
Literal Declaration and type contract below.
Variable Declaration and type contract below.
Not Declaration and type contract below.
And Declaration and type contract below.
Or Declaration and type contract below.
Xor Declaration and type contract below.
Implies Declaration and type contract below.
Iff Declaration and type contract below.
evaluateProp Given variable Bool assignment list then proposition, evaluate literalsvariablesconnectives.
truthTable Assignments in binary order, variable zero the least-significant bit.
Implicant Value bits and a don't-care mask.
Implicant Declaration and type contract below.
implicantValue Fixed bit values of a Boolean implicant; positions masked by implicantMask are ignored.
implicantMask Bit mask whose set bits denote don't-care positions in an implicant.
quineMcCluskey Exact Quine--McCluskey prime generation followed by branch-and-bound cover selection.
implicantCovers Given implicant then Integer minterm, compare bits where implicantMask is clear.

HMath.Expression

API Purpose
SourcePos Zero-based offset and one-based linecolumn.
SourcePos Declaration and type contract below.
sourceOffset Zero-based source character offset; generated nodes use zero.
sourceLine One-based source line, or zero for generated unknown positions.
sourceColumn One-based source column, or zero for generated unknown positions.
unknownPosition Source position sentinel (offset,line,column)=(0,0,0), used by programmatically constructed nodes rather than parsed source positions.
Expr Positioned expression syntax tree.
Expr Declaration and type contract below.
expressionPosition Source location carried by this Expr for positioned errors.
expressionNode Literalvariableoperatorcalllet structure of this expression.
ExprNode Expression syntax: exact literal,named variableconstant,unarybinary operation,registered call,or lexically scoped let binding.
Literal Declaration and type contract below.
Variable Declaration and type contract below.
Constant Declaration and type contract below.
Unary Declaration and type contract below.
Binary Declaration and type contract below.
Call Declaration and type contract below.
Let Declaration and type contract below.
UnaryOp Unary expression operator; Negate changes the operand sign.
Negate Declaration and type contract below.
BinaryOp Arithmetic expression operator: addition,subtraction,multiplication,division,or exponentiation.
Add Declaration and type contract below.
Subtract Declaration and type contract below.
Multiply Declaration and type contract below.
Divide Declaration and type contract below.
Power Declaration and type contract below.
NamedConstant Symbolic pi,Euler number e,or tau=2*pi.
Pi Declaration and type contract below.
Euler Declaration and type contract below.
Tau Declaration and type contract below.
literal Construct an exact Rational literal Expr at unknownPosition.
variable Construct a named variable Expr at unknownPosition; lookup and limit validation occur during checked processing.
constant Construct a PiEulerTau named-constant Expr at unknownPosition, without numeric evaluation.
unary Given UnaryOp then child Expr, construct an unevaluated unary node at unknownPosition.
binary Given BinaryOp,left Expr,right Expr, construct an unevaluated binary node at unknownPosition.
call Given function name then argument Expr list, construct a call node at unknownPosition.
letIn Given binding name,value Expr,body Expr, construct a lexically scoped let node at unknownPosition.
Limits Explicit resource budgets checked before parsing,evaluation,serialization,and cache growth; start from defaultLimits.
Limits Declaration and type contract below.
maximumSteps Maximum checked evaluation/rewrite instruction steps.
maximumDepth Maximum permitted parser/expression recursion depth.
maximumNodes Maximum expression or compiled-node storage budget.
maximumInputChars Maximum accepted input/serialized text characters.
maximumIntegerBits Maximum exact-integer bit length in checked arithmetic.
maximumCacheEntries Maximum retained compiled-expression cache entries; zero disables retention.
defaultLimits Default expression budgets: 100000 steps, depth 128, 20000 nodes, 100000 input characters, 1024 integer bits and 64 cache entries.
ExprError Structured expression failure with category,source position,and human-readable detail.
ExprError Declaration and type contract below.
errorKind Structured syntax,name,domain,type,nonfinite,unsupported,or resource-error category.
errorPosition Source position attached to the failed operation.
errorMessage Human-readable detail for this expression failure.
ErrorKind Expression error category distinguishing syntaxnametypedomainnonfinite failures from bounded-resource exhaustion and unsupported operations.
SyntaxError Declaration and type contract below.
UnknownName Declaration and type contract below.
TypeMismatch Declaration and type contract below.
DomainFailure Declaration and type contract below.
NonFinite Declaration and type contract below.
StepLimit Declaration and type contract below.
DepthLimit Declaration and type contract below.
MemoryLimit Declaration and type contract below.
InvalidLimits Declaration and type contract below.
Unsupported Declaration and type contract below.
validateLimits Return Right () if all resource budgets fit implementation bounds: steps 1..10000000, depth 1..256, nodes 1..100000, input chars 1..1000000, integer bits 2..8192, cache entries 0..1024.
validateExpression Validate size before traversing arbitrary user-created trees further.
parseExpression Parse with positions and a bounded lexer.
prettyExpression Fully parenthesized, deterministic grammar output.
freeVariables Return sorted distinct variable names free in an Expr, respecting lexical let bindings.
Precision Expression numeric mode: ExactRational retains exact supported rational arithmetic; Float64 uses checked binary64 evaluation.
ExactRational Declaration and type contract below.
Float64 Declaration and type contract below.
Value Evaluation result tagged ExactValue Rational or FloatValue Double.
ExactValue Declaration and type contract below.
FloatValue Declaration and type contract below.
Bindings Map from variable names to tagged expression Values.
Builtin Finite whitelist of supported scalar operations; Registry maps valid names/aliases to these selectors, never arbitrary host code.
Sin Declaration and type contract below.
Cos Declaration and type contract below.
Tan Declaration and type contract below.
Exp Declaration and type contract below.
Log Declaration and type contract below.
Sqrt Declaration and type contract below.
Abs Declaration and type contract below.
Signum Declaration and type contract below.
Floor Declaration and type contract below.
Ceiling Declaration and type contract below.
Min Declaration and type contract below.
Max Declaration and type contract below.
Asin Declaration and type contract below.
Acos Declaration and type contract below.
Atan Declaration and type contract below.
Sinh Declaration and type contract below.
Cosh Declaration and type contract below.
Tanh Declaration and type contract below.
Registry Immutable safe builtin-name registry, initialized with emptyRegistry or defaultRegistry and extended with registerFunction.
defaultRegistry Registry of supported safe scalar builtins (trigonometric/hyperbolic functions, explogsqrt, abssignum, rounding and minmax).
emptyRegistry Construct a registry containing no builtins; callers may add permitted names with registerFunction.
registerFunction Given valid identifier name,Builtin selector,then registry, insert or replace an alias.
allowedFunctions Sorted function and alias names accepted by a registry; no evaluation occurs.
typeCheckExpression Static scalarprecisionname/arity checking.
evaluateExpression Direct left-to-right evaluation.
evaluateText Given limits,precision,registry,bindings,then source text, parse and evaluate under the checked expression budgets.
Compiled Opaque validated expression DAG with common-subexpression sharing and source locations.
compileExpression Compile to a hash-consed DAG.
compiledNodeCount Number of unique DAG instructions after common-subexpression sharing.
evaluateCompiled DAG evaluation memoizes successful nodes only; errors keep the first left-to-right source location.
optimizeExpression Conservative constant folding of literal arithmetic only.
ExpressionCache Immutable FIFO cache.
emptyExpressionCache Construct an empty immutable compiled-expression cache. cachedExpression returns an updated cache explicitly.
cachedExpression Given limits,source text,then cache, return (compiled expression,updated cache), reusing a matching entry when permitted.
cacheSize Return number of retained compiled-source entries; does not compile or evaluate anything.
formatScientific Scientific notation with 0..30 fractional digits, for finite values.
formatRadix Integer radix 2..36; fractional values and nonfinite Double are rejected.
serializeExpression Given limits then Expr, validate its structure and produce versioned safe textual encoding, retaining expression structure.
deserializeExpression Given limits then encoded text, parse the supported serialization and revalidate its structure.
expressionHash Stable FNV-1a over canonical serialization Unicode code points (not UTF-8 bytes).

HMath.Graph.Analysis

API Purpose
bipartiteColors Return Just Bool colors for every vertex if the underlying undirected adjacency is bipartite, including disconnected components; conflicting edges/loops yield Nothing.
greedyColoring Return zero-based greedy colors in vertex order using underlying undirected adjacency.
exactColoring Given work budget then graph with at most 24 vertices, search for a minimum proper coloring.
eulerianPath Hierholzer trail, consuming each original edge identity once.
hamiltonianPath Given search budget then graph, find a path visiting every vertex once, returning Maybe vertex list.
nearestNeighborTour Nearest-neighbor closed tour heuristic; incomplete graphs may fail.
twoOptTour Given improvement-step budget,graph,then closed Hamiltonian tour, improve via pairwise segment reversals.
pageRank Given iteration budget,tolerance,damping,then graph, return vertex PageRank scores with dangling-node redistribution.
degreeCentrality Return outgoing traversal degree divided by n-1 for each vertex; n<=1 yields zeros.
betweennessCentrality Return unweighted shortest-path betweenness by vertex, accounting for shortest-path multiplicities.
closenessCentrality Return unweighted closeness with reachable-component correction: reachable^2((n-1)*sumDistances).
eigenvectorCentrality Shifted power iteration on (I+A), avoiding sign oscillation on bipartite graphs.
katzCentrality Given iterations,tolerance,alpha,beta,then graph, iterate weighted Katz scores.
clusteringCoefficients Return local undirected clustering coefficients from distinct non-self neighbor sets.
density Simple graph density: parallel edges and loops are ignored.
diameterRadius Nothing if disconnected (not strongly connected for directed graphs).
graphLaplacian Given normalized Bool then nonnegative-weight undirected graph, return dense combinatorial or normalized Laplacian rows.
laplacianSpectrum Symmetric Jacobi rotations; eigenvalues sorted ascending.
randomWalk Weighted walk with a reproducible 64-bit SplitMix stream.
labelPropagation Deterministic asynchronous label propagation.
louvain Louvain local modularity moves followed by graph aggregation, repeated until no communities merge.
modularity Given undirected nonnegative-weight graph then one community label per vertex, return weighted modularity.
graphSimilarity Jaccard similarity of labeled weighted edge multisets (vertex labels fixed), counting matching multiplicities.
graphEditDistance Exact unlabeled graph edit distance: unit vertexedge insertiondeletion, edge weights are exact labels; relabeling vertices is free.

HMath.Graph.Core

API Purpose
Graph Opaque validated directed/undirected finite multigraph, constructed with graph or checked conversion functions.
Edge Finite weighted multigraph edge with stable identity and zero-based endpoints.
Edge Declaration and type contract below.
edgeId Stable zero-based identity assigned by original input edge order.
edgeFrom Zero-based source endpoint of the original edge.
edgeTo Zero-based destination endpoint of the original edge.
edgeWeight Finite Double edge weight, retaining loops/parallel-edge identity.
directed Return whether the graph is directed.
vertexCount Return graph vertex count.
edges Return original labeled edges in input order, preserving loops, multiplicity and stable edge IDs.
graph Given directed flag,vertex count,then (from,to,weight) triples, construct a multigraph with stable input-order edge IDs.
arcs Return directed traversal arcs.
neighbors Given graph then vertex, return sorted (destination,weight,edge ID) traversal entries leaving that vertex.
fromAdjacencyList Lossless labeled adjacency-list conversion.
fromLabeledAdjacencyMatrix Given directed flag,square cells of (edge ID,weight) lists,then original edge orientations, reconstruct a lossless graph.
adjacencyList Return one sorted neighbors row per zero-based vertex, retaining weight and edge identity for every traversal arc.
adjacencyMatrix Cells contain every (edge ID,weight), preserving edge multiplicity.
fromAdjacencyMatrix Matrix cells are weights; undirected matrices must be exactly symmetric.
CSR Lossless labeled compressed adjacency storage.
CSR Declaration and type contract below.
csrDirected Whether CSR traversal represents a directed graph.
csrVertices Number of graph vertices, including isolated rows.
csrOffsets Row pointer array of length vertices+1, starting at zero and ending at traversal entry count.
csrTargets Destination vertex for each compressed traversal entry.
csrWeights Finite edge weight for each traversal entry.
csrIds Original edge ID for each traversal entry; an undirected edge contributes two arcs sharing its ID.
csrOrientations Original endpoint orientation for each edge ID, required for lossless undirected round-trip.
toCSR Convert a graph to lossless CSR rows with offsets, targets, weights, IDs and original edge orientations.
fromCSR Validate CSR sizes, offsets, endpointweightID arrays and original orientations, then reconstruct a canonical graph.
BipartiteGraph Validated graph with explicit left/right vertex partition.
bipartiteGraph Given left count,right count,then (left-local,right-local,weight) triples, construct an undirected bipartite graph.
bipartiteParts Return (left vertex count,right vertex count) of a bipartite graph.
bipartiteBase Return underlying undirected graph, whose right-part global labels start at the left-part count.
Hypergraph Validated finite vertex set with canonical sorted distinct vertices per hyperedge.
hypergraph Given vertex count then hyperedge vertex lists, validate bounded size/endpoints and construct a hypergraph.
hyperVertices Return the number of zero-based vertices in a hypergraph.
hyperedges Return canonical hyperedge lists with sorted distinct member vertices, preserving hyperedge list order.
serializeBipartiteGraph Versioned Haskell tuple grammar.
deserializeBipartiteGraph Read a versioned bipartite serialization, then validate part counts, endpoints and weights.
serializeGraph Serialize graph direction, vertex count and input-ordered edges with HMath.Graph/1 marker; stable IDs reconstruct from edge order.
deserializeGraph Read complete HMath.Graph/1 encoding and reconstruct via checked graph constructor.
serializeHypergraph Serialize vertex count and canonical hyperedges with HMath.Hypergraph/1 version marker.
deserializeHypergraph Read versioned hypergraph encoding and validate through hypergraph.
bfs Given graph then valid start vertex, return breadth-first reachable-vertex order with sorted neighbor tie-breaking.
dfs Given graph then valid start vertex, return depth-first reachable-vertex order with deterministic sorted neighbors.
iterativeDeepening Iterative deepening simple-path DFS.
topologicalSort Return a deterministic topological order of all vertices of a directed acyclic graph.
hasCycle Test for a directed or undirected cycle, respecting original edge identities.
connectedComponents Return weak connected components as sorted vertex lists, ignoring edge direction and retaining isolated vertices.
tarjanSCC Tarjan's single-pass index/low-link stack algorithm.
kosarajuSCC Return sorted strongly connected components via Kosaraju traversal; undirected graphs reduce to ordinary connected components.
articulationPoints Removal-based reference algorithms, retaining parallel-edge identity.
bridges Return original IDs of bridges in an undirected multigraph; parallel edges are treated distinctly.
kruskal Return a minimum spanning forest of an undirected weighted graph by Kruskal, breaking ties by stable edge ID.
prim All three MST routines return a minimum spanning forest on disconnected inputs.
boruvka Return an undirected minimum spanning forest by repeatedly merging components along cheapest outgoing edges.
checkVertex Given graph then vertex index, return Right () only for a label in [0,vertexCount).
requireUndirected Return Right () for an undirected graph; directed input returns Left InvalidArgument.
finite Test whether a Double is neither NaN nor infinite; used by checked graph weight/arithmetic validation.

HMath.Graph.Flow

API Purpose
Network Opaque exact network-flow input with stable parallel/antiparallel edges, constructed with network.
NetworkEdge Directed integral-capacity/unit-cost edge with stable identity.
NetworkEdge Declaration and type contract below.
networkEdgeId Stable original edge identity in network input order.
networkFrom Source vertex of this directed network edge.
networkTo Destination vertex of this directed network edge.
networkCapacity Exact nonnegative Integer capacity of this edge.
networkCost Exact Integer cost per unit flow; may be negative.
network Given vertex count then (from,to,capacity,cost) edges, construct an exact integral network with stable edge IDs.
networkEdges Return original network edges in input/ID order, retaining capacities and costs.
FlowResult Exact net flow,total edge cost,and original-edge-order flows.
FlowResult Declaration and type contract below.
flowValue Exact net flow leaving the chosen source.
edgeFlows Exact edge flows in original network edge order, preserving parallel and antiparallel identity.
flowCost Sum of edge flow times edge unit cost; maximum-flow methods do not necessarily minimize this cost.
fordFulkerson Given augmentation budget,network,source,sink, compute exact maximum flow using depth-first augmenting paths.
edmondsKarp Given augmentation budget,network,source,sink, compute exact maximum flow using breadth-first shortest augmenting paths.
dinic Given work budget,network,source,sink, compute maximum flow with level graphs and blocking-flow augmentation.
pushRelabel Given push/relabel work budget,network,source,sink, compute exact maximum flow by preflow and relabel operations.
minimumCut Source-side vertices and cut capacity, using Edmonds--Karp residual reach.
minimumCostMaximumFlow Maximum flow followed by exact negative-residual-cycle cancellation.
hopcroftKarp Hopcroft--Karp layered augmenting paths.
hungarian Rectangular Hungarian primal-dual assignment, rows <= columns <= 256.

HMath.Graph.Paths

API Purpose
dijkstra Given graph then source, return minimum distances in vertex order, with Nothing for unreachable vertices.
multiSourceDijkstra Given graph then source list, return distance to the nearest supplied source, each seeded at zero.
bellmanFord Given graph then source, return minimum distances including negative weights.
floydWarshall Return all-pairs minimum-distance rows, with Nothing for unreachable pairs.
johnson Johnson reweighting: Bellman--Ford potentials from an implicit zero-cost super-source, followed by independent Dijkstra searches.
aStar A* requires a finite consistent heuristic, h(target)=0, checked on all arcs.
bidirectionalDijkstra Two settled-frontier Dijkstra searches, alternating the frontier with the smaller minimum key.
kShortestPaths K cheapest simple vertex paths, best-first expansion, for nonnegative weights.
longestDAGPaths Given directed acyclic graph then source, return maximum path-weight distance to each vertex, Nothing for unreachable vertices.

HMath.Symbolic

API Purpose
Property Symbolic domain fact such as real,positive,nonzero,or sign restrictions, used to guard domain-sensitive identities.
Real Declaration and type contract below.
NonZero Declaration and type contract below.
Positive Declaration and type contract below.
NonNegative Declaration and type contract below.
Integral Declaration and type contract below.
Negative Declaration and type contract below.
NonPositive Declaration and type contract below.
Assumptions Validated variable-property environment.
assumptions Only variable assertions are accepted.
noAssumptions Construct an empty variable-property environment.
proves Given assumptions,requested Property,then Expr, conservatively test whether the fact is established.
SymbolicOptions Expression budgets together with permitted variable assumptions for checked symbolic operations.
SymbolicOptions Declaration and type contract below.
symbolicLimits Expression resource/numeric budgets used by symbolic operations.
symbolicAssumptions Variable facts permitted when proving domain-sensitive rewrites.
defaultSymbolicOptions Default expression budgets with no assumptions; domain-sensitive rules require their preconditions to be proved before rewriting.
normalize Bottom-up folding and conservative canonical ring collection.
simplify Given SymbolicOptions then Expr, simplify within its resource limits and supplied assumptions, preserving domain-sensitive conditions.
expand Distribute products over sums and nonnegative integer powers <=32, with a checked output size at every convolution.
collectTerms Alias of simplify, combining supported like terms under the same assumption and budget checks.
factorPolynomial Exact factorization over Q via the existing bounded Kronecker algorithm.
PolynomialFactorization Exact leading coefficient and symbolic factor/multiplicity pairs; unfactored remainder behavior follows the factorization function.
PolynomialFactorization Declaration and type contract below.
factorLeading Exact scalar leading factor outside the polynomial factors.
factorTerms Symbolic factors paired with positive multiplicities.
rationalSimplify Cancel a rational quotient only when its original denominator is proved nonzero; this preserves holes that ordinary field cancellation would erase.
trigonometricSimplify Given options then Expr, apply supported trigonometric identities such as matching sin-squared plus cos-squared terms, after input validation.
logarithmicSimplify Given options then Expr, apply log productquotientpower rules only when the supplied assumptions establish required real-domain facts.
substitute Alpha-renaming makes simultaneous substitution capture-safe.
Pattern Symbolic rewrite pattern with literalvariableoperator/call structure and binding placeholders.
Any Declaration and type contract below.
Exactly Declaration and type contract below.
UnaryPattern Declaration and type contract below.
BinaryPattern Declaration and type contract below.
CallPattern Declaration and type contract below.
matchPattern Repeated wildcard names must match structurally identical subtrees.
RewriteRule Pattern,replacement expression,and property requirements needed for a valid bounded symbolic rewrite.
RewriteRule Declaration and type contract below.
rewritePattern Pattern to match before applying this rewrite rule.
rewriteReplacement Replacement expression, with matched bindings substituted.
rewriteRequirements Variable properties required to justify the rewrite.
applyRewrite Apply one caller-supplied rule at the root only.
differentiate Differentiate supported elementary real functions.
gradient Given symbolic options,ordered variable names,then scalar expression, return symbolic partial derivatives in that order.
jacobian Given options,ordered variable names,then output-expression list, return one gradient row per output.
hessian Given options,ordered variables,then scalar Expr, return derivatives of each gradient component in the same rowcolumn variable order.
integrateBasic Polynomial primitives and affine expsincos and reciprocal powers.
integrateByParts Integrate a supplied u*dv by recursively reducing polynomial degree when v is an affine exponentialsinecosine primitive.
integrateSubstitution Verified substitution: callers supply an outer expression in a fresh variable t; the integrand must simplify to outer(inner)*inner'.
integrateRational Exact partial fractions; supports all repeated linear poles and simple irreducible quadratic factors.
Direction Limit approach direction: from left,from right,or two-sided.
FromLeft Declaration and type contract below.
FromRight Declaration and type contract below.
TwoSided Declaration and type contract below.
LimitResult Symbolic finite/infinite limit classification,including an explicit does-not-exist or unresolved result.
FiniteLimit Declaration and type contract below.
PositiveInfinity Declaration and type contract below.
NegativeInfinity Declaration and type contract below.
DoesNotExist Declaration and type contract below.
symbolicLimit Exact finite-point rational limits by root multiplicity.
Series Finite symbolic Taylor/Laurent coefficient list with exact center and starting power; no analytic convergence is implied by storage alone.
Series Declaration and type contract below.
seriesCenter Exact Rational expansion center.
seriesMinimumPower Power corresponding to the first coefficient, including negative powers for Laurent series.
seriesTerms Coefficient expressions ordered from seriesMinimumPower upward.
taylorSeries Truncated Taylor coefficients f^(k)(c)/k!, order 0..20.
maclaurinSeries Given options,variable name,order,then Expr, compute the Taylor series centered at zero via taylorSeries.
laurentSeries Rational Laurent coefficients at a rational center, from the lowest power through that power+order.
formalPowerSeries Given options then Rational coefficient list, construct a finite formal jet with at most 64 coefficients, subject to expression numeric budgets.
multiplyFormalSeries Given options then two formal Rational jets, validate and convolve coefficients under the 64-coefficient cap.
reciprocalFormalSeries Given options then formal Rational series with nonzero constant term, compute its reciprocal jet.
toPolynomial Given options,variable name,then Expr, convert a supported univariate exact Rational polynomial.
fromPolynomial Given variable name then exact Rational Polynomial, build an Expr in Horner form.
exactPolynomialRoots Given options,variable name,then polynomial Expr, return rational roots with multiplicities plus the remaining deflated Expr.
numericalPolynomialRoots Bounded Durand-Kerner roots, degree <=32; nonconvergence is explicit.
RelationOp Comparison relation selector: equality,inequality,or ordered less/greater comparisons.
Equal Declaration and type contract below.
NotEqual Declaration and type contract below.
Less Declaration and type contract below.
LessEqual Declaration and type contract below.
Greater Declaration and type contract below.
GreaterEqual Declaration and type contract below.
Relation Symbolic comparison of two expressions; use simplifyRelation to decide or preserve unresolved conditions.
Relation Declaration and type contract below.
RelationResult Decided truth value or unresolved symbolic relation under the provided assumptions.
Truth Declaration and type contract below.
Unresolved Declaration and type contract below.
simplifyRelation Given options then Relation, simplify both sides and return a Boolean Truth when decidable, otherwise a symbolic unresolved relation/conditions.
solveLinearInequality Isolate a single affine variable; multiplying by a negative coefficient flips the inequality.
LinearSolution Symbolic linear-system outcome distinguishing a determined/parametric solution from inconsistency or unresolved computation.
Inconsistent Declaration and type contract below.
ParametricSolution Declaration and type contract below.
solveLinearEquations Exact rational RREF for at most 16 variables/equations.
SymbolicMatrix Checked bounded rectangular expression matrix, constructed with symbolicMatrix.
symbolicMatrix Given options then nonempty rectangular Expr rows, construct a checked symbolic matrix bounded to 8-by-8.
matrixExpressions Extract row-major symbolic expressions without evaluation or simplification.
matrixAdd Given options then equally shaped symbolic matrices, add and simplify corresponding expressions.
matrixMultiply Given options then compatible symbolic matrices, form simplified dot-product entries.
symbolicDeterminant Cofactor determinant, at most 6x6.
Guarded Value paired with mathematical property conditions required for its unconditional use.
Guarded Declaration and type contract below.
guardedValue Result whose validity depends on requiredConditions.
requiredConditions Expression/property facts that must hold before using guardedValue unconditionally.
symbolicEigenvalues Exact 1x1/2x2 real eigenvalue formulas; an unproved discriminant is returned as an explicit NonNegative condition.
numericalSubstitution Given options,precision,bindings list,then Expr, evaluate using the default builtin registry and symbolic limits.
toLaTeX TeX with escaped identifiers; expressions are never interpreted as raw TeX.
toMathML Content MathML, including an explicit lambda application for lexical let.