Complete reference of all algorithms implemented in YogEx, organized by category.

Pathfinding

AlgorithmModulePurposeTime ComplexitySpace Complexity
DijkstraYog.Pathfinding.DijkstraSingle-source shortest path (non-negative weights)O((V+E) log V)O(V)
A*Yog.Pathfinding.AStarHeuristic-guided shortest pathO((V+E) log V)O(V)
Bellman-FordYog.Pathfinding.BellmanFordShortest path with negative weights, cycle detectionO(VE)O(V)
Floyd-WarshallYog.Pathfinding.FloydWarshallAll-pairs shortest pathsO(V³)O(V²)
Johnson'sYog.Pathfinding.JohnsonAll-pairs shortest paths in sparse graphsO(V² log V + VE)O(V²)
Bidirectional DijkstraYog.Pathfinding.BidirectionalFaster single-pair shortest pathO((V+E) log V)O(V)
Bidirectional BFSYog.Pathfinding.BidirectionalUnweighted shortest pathO(V+E)O(V)
Yen's K-ShortestYog.Pathfinding.Yenk shortest loopless pathsO(k·N·(E+V log V))O(kV)
Widest PathYog.PathfindingMaximum bottleneck capacity pathO((V+E) log V)O(V)
Unweighted SSSPYog.PathfindingBFS shortest path (no heap)O(V+E)O(V)
Brandes SSSPYog.Pathfinding.BrandesSingle-source dependency accumulationO(VE)O(V²)
Chinese PostmanYog.Pathfinding.ChinesePostmanShortest route visiting every edgeO(V³)O(V²)
LCA (Binary Lifting)Yog.Pathfinding.LCALowest common ancestor in treesO(V log V) preprocess, O(log V) queryO(V log V)
Path UtilitiesYog.Pathfinding.PathPath reconstruction and manipulationO(V)O(V)
Distance MatrixYog.Pathfinding.MatrixMatrix-based distance operationsO(V²)O(V²)
All-Pairs UnweightedYog.PathfindingParallel BFS all-pairs shortest pathsO(V(V+E))O(V²)
Suurballe'sYog.Pathfinding.DisjointFinds two edge-disjoint shortest paths of minimum total costO((V+E) log V)O(V)

Flow & Cuts

AlgorithmModulePurposeTime ComplexitySpace Complexity
Edmonds-KarpYog.Flow.MaxFlowMaximum flow (BFS augmenting paths)O(VE²)O(V+E)
Dinic'sYog.Flow.MaxFlowMaximum flow (blocking flow)O(V²E)O(V+E)
Successive Shortest PathYog.Flow.SuccessiveShortestPathMin-cost max-flowO(F · E log V)O(V+E)
Network SimplexYog.Flow.NetworkSimplexMinimum cost flow (large instances)Empirically near-polynomial; worst-case exponentialO(V+E)
Stoer-WagnerYog.Flow.MinCutGlobal minimum cutO(V³)O(V²)

Spanning Tree

AlgorithmModulePurposeTime ComplexitySpace Complexity
Kruskal'sYog.MSTMST via edge sortingO(E log E)O(V)
Prim'sYog.MSTMST via vertex growingO(E log V)O(V)
Borůvka'sYog.MSTParallel MSTO(E log V)O(V)
Edmonds'Yog.MSTMinimum Spanning Arborescence (Directed)O(VE)O(V)
Wilson'sYog.MSTUniform Spanning Tree (Probabilistic)O(V) hit timeO(V)
Max Spanning TreeYog.MSTMaximum weight treeO(E log E)O(V)

Matching

AlgorithmModulePurposeTime ComplexitySpace Complexity
Hopcroft-KarpYog.MatchingMaximum bipartite matchingO(E√V)O(V)
HungarianYog.MatchingMinimum/maximum weighted bipartite matchingO(V³)O(V²)
BlossomYog.MatchingMaximum matching in general graphsO(V³)O(V²)

Connectivity & Components

