C # Deep priority traversal structure Algorithm

Source: Internet
Author: User

N hasn't done any WinForm program about C # For a long time, and has been studying asp.net programs.

Today, a friend asked me a question like deep graph traversal. At first I didn't know how to start. I asked baidu and google, and I saw an example written in C ++, by the way, I learned about it and found that I forgot about it (including: Data Structure). I can only think of the first Hello Worl example I learned when I first started learning vs2003, create a console application.

Next, open VS2005 and create a new project.> Project> console application.

The Code is as follows:

Code 1 using System;
2 using System. Collections. Generic;
3 using System. Text;
4 using System. Collections;
5
6 namespace ConsoleApplication2
7 {
8 class Program
9 {
10 static void Main (string [] args)
11 {
12 Graph graph = new Graph ();
13 graph. addVertex ();
14 graph. addVertex (B );
15 graph. addVertex (C );
16 graph. addVertex (D );
17 graph. addVertex (E );
18 graph. addVertex (F );
19 graph. addVertex (G );
20 graph. addVertex (H );
21 graph. addEdge (A, B );
22 graph. addEdge (B, D );
23 graph. addEdge (B, E );
24 graph. addEdge (E
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.