Table of Contents

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

graph IEdgeWeightedGraph<TWeight>

The graph to add the edge to.

vertex0 int

The first vertex of the edge to add.

vertex1 int

The second vertex of the edge to add.

weight TWeight

The 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

graph IEdgeWeightedGraph<T>
vertex0 int
vertex1 int

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

graph IEdgeWeightedGraph<TWeight>

The graph to convert.

Returns

IEdgeWeightedDigraph<TWeight>

Type Parameters

TWeight

The type of the edge weights.