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)
LCA (Binary Lifting)Yog.Pathfinding.LCALowest common ancestor in treesO(V log V) preprocess, O(log V) queryO(V log 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)
Capacity ScalingYog.Flow.MaxFlowMaximum flow (scaling)O(E² log U)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)
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)

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)
Tarjan's BridgesYog.Connectivity.BridgeBridge edgesO(V+E)O(V)
Tarjan's ArticulationYog.Connectivity.ArticulationArticulation 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)
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)
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)

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)
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)

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)

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)

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)

Data Structures

StructureModulePurposeOperationsSpace
Pairing HeapYog.PriorityQueuePriority 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 estimationadd: 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)

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)
Kruskal'sYog.Generator.MazeBalanced, randomizedO(N log N)O(N)
Prim'sYog.Generator.MazeRadial, many dead endsO(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)

Underlying Algorithms & Data Structures

Beyond graph algorithms, YogEx implements several fundamental computer science techniques:

Probabilistic Data Structures

TechniqueUsed InPurpose
HyperLogLogReachability.counts_estimate/2Memory-efficient cardinality estimation (O(V) vs O(V²)) for reachability counting with ~3% error

Data Structures

StructureUsed InPurpose
Pairing HeapYog.PriorityQueueO(1) insert, O(log n) amortized delete-min for Dijkstra, A*, Prim's
:queue (Erlang)BFS in MaxFlow, ReachabilityO(1) enqueue/dequeue for FIFO operations
Binary-based HLLReachability1024-byte fixed-size registers for cardinality estimation

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

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 Capacity Scaling
Min-cost max-flowSuccessive Shortest Path
Global min cutStoer-Wagner
Network optimizationNetwork Simplex

Centrality

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