AlgorithmModulePurposeTime ComplexitySpace Complexity
Tarjan's SCCYog.ConnectivityStrongly connected componentsO(V+E)O(V)
Kosaraju's SCCYog.ConnectivityStrongly connected components (two-pass)O(V+E)O(V)
Connected ComponentsYog.ConnectivityUndirected connected componentsO(V+E)O(V)
Weakly Connected ComponentsYog.Connectivity.ComponentsDirected graph components (ignore direction)O(V+E)O(V)
Tarjan's BridgesYog.Connectivity.AnalysisBridge edgesO(V+E)O(V)
Tarjan's ArticulationYog.Connectivity.AnalysisArticulation pointsO(V+E)O(V)
K-CoreYog.Connectivity.KCoreCore decompositionO(V+E)O(V)
Reachability ExactYog.Connectivity.ReachabilityAncestor/descendant countingO(V+E)O(V²)
Reachability HLLYog.Connectivity.ReachabilityHyperLogLog reachability estimationO(V+E)O(V)

Centrality Measures

AlgorithmModulePurposeTime ComplexitySpace Complexity
Degree CentralityYog.CentralitySimple connectivity importanceO(V+E)O(V)
Closeness CentralityYog.CentralityDistance-based importanceO(VE + V² log V)O(V)
Harmonic CentralityYog.CentralityDistance-based (handles infinite)O(VE + V² log V)O(V)
Betweenness CentralityYog.CentralityBridge/gatekeeper detectionO(VE) or O(V³)O(V²)
PageRankYog.CentralityLink-quality importanceO(k(V+E))O(V)
HITSYog.CentralityHub and authority scoresO(k(V+E))O(V)
Eigenvector CentralityYog.CentralityInfluence from neighborsO(k(V+E))O(V)
Katz CentralityYog.CentralityAttenuated influence propagationO(k(V+E))O(V)
Alpha CentralityYog.CentralityExternal influence modelO(k(V+E))O(V)

Community Detection

AlgorithmModulePurposeTime ComplexitySpace Complexity
LouvainYog.Community.LouvainModularity optimizationO(E log V)O(V)
LeidenYog.Community.LeidenQuality-guaranteed communitiesO(E log V)O(V)
Label PropagationYog.Community.LabelPropagationVery large graphs, speedO(kE)O(V)
WalktrapYog.Community.WalktrapRandom-walk communitiesO(V² log V)O(V²)
InfomapYog.Community.InfomapInformation-theoreticO(kE)O(V)
Girvan-NewmanYog.Community.GirvanNewmanHierarchical edge betweennessO(E²V)O(V²)
Clique PercolationYog.Community.CliquePercolationOverlapping communitiesO(3^(V/3))O(V²)
Fluid CommunitiesYog.Community.FluidCommunitiesExact k partitionsO(kE)O(V)
Local CommunityYog.Community.LocalCommunitySeed expansionO(S × E_S)O(S)

Community Metrics

AlgorithmModulePurposeTime ComplexitySpace Complexity
TransitivityYog.Community.MetricsGlobal clustering coefficientO(Δ²E)O(V)
Local Clustering CoefficientYog.CommunityPer-node clustering coefficientO(Δ²E)O(V)
Average Clustering CoefficientYog.CommunityGlobal average clusteringO(Δ²E)O(V)
Triangle CountYog.CommunityGlobal or per-node trianglesO(Δ²E)O(V)
Community DensityYog.CommunityPer-community edge densityO(E)O(V)
ModularityYog.CommunityPartition quality scoreO(E)O(V)
AlgorithmModulePurposeTime ComplexitySpace Complexity
BFSYog.TraversalBreadth-first explorationO(V+E)O(V)
DFSYog.TraversalDepth-first explorationO(V+E)O(V)
Topological SortYog.TraversalDAG vertex orderingO(V+E)O(V)
Find PathYog.TraversalAny path between nodesO(V+E)O(V)
Implicit SearchYog.Traversal.ImplicitOn-demand graph traversalO((V+E) log V)O(V)
Kahn's AlgorithmYog.Traversal.SortTopological sort (BFS-based)O(V+E)O(V)
Lexicographical TopSortYog.Traversal.SortDeterministic topological orderingO((V+E) log V)O(V)
Best-First WalkYog.Traversal.WalkPriority-guided traversalO((V+E) log V)O(V)
Random WalkYog.Traversal.WalkStochastic path explorationO(k)O(1)
BFS PathYog.Traversal.WalkBFS shortest path between nodesO(V+E)O(V)

