Tag Info

2

Here's an alternative approach that does the work in VertexRenderingFunction: $redDisks = {11, 23}; TreePlot[{11 -> 23, 11 -> 24, 23 -> 40, 23 -> 39, 24 -> 30, 24 -> 50, 40 -> 55, 40 -> 45}, VertexLabeling -> All, PlotStyle -> {FontSize -> 13}, VertexRenderingFunction -> ({EdgeForm[White], If[MemberQ[$redDisks, ...

4

ar = ConstantArray[RGBColor[113/255, 190/255, 236/255], 55]; ar[[{11, 23}]] = Red; TreePlot[{11 -> 23, 11 -> 24, 23 -> 40, 23 -> 39, 24 -> 30, 24 -> 50, 40 -> 55, 40 -> 45}, VertexLabeling -> All, PlotStyle -> {FontSize -> 13}, VertexRenderingFunction -> ({EdgeForm[White], ar[[#2]], ...

1

I suspected LayeredGraphPlot may be helpful. I post this in case it assists in achieving goal. m = {{5}, {4, 6}, {3, 5, 7}, {2, 4, 6, 8}}; r = Range[10]; rule = Thread[r -> Flatten[m]]; f[a_, b_] := MapThread[Function[{x, y}, {x, #} & /@ y] , {a, b}]; rag = Internal`PartitionRagged[r, {1, 2, 3, 4}]; u =Rule @@@Flatten[f[#1, Partition[#2, 2, 1]] ...

1

Transpose[#[[1]]] + #[[2]] &[PadRight[{s, t}, {2, -5, 5}]]

2

t = {{1}, {1, 2}, {1, 2, 3}, {1, 2, 3, 4}} tm = Prepend[t, {}]; a = PadRight[#, 5] & /@ tm a + 10 Transpose[a] // MatrixForm UPDATE Exploiting the much better and more concise advice in comment by ybeltukov: b = ArrayPad[PadRight@t, {{1, 0}, {0, 1}}] b + 10 Transpose[b] // MatrixForm

2

Very verbose but I was trying to find a different way :) Reverse[Flatten@ Pick[m, Normal@ SparseArray[{{i_, j_} /; Abs[j + i] == # -> 1}, {4, 4}], 1] & /@ Range[2, 5], 2]

2

We want to extract the index of the upper left triangular position using the positions: {1,1} {2,1} {1,2} {3,1} {2,2} {1,3} ⋮ The following function using Table uses the algorithm so that the row increments and then decrements as the column increments (not sure the words make sense but look at the algorithm below). lut1[m_] := Table[ Table[ m[[j - ...

3

upperOffTriag[m_] := With[ {i = Table[Table[{n, k + 1 - n}, {n, k, 1, -1}], {k, 1, First@Dimensions[m]}]}, Map[Part[m, Sequence @@ #] &, i, {2}] ] upperOffTriag[m] {{1}, {5, 2}, {9, 6, 3}, {13, 10, 7, 4}}

6

m = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}}; MapThread[m[[##]] &, {Reverse@Range@#, Range@#}] & /@ Range@Length@m {{1}, {5, 2}, {9, 6, 3}, {13, 10, 7, 4}}

6

Just to show a less elegant way :) f[m_] := Apply[m[[##]] &, Table[{i - j + 1, j}, {i, Length@m}, {j, i}], {2}] f@m (*{{1}, {5, 2}, {9, 6, 3}, {13, 10, 7, 4}}*)

5

Here's a different version, much more verbose. m = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}}; DeleteCases[#, 0]&@*Reverse /@ Transpose @ UpperTriangularize @ MapThread[RotateRight[#1, #2] &, {m, Range[0, Length@m - 1]}] Here's another one, slightly less verbose: MapIndexed[Reverse@#1[[;; First@#2]] &, ...

5

Two functions to consider: Diagonal and Reverse Your data: m = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}} Solution Reverse@Table[ Reverse@Diagonal[Reverse /@ m, k], {k, 0, Length[m] - 1}] {{1}, {5, 2}, {9, 6, 3}, {13, 10, 7, 4}} Function: lut[m_] := Reverse@Table[ Reverse@Diagonal[Reverse /@ m, k], {k, 0, Length[m] - ...

Top 50 recent answers are included