Question
Translate MATLAB Code Build a random graph (of nodes/cells with no edges connecting them yet). Then build versions of it that have more and more
Translate MATLAB Code
Build a random graph (of nodes/cells with no edges connecting them yet).
Then build versions of it that have more and more edges or arcs that connect pairs of nodes/cells.
Measure the size of the largest connected network in each graph.
Graph that network size as a proportion of the total graph, as a function of the ratio of edges to nodes. When averaged over 10 runs, the curve should look like Erds & Renyis phase transition graph.
Clear your variables
Make a 10 by 50 matrix of zeros in which you will store the results of the 10 runs. Call it allmaxnet
Start a for loop where run goes from 1 to 10
Set x to zero and cells to 100
Start a for loop where edges goes from 5 to 250 in steps of 5
Increment x up by 1
Set m to a cellsXcells matrix of zeros
Start a while loop that continues while the full total sum of m is less than edges
Set i to be a randomly selected cell (but not the last one)
Set j to be a randomly selected cell that is greater then i (iand j are now indices)
Place a 1 in the iXj cell of the m matrix
End the while loop
(Now that a given random graph has been built, you must measure the size of its largest connected network, and sending activation through it can help you do that.)
Make the edges into bidirectional synapse- like connections (add a transposed version of m to m)
Start a for loop where n goes from 1 to cells
Set cellacts to a 1Xcells vector of zeros (this will be used to send activation through the network for identifying the largest connected network in the graph)
Set the nth element of cellacts to 1
Start a for loop where t goes from 1 to cells
Multiply cellacts by m and add that to cellacts
End that for loop
Set the nth element of netsize to the number of nonzero elements in cellacts
End the for loop
Save the max of netsize in the xth element of maxnet
end
the edges loop
save maxnet as the runth row of allaxnet
end
the overall loop
plot a long an x-axis of 0.05 to 2.5, in steps of .05, the mean of allmaxnet
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started