Graph Transformations

AlgorithmModulePurposeTime ComplexitySpace Complexity
TransposeYog.TransformReverse edge directionsO(1)O(1)
SubgraphYog.TransformInduced subgraph by node IDsO(V+E)O(V+E)
Ego GraphYog.Transformk-hop neighborhood subgraphO(V+E)O(V+E)
Transitive ClosureYog.TransformReachability matrixO(V³)O(V²)
Transitive ReductionYog.TransformMinimal equivalent DAGO(V³)O(V²)
Quotient GraphYog.TransformPartition-based contractionO(V+E)O(V+E)
ContractYog.TransformMerge two nodesO(deg(u)+deg(v))O(V+E)
Filter NodesYog.TransformPredicate-based subgraphO(V+E)O(V+E)
Filter EdgesYog.TransformPredicate-based edge removalO(E)O(E)

Graph Properties

AlgorithmModulePurposeTime ComplexitySpace Complexity
Bipartite CheckYog.Property.Bipartite2-colorability testO(V+E)O(V)
Bipartite PartitionYog.Property.BipartiteTwo-color assignmentO(V+E)O(V)
Max Bipartite MatchingYog.Property.BipartiteMaximum matchingO(VE)O(V)
Stable MarriageYog.Property.BipartiteGale-Shapley stable matchingO(V²)O(V)
Acyclicity TestYog.Property.CyclicityCycle detectionO(V+E)O(V)
Eulerian CircuitYog.Property.EulerianEulerian cycle existenceO(V+E)O(V)
Eulerian PathYog.Property.EulerianEulerian path existenceO(V+E)O(V)
Bron-KerboschYog.Property.CliqueAll maximal cliquesO(3^(V/3))O(V)
Max CliqueYog.Property.CliqueLargest cliqueO(3^(V/3))O(V)
Complete GraphYog.Property.StructureKₙ detectionO(V²)O(1)
Tree CheckYog.Property.StructureTree verificationO(V+E)O(V)
Forest CheckYog.Property.StructureDisjoint treesO(V+E)O(V)
Branching CheckYog.Property.StructureDirected forestO(V+E)O(V)
Planarity TestYog.Property.StructureExact LR-test planarityO(V²)O(V)
Planar EmbeddingYog.Property.StructureCombinatorial embeddingO(V²)O(V)
Kuratowski WitnessYog.Property.StructureNon-planar subgraphO(V²)O(V)
Chordality TestYog.Property.StructureChordal graph verificationO(V+E)O(V)
Graph ColoringYog.Property.ColoringGreedy and exact coloringO(V²)–O(V!)O(V)
Tree DecompositionYog.Property.TreeDecompositionValidity checking and constructionO(V²)–O(V³)O(V²)
IsomorphismYog.PropertyWeisfeiler-Lehman equalityO(k(V+E))O(V)
Graph HashYog.PropertyStructural fingerprintO(k(V+E))O(V)

DAG Algorithms

AlgorithmModulePurposeTime ComplexitySpace Complexity
Longest PathYog.DAG.AlgorithmCritical path in weighted DAGO(V+E)O(V)
Shortest PathYog.DAG.AlgorithmShortest path in DAGO(V+E)O(V)
Transitive ClosureYog.TransformReachability matrixO(V³)O(V²)
Transitive ReductionYog.TransformMinimal equivalent DAGO(V³)O(V²)
LCAYog.Pathfinding.LCALowest common ancestorsO(V log V) preprocess, O(log V) queryO(V log V)
Topological GenerationsYog.DAGLayer-by-layer orderingO(V+E)O(V)
SourcesYog.DAGIn-degree 0 nodesO(V+E)O(V)
SinksYog.DAGOut-degree 0 nodesO(V+E)O(V)
AncestorsYog.DAGAll ancestors of a nodeO(V+E)O(V)
DescendantsYog.DAGAll descendants of a nodeO(V+E)O(V)
Single-Source DistancesYog.DAGSSSP in DAGO(V+E)O(V)
Path CountYog.DAGNumber of distinct pathsO(V+E)O(V)

