2020-02-21 02:43:25 +00:00
|
|
|
namespace MoonTools.Graph.Extensions
|
2019-10-24 08:10:49 +00:00
|
|
|
{
|
|
|
|
public static class UnweightedExtensions
|
|
|
|
{
|
|
|
|
public static void AddEdge<TGraph, TNode>(this TGraph g, TNode v, TNode u) where TGraph : Graph<TNode, Unit>, IUnweightedGraph<TNode, Unit> where TNode : System.IEquatable<TNode>
|
|
|
|
{
|
|
|
|
g.AddEdge(v, u, default(Unit));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void AddEdges<TGraph, TNode>(this TGraph g, params (TNode, TNode)[] edges) where TGraph : Graph<TNode, Unit>, IUnweightedGraph<TNode, Unit> where TNode : System.IEquatable<TNode>
|
|
|
|
{
|
|
|
|
foreach (var (v, u) in edges)
|
|
|
|
{
|
|
|
|
g.AddEdge(v, u, default(Unit));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-02-21 02:43:25 +00:00
|
|
|
}
|