Example #1
0
    public static void Main(string[] args)
    {
        Friend a = new Friend("A");
        Friend b = new Friend("B");
        Friend c = new Friend("C");

        a.AddFriendship(b);
        b.AddFriendship(c);
        Console.WriteLine(a.CanBeConnected(c));
    }
    public static void Main(string[] args)
    {
        Friend a = new Friend("A");
        Friend b = new Friend("B");
        Friend c = new Friend("C");
        Friend d = new Friend("D");
        Friend e = new Friend("E");

        a.AddFriendship(b);
        a.AddFriendship(c);

        b.AddFriendship(a);
        b.AddFriendship(c);

        c.AddFriendship(a);
        c.AddFriendship(b);

        a.AddFriendship(d);
        d.AddFriendship(e);

        Console.WriteLine(b.CanBeConnected(e, "BFS"));
        Console.WriteLine(b.CanBeConnected(e, "DFS"));
        Console.WriteLine(b.CanBeConnected(e, "BiDirectional"));
    }