Graph Operations

AlgorithmModulePurposeTime ComplexitySpace Complexity
UnionYog.OperationGraph unionO(V+E)O(V+E)
IntersectionYog.OperationGraph intersectionO(V+E)O(V+E)
DifferenceYog.OperationGraph differenceO(V+E)O(V+E)
Symmetric DifferenceYog.OperationXOR of graphsO(V+E)O(V+E)
Cartesian ProductYog.OperationGraph productO(V₁V₂ + E₁E₂)O(V₁V₂)
Power GraphYog.Operationk-th powerO(k(V+E))O(V+E)
Line GraphYog.OperationEdge-to-vertex dualO(V+E)O(E)
TransposeYog.OperationReverse all edgesO(V+E)O(V+E)
IsomorphismYog.OperationGraph equalityO(V!) worstO(V)
SubgraphYog.OperationInduced subgraphO(V+E)O(V+E)
Subgraph CheckYog.OperationSubgraph relationshipO(V+E)O(V+E)
Graph CompositionYog.OperationRelational graph compositionO(V₁E₂ + V₂E₁)O(V₁V₂)
Graph ComplementYog.OperationInverse edge setO(V²)O(V²)
Disjoint UnionYog.OperationUnion with re-indexingO(V+E)O(V+E)
Map NodesYog.OperationTransform node dataO(V)O(V)
Map EdgesYog.OperationTransform edge weightsO(E)O(E)
Filter NodesYog.OperationPredicate-based node removalO(V+E)O(V+E)
Filter EdgesYog.OperationPredicate-based edge removalO(E)O(E)
Relabel NodesYog.OperationRename node IDsO(V+E)O(V+E)

Multigraph

AlgorithmModulePurposeTime ComplexitySpace Complexity
Eulerian CircuitYog.Multi.EulerianHierholzer with edge IDsO(V+E)O(V+E)
Eulerian PathYog.Multi.EulerianOpen Eulerian walkO(V+E)O(V+E)
BFSYog.Multi.TraversalEdge-ID aware BFSO(V+E)O(V)
DFSYog.Multi.TraversalEdge-ID aware DFSO(V+E)O(V)
Fold WalkYog.Multi.TraversalStateful traversalO(V+E)O(V)
Cycle CheckYog.MultiMultigraph cycle detectionO(V+E)O(V)
Topological SortYog.MultiMultigraph topological orderingO(V+E)O(V)
To Simple GraphYog.MultiCollapse parallel edgesO(V+E)O(V+E)

Health Metrics

AlgorithmModulePurposeTime ComplexitySpace Complexity
DiameterYog.HealthLongest shortest pathO(V(V+E))O(V)
RadiusYog.HealthMinimum eccentricityO(V(V+E))O(V)
EccentricityYog.HealthMax distance from nodeO(V+E)O(V)
AssortativityYog.HealthDegree correlationO(E)O(1)
APLYog.HealthAverage path lengthO(V(V+E))O(V)
Global EfficiencyYog.HealthInverse mean distanceO(V(V+E))O(V)
Local EfficiencyYog.HealthNeighborhood efficiencyO(V(V+E))O(V)

Random Graph Generation

