public static bool SetBidirectionalEdge <T>(this IDirectedGraph <T> graph, Vertex <T> firstVertex, Vertex <T> secondVertex, int weight) where T : IEquatable <T> { if (graph is null) { throw new ArgumentNullException(nameof(graph)); } return(graph.SetEdge(firstVertex, secondVertex, weight) && graph.SetEdge(secondVertex, firstVertex, weight)); }