(* some network pictures are created:
sierpinski net
*)
sierpinski net
*)
<< /swolf/Complexity/Programs/Phred/MSource/Network.m
sier[topdir_, leftdir_, rightdir_, size_, org_] := Union[Join[sier[rt, leftdir, up, size/2, org], sier[lt, up, rightdir, size/2, org + {size/2, 0}], sier[topdir, rt, lt, size/2, org + {0, size/2}] ]]sier[topdir_, leftdir_, rightdir_, 1, org_] := {siernode[leftdir, org], siernode[rightdir, org + {1, 0}], siernode[topdir, org + {0, 1}], sieredge[up, leftdir, org, rightdir, org + {1, 0}], sieredge[lt, rightdir, org + {1, 0}, topdir, org + {0, 1}], sieredge[rt, topdir, org + {0, 1}, leftdir, org] }
unitrt = {1, 0};
unituprt = {0, 1};
unituplt = {-1, 1};
unituprt = {0, 1};
unituplt = {-1, 1};
General::spell1:
Possible spelling error: new symbol name unituplt
is similar to existing symbol unituprt.
Possible spelling error: new symbol name unituplt
is similar to existing symbol unituprt.
eps = 1/6.5;siernode[up, spot_] := {dot[spot + eps unitrt], dot[spot + eps unituprt], dot[spot + eps unituplt], dot[spot - eps unitrt], edge[3, spot - eps unitrt, spot + eps unitrt], edge[1, spot + eps unitrt, spot + eps unituprt], edge[1, spot + eps unituprt, spot + eps unituplt], edge[1, spot + eps unituplt, spot - eps unitrt] }siernode[lt, spot_] := {dot[spot + eps unituplt], dot[spot - eps unitrt], dot[spot - eps unituprt], dot[spot - eps unituplt], edge[3, spot - eps unituplt, spot + eps unituplt], edge[1, spot + eps unituplt, spot - eps unitrt], edge[1, spot - eps unitrt, spot - eps unituprt], edge[1, spot - eps unituprt, spot - eps unituplt] }siernode[rt, spot_] := {dot[spot - eps unituprt], dot[spot - eps unituplt], dot[spot + eps unitrt], dot[spot + eps unituprt], edge[3, spot + eps unituprt, spot - eps unituprt], edge[1, spot - eps unituprt, spot - eps unituplt], edge[1, spot - eps unituplt, spot + eps unitrt], edge[1, spot + eps unitrt, spot + eps unituprt] }sieredge[up, dir1_, spot1_, dir2_, spot2_] := {edge[2, spot1 + eps unitrt, spot2 - eps unitrt], edge[2, spot2 - eps unitrt, spot1 + eps unitrt]}sieredge[lt, dir1_, spot1_, dir2_, spot2_] := {edge[2, spot1 + eps unituplt, spot2 - eps unituplt], edge[2, spot2 - eps unituplt, spot1 + eps unituplt]}sieredge[rt, dir1_, spot1_, dir2_, spot2_] := {edge[2, spot1 - eps unituprt, spot2 + eps unituprt], edge[2, spot2 + eps unituprt, spot1 - eps unituprt]}
majordistance = 25;dot[coords_] := Node[coords, NodePosition -> majordistance slant[coords], NodeSize -> .9]edge[lab_, start_, end_] := Arc[{start, end}, ArcLabel -> None, (* ArcLabelPosition -> .5, ArcLabelDistance -> 3, ArcLabelSide -> Left, ArcLabelFont -> {"Univers", 4.5}, *) ArcArrow -> True, ArcArrowPosition -> .5, ArcArrowSize -> 1.3, ArcArrowFlare->1, ArcStyle -> Circle, ArcThickness -> .25, ArcCircleHeight -> Switch[lab, 1, N[Sqrt[3]-2], 2, .2, 3, -1]]
slant[{x_, y_}] := N[{x + y/2, y * Sqrt[3] / 2}]
sier2net = Network[sier[lt, rt, lt, 2, {0,0}]] ;
sier2grf = NetworkGraphics[sier2net] ;
Show[sier2grf] ;
SetDirectory["/swolf/Complexity/Programs/NetworkSystems/PhredDimensions"];
WriteNetwork["sier2.phred", sier2net]
WriteNetwork["sier2.phred", sier2net]
Wrote 24 nodes.
Wrote 42 arcs.
Wrote 42 arcs.
sier8net = Network[sier[lt, rt, lt, 8, {0,0}]] ;
sier8grf = NetworkGraphics[sier8net] ;
Show[sier8grf] ;
SetDirectory["/swolf/Complexity/Programs/NetworkSystems/PhredDimensions"];
WriteNetwork["sier8.phred", sier8net]
WriteNetwork["sier8.phred", sier8net]
Wrote 168 nodes.
Wrote 330 arcs.
Wrote 330 arcs.
sier8grfhair = ReplacePart[sier8grf, {sier8grf[[1]], whisker[{0,0}, -unituprt], whisker[{0,0}, -unituplt], whisker[{8,0}, }, 1]