Professional Documents
Culture Documents
Graph Lecture
Graph Lecture
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Text;
System.Threading.Tasks;
namespace OOP_Lecture_SE_M
{
class graph
{
int[,] mat=new int[3,3];
int[] degree = new int[3];
public void getvalues()
{
Console.WriteLine("Enter values for indexes given below");
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
{
Console.Write(i + " " + j+"
");
mat[i, j] = Convert.ToInt32(Console.ReadLine());
// Console.WriteLine("Value for " + i + " " + j + " is " + ma
t[i, j]);
}
}
public void caldegree()
{
int count = 0;
for (int i = 0; i < 3; i++)
{
count = 0;
for (int j = 0; j < 3; j++)
{
if (mat[i, j] == 1)
count = count + 1;
}
degree[i] = count;
}
}
public void viewdeg()
{
Console.WriteLine("Degree is ");
foreach (int a in degree)
Console.WriteLine(a);
}
int read()
{
int a =Convert.ToInt32( Console.ReadLine());
return a;
}
public void viewgraph()
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
Console.Write(this.mat[i, j]+"\t");
Console.WriteLine();
}
}