AlgorithmModulePurposeTime ComplexitySpace Complexity
Erdős-Rényi (GNP)Yog.Generator.RandomFixed probability per edgeO(V²)O(V+E)
Erdős-Rényi (GNM)Yog.Generator.RandomFixed number of edgesO(V²)O(V+E)
Barabási-AlbertYog.Generator.RandomPreferential attachmentO(VE)O(V+E)
Watts-StrogatzYog.Generator.RandomSmall-world networksO(V²)O(V+E)
Random TreeYog.Generator.RandomUniform random treeO(V)O(V)
Random RegularYog.Generator.RandomFixed-degree random graphO(VD)O(V+E)
SBMYog.Generator.RandomStochastic Block ModelO(V²)O(V+E)
DCSBMYog.Generator.RandomDegree-Corrected SBMO(V²)O(V+E)
HSBMYog.Generator.RandomHierarchical SBMO(V²)O(V+E)
Configuration ModelYog.Generator.RandomGiven degree sequenceO(V+E)O(V+E)
Power Law GraphYog.Generator.RandomScale-free networkO(VE)O(V+E)
KroneckerYog.Generator.RandomRecursive matrix productO(V+E)O(V+E)
R-MATYog.Generator.RandomRecursive matrix modelO(E log V)O(V+E)
GeometricYog.Generator.RandomDistance-threshold graphO(V²)O(V²)
WaxmanYog.Generator.RandomProbabilistic distance graphO(V²)O(V²)

Classic Graph Generators

AlgorithmModulePurposeTime ComplexitySpace Complexity
Complete GraphYog.Generator.ClassicKₙ generatorO(V²)O(V²)
Cycle GraphYog.Generator.ClassicCₙ generatorO(V)O(V)
Path GraphYog.Generator.ClassicPₙ generatorO(V)O(V)
Star GraphYog.Generator.ClassicSₙ generatorO(V)O(V)
Wheel GraphYog.Generator.ClassicWₙ generatorO(V)O(V)
Complete BipartiteYog.Generator.ClassicKₘ,ₙ generatorO(m·n)O(m+n)
Binary TreeYog.Generator.ClassicFull binary treeO(V)O(V)
K-ary TreeYog.Generator.ClassicFull k-ary treeO(V)O(V)
Complete K-aryYog.Generator.ClassicComplete k-ary treeO(V)O(V)
CaterpillarYog.Generator.ClassicSpine with leavesO(V)O(V)
Grid 2DYog.Generator.ClassicRectangular latticeO(V)O(V)
Petersen GraphYog.Generator.ClassicFamous 10-node graphO(1)O(1)
Empty GraphYog.Generator.ClassicN isolated nodesO(V)O(V)
HypercubeYog.Generator.ClassicQₙ generatorO(V log V)O(V log V)
LadderYog.Generator.ClassicLadder graphO(V)O(V)
Circular LadderYog.Generator.ClassicPrism graphO(V)O(V)
Möbius LadderYog.Generator.ClassicMöbius-Kantor variantO(V)O(V)
FriendshipYog.Generator.ClassicWindmill FₙO(V)O(V)
WindmillYog.Generator.ClassicGeneralized windmillO(V)O(V)
Book GraphYog.Generator.ClassicStacked trianglesO(V)O(V)
Crown GraphYog.Generator.ClassicSₙ⁻ generatorO(V²)O(V²)
Turán GraphYog.Generator.ClassicT(n,r) extremal graphO(V²)O(V²)
Platonic SolidsYog.Generator.ClassicTetrahedron, Cube, Octahedron, Dodecahedron, IcosahedronO(1)O(1)

Graph Builders

AlgorithmModulePurposeTime ComplexitySpace Complexity
GridYog.Builder.Grid2D grid/lattice graphO(V)O(V)
Grid GraphYog.Builder.GridGraphGrid with diagonal edgesO(V)O(V)
ToroidalYog.Builder.ToroidalWrap-around gridO(V)O(V)
Toroidal GraphYog.Builder.ToroidalGraphTorus with diagonalsO(V)O(V)
Labeled BuilderYog.Builder.LabeledNamed node constructionO(V+E)O(V+E)
Live BuilderYog.Builder.LiveIncremental graph buildingO(V+E)O(V+E)

Functional Graphs (FGL-style)

