summaryrefslogtreecommitdiffstats
path: root/Vertex.cs
blob: 31a40b4847bf5c4818572992ed6ead39b0251ace (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System;
using System.Collections.Generic;
using PriorityQueue;
using PriorityQueue.Interfaces;

namespace Graph
{
    public class Vertex<T> : Node<T>, INode<T> where T : IComparable<T>
    {
        public int? Parent { get; set; } = null;
        public List<Edge<T>> Edges { get; set; } = new List<Edge<T>>();

        public Vertex(int id) : base(id) { }

        public Vertex(int id, List<Edge<T>> edges) : this(id) => 
            Edges = edges;

        public override string ToString() => $"{Id} {String.Join(" ", Edges)}";
    }
}