Calculate the subsequent state of the network

Assignment Help Data Structure & Algorithms
Reference no: EM131050373 , Length: 70

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

Reference no: EM131050373

Questions Cloud

Determine the probability that both contain diet soda : There are 4 cans of diet soda (D) were placed in a 36 pack of regular soda (R). Suppose that two cans are randomly selected from the 36-pack. (a) Determine the probability that both contain diet soda and
What are the differences between each strategy : What are the differences between each strategy? Which one of these backup strategies, or another of your choosing, will you use and why?
Construct a stem and leaf diagram from the data : Construct a stem and leaf diagram from the data in Problem 1 using one stem for the scores in the 50s, 60s, 70s, 80s, and 90s.
Calculate the value of pearson correlation coefficient : The following data on fertility rates illustrate seven European countries. The covariance between the mean age at childbearing and the total fertility rate is -0.06.  Using this information and the information provided in the table below, calculat..
Calculate the subsequent state of the network : KIT205 Data Structures and Algorithms - calculate the subsequent state of the network. Forneurons that have no inputs, the new state will be the same as the current state.
If the bonds yield to maturity changes : Suppose a ten-year, $1,000 bond with an 8.2% coupon rate and semiannual coupons are trading for $1,035.33. What is the bond's yield to maturity? (expressed as an APR with semiannual compounding) (Two decimal places) If the bond's yield to maturity ch..
Report for the ceo of your organisation or of organisation : This assignment gives you the opportunity to apply the knowledge developed in the IT & Business Alignment Unit. You are required to apply this knowledge by writing a report for the CEO of your organisation or of an organisation with which you are ..
About the declining growth stock valuation : Brushy Mountain Mining Company's coal reserves are being depleted, so its sales are falling. Also, environmental costs increase each year, so its costs are rising. As a result, the company's earnings and dividends are declining at the constant rate o..
Statistical abstract of the united states : 1. The Statistical Abstract of the United States published by the U.S. Census Bureau reports that the average annual consumption of fresh fruit per person is 99.9 pounds. The standard deviation of fresh fruit consumption is about 30 pounds.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  1 what are the different applications of data structure2

1. what are the different applications of data structure?2. what are the basic limitations of linear array?3.

  Suppose n gt 1 is a natural number and f z rarrn 0 is the

1. find q and r as defined in the division algorithm when a 549 and b 2362. suppose n gt 1 is a natural number and f

  How the two versions of the algorithm compare

A brief introduction of the sorting algorithm that you have selected and how the two versions of the algorithm compare.

  What is the data type

What is the data type and What is the type of the parameter

  Write a procedure for deleting a key from a b-tree

Write a procedure for deleting a key from a B-tree. Write a new version of Tautology for which the logical expressions are stored in n-ary trees.

  How to analyse spectrum of a digital signal using dft method

To learn how to analyse spectrum of a digital signal using DFT method. To learn how to perform I/O operations using interrupt method and program/implement them using the evaluation toolkit

  Finding the values of queuefront and queuerear

Assume that queue is a queue type object and the size of the array-implementing queue is 100. Also, assume that the value of the queueFront is 25 and the value of queueRear is twenty-five.

  Give and compare the heights of the two trees

- First insert them sequentially into a binary search tree. - Next reinsert them into an empty AVL tree, restoring the AVL property after each insertion. Show the AVL tree which results after each insertion.

  Find the mean number of rounds per contention period

Two CSMA/CD stations are each trying to transmit long documents. After each frame is sent, they contend for the channel using the binary exponential backoff algorithm.

  Discuss some of the emerging trends in information

Discuss some of the emerging trends in information(e.g. computer hardware, software and data analysis

  Design a recursive algorithm to implement

Design a recursive algorithm to implement this specification. That is, the body of FindLast should contain a recursive call FindLast(A,..,..).

  Show how the box can be used to factor n

That is, given a quadratic residue y, the box outputs an x with x2 = y (equation is modulo n). Show how the box can be used to factor n.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd