network/network_algorithms library

🌐 Network Algorithms Library

A comprehensive collection of production-grade network algorithms for solving complex graph and network problems efficiently.

This library provides implementations of:

  • Path Finding: A* algorithm with heuristics
  • Maximum Flow: Ford-Fulkerson, Edmonds-Karp, and Dinic's algorithms
  • Connectivity Analysis: Tarjan's algorithm for bridges and articulation points
  • Data Structures: Union-Find/Disjoint Set with path compression

All algorithms are implemented with:

  • Full generic type support (T-variants)
  • Comprehensive error handling
  • Performance optimizations
  • Detailed documentation and examples
  • Production-ready code quality

Classes

AStarNode<T>
Represents a node in the A* search with its f-score (g + h)
AStarResult<T>
A* with path cost calculation
Bridge<T>
Represents a bridge (critical edge) in the graph
DinicsEdge<T>
Represents a flow network edge with capacity and flow
DinicsResult<T>
Dinic's algorithm with detailed analysis and performance metrics
EdmondsKarpEdge<T>
Represents a flow network edge with capacity and flow
EdmondsKarpResult<T>
Edmonds-Karp with detailed flow information and path analysis
FlowEdge<T>
Represents a flow network edge with capacity and flow
FordFulkersonResult<T>
Ford-Fulkerson with detailed flow information
LayeredNode<T>
Represents a node in the layered network with its level
PriorityQueue<T>
Simple priority queue implementation for A* algorithm
TarjansDetailedResult<T>
Enhanced Tarjan's algorithm with detailed analysis
TarjansResult<T>
Result of Tarjan's algorithm containing bridges and articulation points
UnionFindDetailed<T>
Enhanced Union-Find with detailed statistics and analysis
UnionFindNode<T>
Represents a node in the Union-Find data structure

Functions

aStar<T>(Map<T, Map<T, num>> graph, T start, T goal, num heuristic(T node, T goal), {int maxIterations = 10000}) List<T>
A* pathfinding algorithm implementation
aStarWithCost<T>(Map<T, Map<T, num>> graph, T start, T goal, num heuristic(T node, T goal), {int maxIterations = 10000}) AStarResult<T>
dinicsAlgorithm<T>(Map<T, Map<T, num>> graph, T source, T sink) num
Dinic's maximum flow algorithm implementation
dinicsAlgorithmDetailed<T>(Map<T, Map<T, num>> graph, T source, T sink) DinicsResult<T>
edmondsKarp<T>(Map<T, Map<T, num>> graph, T source, T sink) num
Edmonds-Karp maximum flow algorithm implementation
edmondsKarpDetailed<T>(Map<T, Map<T, num>> graph, T source, T sink) EdmondsKarpResult<T>
fordFulkerson<T>(Map<T, Map<T, num>> graph, T source, T sink) num
Ford-Fulkerson maximum flow algorithm implementation
fordFulkersonDetailed<T>(Map<T, Map<T, num>> graph, T source, T sink) FordFulkersonResult<T>
max<T extends num>(T a, T b) → T
Utility function for finding maximum of two numbers
tarjansAlgorithm<T>(Map<T, List<T>> graph) TarjansResult<T>
Tarjan's algorithm for finding bridges and articulation points
tarjansAlgorithmDetailed<T>(Map<T, List<T>> graph) TarjansDetailedResult<T>
Enhanced Tarjan's algorithm with detailed analysis