AlgorithmModulePurposeTime ComplexitySpace Complexity
Topological SortYog.Functional.AlgorithmsInductive graph topsortO(V+E)O(V)
Shortest PathYog.Functional.AlgorithmsInductive SSSPO(V+E)O(V)
DistancesYog.Functional.AlgorithmsAll distances from sourceO(V+E)O(V)
Prim MSTYog.Functional.AlgorithmsInductive MSTO(E log V)O(V)
SCCYog.Functional.AlgorithmsInductive strongly connected componentsO(V+E)O(V)
Biconnected ComponentsYog.Functional.AnalysisMaximal non-separable subgraphsO(V+E)O(V)
DominatorsYog.Functional.AnalysisImmediate dominators (flow graphs)O(V²)O(V²)
PreorderYog.Functional.TraversalVisit-order node IDsO(V+E)O(V)
PostorderYog.Functional.TraversalFinish-order node IDsO(V+E)O(V)
ReachableYog.Functional.TraversalAll reachable node IDsO(V+E)O(V)
MatchYog.Functional.ModelDecompose node + contextO(1)O(1)
EmbedYog.Functional.ModelInsert node contextO(1)O(1)

Layout

AlgorithmModulePurposeTime ComplexitySpace Complexity
CircularYog.Layout.CircularSpaces nodes uniformly along a circleO(V)O(V)
RandomYog.Layout.RandomDistributes nodes randomly in a bounding boxO(V)O(V)
SpringYog.Layout.SpringFruchterman-Reingold force-directed layoutO(I · (V² + E))O(V)
TutteYog.Layout.TutteBarycentric planar layout pinning boundary nodesO(I · (V + E))O(V)
ShellYog.Layout.ShellArranges nodes in concentric circle shellsO(V)O(V)
MultipartiteYog.Layout.MultipartiteLayers partitioned nodes in parallel rows/columnsO(V)O(V)

Rendering

AlgorithmModulePurposeTime ComplexitySpace Complexity
ASCII RenderYog.Render.ASCIITerminal visualizationO(V+E)O(V+E)
DOT ExportYog.Render.DOTGraphviz DOT formatO(V+E)O(V+E)
Mermaid ExportYog.Render.MermaidMermaid.js diagram formatO(V+E)O(V+E)
SVG RenderYog.Render.SVGPure Elixir SVG generator (with multigraph, curved parallel edges, self-loops, and arrowhead marker offsets)O(V+E)O(V+E)
Vega-Lite RenderYog.Render.VegaLiteVega-Lite JSON plot specificationO(V+E)O(V+E)

Data Structures

StructureModulePurposeOperationsSpace
Pairing HeapYog.PairingHeapPriority queue for Dijkstra/Priminsert: O(1), delete-min: O(log n) amortizedO(n)
Disjoint SetYog.DisjointSetUnion-Find for Kruskal/SCCfind: O(α(n)), union: O(α(n))O(n)
HyperLogLogYog.Connectivity.ReachabilityCardinality estimation (~3% error, 1024-byte registers)add: O(1), count: O(1)O(1) fixed
:queueErlang stdlibFIFO for BFSenqueue/dequeue: O(1)O(n)

Maze Generation

AlgorithmModulePurposeTime ComplexitySpace Complexity
LollipopYog.Generator.ClassicKₘ connected to PₙO(m+n)O(m+n)
BarbellYog.Generator.ClassicTwo cliques + pathO(m+n)O(m+n)
Tutte GraphYog.Generator.ClassicNon-Hamiltonian polyhedralO(1)O(1)
Sedgewick MazeYog.Generator.ClassicClassic 8-node mazeO(1)O(1)
Binary TreeYog.Generator.MazeSimplest, fastestO(N)O(1)
SidewinderYog.Generator.MazeVertical corridorsO(N)O(cols)
Recursive BacktrackerYog.Generator.MazeClassic "roguelike" passagesO(N)O(N)
Hunt-and-KillYog.Generator.MazeOrganic, windingO(N²)O(1)
Aldous-BroderYog.Generator.MazeUniform spanning treeO(N²)O(N)
Wilson'sYog.Generator.MazeEfficient uniform treeO(N) avgO(N)
Kruskal'sYog.Generator.MazeBalanced, randomizedO(N log N)O(N)
Prim's (Simplified)Yog.Generator.MazeRadial, many dead endsO(N log N)O(N)
Prim's (True)Yog.Generator.MazeTrue Prim mazeO(N log N)O(N)
Eller'sYog.Generator.MazeInfinite height potentialO(N)O(cols)
Growing TreeYog.Generator.MazeMeta-algorithm (versatile)O(N)O(N)
Recursive DivisionYog.Generator.MazeFractal, room-basedO(N log N)O(log N)

