Question

# Build a class MyGraph to implement a Graph ADT(Abstract Data Type) using Adjacency Matrix with the following

functions. I would encourage to use numpy library for matrix operations:

a.Make construction which takes a parameter n. The function should make an adjacency matrix of n x n

size.

b. Make function AddUndirectEdge which takes two parameters src and dst and make an undirected edge

between src and dst.

c. Make function AddDirectedEdge which takes two parameters src and dst and make a directed edge

between src and dst.

d. Make function AddUndirectWegihtEdge which takes three parameters src , dst, and w and make an

undirected edge between src and dst with weight w.

e. Make function AddDirectedWegihtEdge which takes three parameters src , dst, and w and make a

directed edge between src and dst with weight w.

f. Make function IsEdge which takes two parameters src and dst and returns True if there is an edge

between src and dst, otherwise returns false.

g. Make function IsPath which takes two parameters src and dst and returns True if there is a path

between src and dst, otherwise returns False.

h. Make function ReadGraph which takes a parameter filename to read the graph from the file and returns

an object of MyGraph instance to represent that graph.

The format of file is given below:

The first line of the file contains one integer N. The next N lines contain N integers separated by space

Example 1: A graph with three vertices

3

0 1 1

1 0 1

1 1 0

Example 2: A graph with 2 vertices

2

0 1

1 0

Example 3: a graph with three vertices

3

0 5 0

4 0 2

3 2 0

**@@@@@@@@@@@ Code Template: @@@@@@@@@@@@**

**import numpy as np**

**class MyGraph:**

** def __initialize__(self, n):**

** pass**

** def AddUndirectEdge(self, src, dst):**

** pass**

** def AddDirectedEdge(self, src, dst):**

** pass**

** def AddUndirectWegihtEdge(self, src, dst, w):**

** pass**

** **

** def AddDirectedWegihtEdge(self, src, dst, w):**

** pass**

** def IsEdge(self, src, dst):**

** pass**

** def IsPath(self, src, dst):**

** pass**

** def ReadGraph(filename):**

** pass**

### Recently Asked Questions

- what is object model

- Develop a C# console application that will implement one method that will return an integer value, one void method that will calculate an average, and one void

- I have a program i have written and i am sharing a picture of what the output should look like. However, my averages are all showing up as 0? Everything else