The OD cost matrix finds and measures the least-cost paths along the network from multiple origins to multiple destinations. When configuring an OD cost matrix analysis, you can specify the number of destinations to find and a maximum distance to search.
In the graphic below, the OD cost matrix found the least-cost paths from each origin to the four nearest destinations. The output shape type was set to produce straight lines.