Approximation Algorithms

AlgorithmModulePurposeTime ComplexitySpace Complexity
DiameterYog.ApproximateMulti-sweep lower boundO(k(V+E))O(V)
BetweennessYog.ApproximateSampled BrandesO(k(V+E))O(V)
Avg Path LengthYog.ApproximatePivot samplingO(k(V+E))O(V)
Global EfficiencyYog.ApproximatePivot samplingO(k(V+E))O(V)
TransitivityYog.ApproximateWedge samplingO(k)O(V)
Vertex CoverYog.ApproximateGreedy 2-approximationO(V+E)O(V)
Max CliqueYog.ApproximateGreedy heuristicO(V²)O(V)

I/O & Serialization

FormatModulePurposeDirection
GDFYog.IO.GDFGUESS / Gephi formatRead/Write
GEXFYog.IO.GEXFGraph Exchange XML FormatRead/Write
GraphMLYog.IO.GraphMLGraph Markup LanguageRead/Write
Graph6Yog.IO.Graph6Compact undirected graph encodingRead/Write
Sparse6Yog.IO.Sparse6Compact sparse graph encodingRead/Write
JSONYog.IO.JSONMultiple JSON variants (D3, Cytoscape, VisJs, NetworkX)Read/Write
LEDAYog.IO.LEDALibrary of Efficient Data types and Algorithms formatRead/Write
PajekYog.IO.PajekSocial network analysis .net formatRead/Write
TGFYog.IO.TGFTrivial Graph FormatRead/Write
Matrix MarketYog.IO.MatrixMarketScientific sparse matrix exchangeRead/Write
Adjacency ListYog.IO.ListText-based adjacency listRead/Write
Adjacency MatrixYog.IO.MatrixDense matrix representationRead/Write
LibgraphYog.IO.LibgraphInterop with libgraph libraryConvert

Legend

  • V: Number of vertices/nodes
  • E: Number of edges
  • k: Number of iterations (for iterative algorithms)
  • α(n): Inverse Ackermann function (effectively constant < 5)
  • O(V!): Factorial worst case (isomorphism via brute force)

Algorithm Selection Guide

flowchart TD
    A[What problem are you solving?] --> B[Shortest path]
    A --> C[Flow / cuts]
    A --> D[Spanning tree]
    A --> E[Matching]
    A --> F[Community detection]
    A --> G[Centrality]
    A --> H[Connectivity]
    A --> I[Traversal]

    B --> B1[Edge weights?]
    B1 -->|Unweighted| BFS
    B1 -->|Heuristic available| AStar[A*]
    B1 -->|Non-negative weights| B2[Single pair or all pairs?]
    B2 -->|Single pair| Dijkstra
    B2 -->|All pairs| B3[Graph density?]
    B3 -->|Sparse| Johnson[Johnson's]
    B3 -->|Dense| Floyd[Floyd-Warshall]
    B1 -->|Negative weights| BF[Bellman-Ford]

    C --> C1[Which flow problem?]
    C1 -->|Max flow| Dinic[Dinic's / Edmonds-Karp]
    C1 -->|Min-cost flow| C2[Instance size?]
    C2 -->|Small / medium| SSP[Successive Shortest Path]
    C2 -->|Large| NS[Network Simplex]
    C1 -->|Global min cut| SW[Stoer-Wagner]

    D --> D1[What kind of spanning tree?]
    D1 -->|Dense graph| Prim[Prim's]
    D1 -->|Sparse graph| Kruskal[Kruskal's]
    D1 -->|Directed| Edmonds[Edmonds']
    D1 -->|Maximum weight| MaxST[Max Spanning Tree]

    E --> E1[What kind of matching?]
    E1 -->|Bipartite unweighted| HK[Hopcroft-Karp]
    E1 -->|Bipartite weighted| Hungarian[Hungarian]
    E1 -->|General graph| Blossom[Blossom]

    F --> F1[Priority?]
    F1 -->|Speed| LP[Label Propagation]
    F1 -->|Quality guarantee| Leiden[Leiden]
    F1 -->|Modularity| Louvain[Louvain]
    F1 -->|Overlapping| CP[Clique Percolation]

    G --> G1[What to measure?]
    G1 -->|Simple importance| Degree[Degree]
    G1 -->|Distance-based| Closeness[Closeness / Harmonic]
    G1 -->|Bridge detection| Betweenness[Betweenness]
    G1 -->|Link quality| PageRank[PageRank]

    H --> H1[What structure?]
    H1 -->|Strongly connected components| SCC[Tarjan's / Kosaraju's]
    H1 -->|Connected components| CC[Connected Components]
    H1 -->|Bridge edges| Bridges[Tarjan's Bridges]
    H1 -->|Articulation points| Artic[Tarjan's Articulation]

    I --> I1[Traversal order?]
    I1 -->|Level-order| BFS_T[BFS]
    I1 -->|Depth-first| DFS[DFS]
    I1 -->|DAG ordering| Topo[Topological Sort]

For an interactive version of this decision tree, see the YogEx Algorithm Selector livebook in the Choreo project.

Shortest Path

ScenarioAlgorithm
Non-negative weights, single pairDijkstra
Non-negative weights, all pairsJohnson's (sparse) or Floyd-Warshall (dense)
Negative weights allowedBellman-Ford
Negative cycle detectionBellman-Ford or Floyd-Warshall
Heuristic availableA*
Unweighted graphBFS or Bidirectional BFS

Community Detection

ScenarioAlgorithm
Large graph, speed priorityLabel Propagation
Quality guarantee neededLeiden
Modularity optimizationLouvain
Overlapping communitiesClique Percolation
Exact k partitionsFluid Communities
Hierarchical structureGirvan-Newman

Flow Problems

ScenarioAlgorithm
Max flow, general caseDinic's or Edmonds-Karp
Min-cost max-flowSuccessive Shortest Path
Large min-cost flow instancesNetwork Simplex
Global min cutStoer-Wagner

Centrality

ScenarioMeasure
Simple importanceDegree
Distance-basedCloseness or Harmonic
Bridge detectionBetweenness
Link qualityPageRank
Hub/authorityHITS

Spanning Tree

ScenarioAlgorithm
Dense graphsPrim's
Sparse graphsKruskal's
Parallel / distributed settingBorůvka's
Directed minimum spanning arborescenceEdmonds'
Uniform random spanning treeWilson's
Maximum weight spanning treeMax Spanning Tree

Matching

ScenarioAlgorithm
Maximum bipartite matchingHopcroft-Karp
Minimum/maximum weighted bipartite matchingHungarian
Maximum matching in general graphsBlossom

Connectivity & Components

ScenarioAlgorithm
Strongly connected components (directed)Tarjan's SCC or Kosaraju's SCC
Connected components (undirected)Connected Components
Bridge edgesTarjan's Bridges
Articulation pointsTarjan's Articulation
Core decompositionK-Core
Approximate reachability countingReachability HLL

Traversal & Search

ScenarioAlgorithm
Unweighted shortest path / level-order explorationBFS
Exhaustive search / cycle detectionDFS
DAG vertex orderingTopological Sort or Kahn's Algorithm
Deterministic DAG orderingLexicographical TopSort
Heuristic-guided traversalBest-First Walk

Graph Properties

ScenarioAlgorithm
Cycle detectionAcyclicity Test
Bipartiteness checkBipartite Check
Eulerian path/circuit existenceEulerian Path / Eulerian Circuit
Planarity testPlanarity Test
All maximal cliquesBron-Kerbosch
Largest clique (heuristic)Max Clique