summaryrefslogtreecommitdiffstats
path: root/Edge.cs
blob: 9b311699617eab9f4032297f2630da1c1d676875 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;

namespace Graph
{
    public struct Edge<T> where T : IComparable<T>
    {
        public int U { get; }
        public int V { get; }
        public T Weight { get; }

        public Edge(int u, int v, T weight)
        {
            U = u;
            V = v;
            Weight = weight;
        }

        public int CompareTo(Edge<T> edge) =>
            Weight.CompareTo(edge.Weight);

        public override string ToString() => $"{U} {V} {Weight}";
    }
}