Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Introduction

You are a computational neuroscientist working on simulations of neural networks. You have data representing a very large feed-forward network and wish to create a computer simulation for further study. The network can be modelled as a graph with vertices representing neurons and directed edges representing connections between them. In order to calculate the output of a neuron, you need to first calculate the output of all neurons that connect to it (note: this particular feed-forward network has no cycles). So a topological sort will give a possible evaluation order for the network.

Assignment Specification - Part A

For this part of the assignment, you will be given a network and a starting state. Your program will then calculate the subsequent state of the network. Forneurons that have no inputs, the new state will be the same as the current state. For other neurons, a very simple neuron model will be used:

for each neuron v: input = 0

for each edge uv:
 input += weight(uv)*state(u)

if input>0: state(v)= 1
else:
state(v)= 0

You must use the following data structures to represent the graph as an adjacency list:

typedef struct edge{ int toVertex; int weight;
} Edge;

typedef struct edgeNode{ Edge edge;
struct edgeNode *next;
} *EdgeList;

typedef struct graph{ int V;
int *state; EdgeList *edges;
} Graph;

For testing purposes you will input the graph data from the keyboard and/orusing input redirection (as for assignment 1). The input format is as follows:

- The first line will contain the number of vertices ( neurons) in the graph
- Then for each vertex:
o The first line contains the initial state of that vertex
o The second line contains the number of edges from that vertex
o The third line contains a list of toVertex, weight pairs separated by spaces (if there are no edges, this line is omitted)

For example, the following text would define a 7 vertex graph:

7
1
2
6,1 3,-2
0
1
4,4
1
3
4,-2 3,1 0,3
1
0
1
1
3,2
0
4
6,2 3,-4 2,1 0,-3
1
3
5,2 4,-1 3,4

The edge weights will be in the range -100 to +100; states will be either 0 or 1.

Your program should use the queue based topological sort method based on in-degrees to determine an evaluation order for the graph. Then working through the vertices in this topologically sorted order to calculate the next state of each neuron. The output should be the new state of all neurons after this calculation (on a single line). So the initial state of the vertex above would be printed as:

1011101

Assignment Specification - Part B

You find that the topological sort can take a long time for some graphs, and you would also like to be able to detect cycles. So you decide to test whether a depth first search based topological sort gives better performance.

For this part of the assignment, you will implement DFS for the input graph, and use the post- order numbering of the DFS spanning tree to determine if there are any cycles. [Note: you don't have to actually build a separate DFS spanning tree to calculated the post-order numbering] If there are no cycles, you should then use the post-order numbering to calculate a topological sort and calculate and print the new state of the graph as for part A. Otherwise, the program should print an error message: "this graph contains at least one cycle".

There is however, as light complication. The procedure for DFS described in lectures assumes a single known starting vertex. That is not the case for this data, where in general we will have many "input" neurons. In this situation, we usually build a DFS forest by repeated application of the algorithm.

For this assignment, two solutions to this problem will be allowed:

1. Implement an algorithm that builds a DFS spanning forest. You will find examples of this approach online.

2. Use the previously calculated in-degrees to identify "input" neurons (the ones with in-degree 0). Then (conceptually) add a new vertex to the graph with edges to each of these inputs. Make this new vertex the starting point for your DFS. [Note: you don't have to actually add the vertex to the graph, just proceed as though it does exist]

The first approach has the advantage that it is the standard way to deal with this problem, so you will find more help online. The second approach has the advantage that it matches what was discuss in lectures more closely and may be a little simpler to understand.

Attachment:- Data.rar

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91774793

Have any Question?


Related Questions in Computer Engineering

Assignmentthe results of the spec cpu2006 bzip2 benchmark

Assignment The results of the SPEC CPU2006 bzip2 benchmark running on an AMD Barcelona has an instruction count of 2.389E12, an execution time of 750 s, and a reference time of 9650 s. 1) Find the CPI if the clock cycle ...

Question what is the relationship between programming and

Question : What is the relationship between programming and networking, and do you think that the United States has lost some of its economic advantage in these fields to other parts of the world?

You have a deck of magic the gathering cards with 60 cards

You have a deck of Magic the Gathering cards with 60 cards total. In the deck you have 20 Mana cards, 18 Spells, 3 Artifacts, 12 Creatures, 6 Enchantments and 1 Planes Walker. What is the probability that you draw 2 arti ...

Question suppose direction is an integer angle between 0

Question : Suppose direction is an integer angle between 0 and 359 degrees. You turn by a given angle and update the direction as direction = (direction + turn) % 360; In which situation do you get the wrong result? How ...

Write a java console application that calculates and

Write a java console application that calculates and displays the bank interest for N bank accounts. N should be declared as a constant and it should be equal to the largest digit of your student ID number (e.g. if your ...

What is the supply curve how do you apply the law of supply

What is the supply curve, how do you apply the law of supply in economics?

Whats your answer about the equilibrium change from an

What's your answer about the equilibrium change from an event which decreases both demand and supply? You don't need to provide graph here. Just describe the curve shifts and how the equilibrium price and equilibrium qua ...

Current system analysis and modelling assignment 1

Current System Analysis and Modelling Assignment 1 - Assignment overview - This assignment aims to produce a requirements document that captures the functional requirements for an information system that supports the cur ...

Review the interactive session on pages 50 and 51 in

Review the Interactive Session on pages 50 and 51 in Management Information Systems: Managing the Digital Firm (11th ed.) of your text. It discusses Air Canada. Answer "Case Study Questions" 1 through 3 on page 51. 1. Ho ...

Question suppose you are organizing a party for a large

Question : Suppose you are organizing a party for a large group of your friends. Your friends are pretty opinionated, though, and you don't want to invite two friends if they don't like each other. So you have asked each ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As