General assumptions on input graphs
Stay organized with collections
Save and categorize content based on your preferences.
The following are the general assumptions that the algorithms make on the input
graphs. Individual algorithm pages document additional requirements.
Input graphs can have at most \(2^{31} - 1\) nodes.
Nodes are identified by consecutive integer node IDs \(0, 1, ..., n-1\).
Input graphs may be directed or undirected. In a directed graph, each edge
has a source node and a destination node. In an undirected graph, edges have
no direction.
In a directed graph, for any two nodes there is at most one edge from one to
the other (but there may be edges in both directions). In an undirected
graph, for any two nodes there is at most one edge between them.
Input graphs may have self-loops (edges connecting a node to itself).
Each edge has an associated weight, which must be a finite floating-point
number (\(\pm\infty\) and NaN are not allowed). If the weight of an edge is
not explicitly provided, it defaults to 1.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-05-27 UTC."],[],[]]