Пжлста, вот, то, что есть на СИ:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace DvusvyaZannost
{ public partial class Form1 : Form
{ public Form1()
{ InitializeComponent();
}
public static int y = 10, x = 5, startind;
private void button1_Click(object sender, EventArgs e)
{ }
private void Form1_Load(object sender, EventArgs e)
{ }
private void menuItem2_Click(object sender, EventArgs e)
{
int[,] mas = new int[textBox1.Lines.Length, textBox1.Lines.Length];
int[] per = new int[textBox1.Lines.Length];
ArrayList al = new ArrayList(10);
for (int i = 0; i < textBox1.Lines.Length; i++)
{
string str = (textBox1.Lines[i]).Trim();
string[] st = str.Split(' ');
for (int j = 0; j < textBox1.Lines.Length; j++)
{
mas[i, j] = int.Parse(st[j].Trim());
if (mas[i, j] == 1) per[i]++;
} }
int kol = 0,min = 10;
for (int i = 0; i < per.Length; i++)
{
if (per[i] == 1) kol++;
}
int[,] masx = new int[textBox1.Lines.Length - kol, textBox1.Lines.Length - kol];
int coaf = 0;
for (int i = 0; i < textBox1.Lines.Length; i++)
{
if (per[i] == 1)
{
for (int j = 0; j < textBox1.Lines.Length; j++)
{
if (mas[i, j] == 1)
{
coaf = j;
for (int g = 0; g < textBox1.Lines.Length - kol; g++)
{
if (g == i) i++;
for (int h = 0; h < textBox1.Lines.Length - kol; h++)
{
if (j == h) j++;
masx[g, h] = mas[i, j];
}}}
pictureBox1.Refresh();
Graphics gr = pictureBox1.CreateGraphics();
SolidBrush brh=new SolidBrush(Color.Red);
Font fr=new Font("Times New Roman",15);
string s = "т. " + coaf.ToString() + " т. двусвязанности";
gr.DrawString(s, fr, brh, new Point(x, y));
y += 15;
s=i.ToString()+" "+coaf.ToString()+" компонента двусвяз";
gr.DrawString(s, fr, brh, new Point(x, y));
y += 15;
gr.Dispose();
}}
int indnext = 0, indput = 0;
int[] put = new int[textBox1.Lines.Length];
for (int i = 0; i < (textBox1.Lines.Length - kol); i++)
{
for (int j = 0; j < (textBox1.Lines.Length - kol); j++)
{
if (masx[i, j] == 1)
{
indnext = j;
break;
}}
put[indput] = indnext;
indput++;
for (int j = 0; j < (textBox1.Lines.Length - kol); j++)
{
if (masx[indnext, j] == 1 && per[j] > per[indnext] && indnext != j)
{
indnext = j;
}}
for (int j = 0; j < indput; j++)
{
if (put[j] == indnext)
{
goto End;
}}}
End: Graphics grt = pictureBox1.CreateGraphics();
SolidBrush br = new SolidBrush(Color.Red);
Font f = new Font("Times New Roman", 14);
string strt = "т. " + indnext.ToString() + " т. двусвязанности";
grt.DrawString(strt, f, br, new Point(x, y));
y += 15;
string strok="";
for (int i = 0; i < indnext; i++)
{
if (mas[indnext, i] == 1)
{
strok += " " + i.ToString();
}}
strok =indnext+strok+" компонента двусвяз.";
strok.TrimStart();
grt.DrawString(strok, f, br, new Point(x, y));
y += 15;
strok="";
for (int i = indnext; i < (textBox1.Lines.Length - kol); i++)
{
if (mas[indnext, i] == 1)
{
strok +=" "+i.ToString();
}}
strok = indnext.ToString() + strok+" компонента двусвяз.";
grt.DrawString(strok, f, br, new Point(x, y));
}
private void menuItem5_Click(object sender, EventArgs e)
{
AboutBox ab = new AboutBox();
ab.ShowDialog();
}
private void menuItem3_Click(object sender, EventArgs e)
{
this.Close();
}}}