So I have this array of points, in the form {x, {y,z}}, where x is the node number assigned when I used the locator pane to make a network, and y and z are its unitary coordinates. The graph is made up of two distinct node types, let's call them A and B. I want to be able to distinguish these two by assigned different shapes to their nodes and also want to connect the network how it originally was and using Primm's Algorithm (Minimum Spanning Tree). I was wondering how I go about it. I should also probably mention that from this network I am going to run some Monte Carlo Simulations on it.

The code I have so far is:

graphicslist = 
  Table[Rectangle[mpg[[i, 2]] , mpg[[i, 2]] + {.005, .005}], {i, 1, Length@mpg}];

where mpg is the array of my nodes and their coordinates. This returns:

enter image description here

Small sample of the mpg:

mpg == ({{1, {0.0996, 0.4195}}, {2, {0.1046, 0.392}}, {3, {0.1144, 
 0.468}}, {4, {0.1164, 0.4415}}, {5, {0.1432, 
 0.4455}}, {6, {0.1442, 0.376}}, {7, {0.147, 0.5085}}, {8, {0.16, 
 0.4965}}, {9, {0.1628, 0.5305}}, {10, {0.1708, 0.484}}.......

Here the integer is the node number and the following decimals are the unitary coordinates of its corresponding vertex. In the real Maryland Power Grid, there are two distinct vertices; loads and generators. I plotted, using the locator pane, all of its vertices and wish to differentiate which one are loads and which are generators rather than just have squares for both of them.

  • $\begingroup$ Hello David, It would be helpful to include code in your post showing what you have tried. $\endgroup$ – Verbeia Jul 27 '14 at 22:45
  • $\begingroup$ I haven't really tried any code yet because I am fairly new to Mathematica and don't really know how to start or try it. $\endgroup$ – David Jul 27 '14 at 22:45
  • $\begingroup$ Do you mean either x == A or x == B? And the objective is to distinguish those two groups in the graph above by using different point markers? And when you reconnect the graph, what are the vertices/edges? $\endgroup$ – mfvonh Jul 27 '14 at 23:28
  • $\begingroup$ I modeled group A of vertices in the array the first hundred and the rest are the second distinct group, B. I want to connect the network like it originally was. I am modeling a power grid network and want the edges that are actually connected to be connected. Then I also want another model of the minimum spanning tree of the network. $\endgroup$ – David Jul 27 '14 at 23:37
  • 1
    $\begingroup$ "I want to connect the network like it originally was." If all you have are the coordinates of the points, how can anyone possibly know what the network originally was? $\endgroup$ – Rahul Jul 28 '14 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.