Class EdgeWeightedGraphExtensions
- Namespace
- AlgorithmsSW.EdgeWeightedGraph
- Assembly
- AlgorithmsSW.dll
Provides extension methods for IEdgeWeightedGraph<TWeight>.
public static class EdgeWeightedGraphExtensions
- Inheritance
-
EdgeWeightedGraphExtensions
- Inherited Members
Methods
AddEdge<TWeight>(IEdgeWeightedGraph<TWeight>, int, int, TWeight)
Makes a new Edge<TWeight> and adds it to the graph.
public static Edge<TWeight> AddEdge<TWeight>(this IEdgeWeightedGraph<TWeight> graph, int vertex0, int vertex1, TWeight weight)
Parameters
graphIEdgeWeightedGraph<TWeight>The graph to add the edge to.
vertex0intThe first vertex of the edge to add.
vertex1intThe second vertex of the edge to add.
weightTWeightThe weight of the edge to add.
Returns
- Edge<TWeight>
Type Parameters
TWeight
GetUniqueEdge<T>(IEdgeWeightedGraph<T>, int, int)
public static Edge<T> GetUniqueEdge<T>(this IEdgeWeightedGraph<T> graph, int vertex0, int vertex1)
Parameters
graphIEdgeWeightedGraph<T>vertex0intvertex1int
Returns
- Edge<T>
Type Parameters
T
ToEdgeWeightedDigraph<TWeight>(IEdgeWeightedGraph<TWeight>)
Converts this IEdgeWeightedGraph<TWeight> to an IEdgeWeightedDigraph<TWeight> by adding two edges (in opposite directions) for each edge in the original graph.
public static IEdgeWeightedDigraph<TWeight> ToEdgeWeightedDigraph<TWeight>(this IEdgeWeightedGraph<TWeight> graph)
Parameters
graphIEdgeWeightedGraph<TWeight>The graph to convert.
Returns
- IEdgeWeightedDigraph<TWeight>
Type Parameters
TWeightThe type of the edge weights.