This Code
produces a directed graph:
SeedRandom[12];
mat = RandomReal[{0, 2}, {5, 5}];
select[matrix_, lB_, uB_] := matrix*Map[Boole[lB <= # <= uB] &, matrix, {-1}];
sa = SparseArray[select[mat, .1, .4]];
weightedG = Graph[sa["NonzeroPositions"], EdgeWeight -> sa["NonzeroValues"],
DirectedEdges -> True, VertexLabels -> Automatic]
I like to attach a variable:
emp = {10, 45, 2, 1, 49};
to each vertex using bubbles with different sizes based on the variable emp
, that is, the bubble size of vertex 1 should be a normalized size (i.e., 10/107), for vertex 2 (45/107), and so on. Elements of the variable emp
are associated with five vertices {1,2,3,4,5}, respectively.
The final directed graph should be one with vertices of different bubble sizes.
select[...]
, then the number of linkages and vertices also change. This change should be carried out in the selection of elements inemp
. At present, the code works only for the digraph with 5 vertices. $\endgroup$