-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample_graph3D.nb
More file actions
137 lines (131 loc) · 4.19 KB
/
sample_graph3D.nb
File metadata and controls
137 lines (131 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 12.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 4134, 129]
NotebookOptionsPosition[ 3835, 116]
NotebookOutlinePosition[ 4181, 131]
CellTagsIndexPosition[ 4138, 128]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[{
RowBox[{
RowBox[{"gr1", "=",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"j", "\[UndirectedEdge]",
RowBox[{"FromDigits", "[",
RowBox[{
RowBox[{"Drop", "[",
RowBox[{
RowBox[{"IntegerDigits", "[",
RowBox[{"j", ",", "2"}], "]"}], ",", "1"}], "]"}], ",", "2"}],
"]"}]}], ",",
RowBox[{"{",
RowBox[{"j", ",", "0", ",",
RowBox[{
RowBox[{"2", "^", "8"}], "-", "1"}]}], "}"}]}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"gr2", "=",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"#1", "\[UndirectedEdge]", "#2"}], ")"}], "&"}], "@@@",
RowBox[{"RandomInteger", "[",
RowBox[{"100", ",",
RowBox[{"{",
RowBox[{"300", ",", "2"}], "}"}]}], "]"}]}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"gr3", "=",
RowBox[{
RowBox[{"GridGraph", "[",
RowBox[{"{",
RowBox[{"3", ",", "6", ",", "4"}], "}"}], "]"}], "//", "EdgeList"}]}],
";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{
RowBox[{"Graph3D", "[",
RowBox[{
RowBox[{"#", "//",
RowBox[{
RowBox[{"Append", "[",
RowBox[{"#", ",",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"#", "\[UndirectedEdge]", "#"}], ")"}], "&"}], "@",
RowBox[{"(",
RowBox[{"num", "=",
RowBox[{"(",
RowBox[{
RowBox[{"Length", "@", "#"}], "+", "1"}], ")"}]}], ")"}]}],
")"}]}], "]"}], "&"}]}], "\[IndentingNewLine]", ",",
RowBox[{"GraphLayout", "\[Rule]",
RowBox[{"{",
RowBox[{"\"\<StarEmbedding\>\"", ",",
RowBox[{"Center", "\[Rule]", "num"}]}], "}"}]}],
"\[IndentingNewLine]", ",",
RowBox[{"GraphStyle", "->", "\"\<LargeNetwork\>\""}],
"\[IndentingNewLine]", ",",
RowBox[{"ImageSize", "\[Rule]", "Large"}]}], "\[IndentingNewLine]",
"]"}], "&"}], "@",
StyleBox[
RowBox[{"(", "gr1", ")"}],
FontColor->RGBColor[0, 0, 1]]}], "//", "SimpleGraph"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"Show", "[",
RowBox[{"#", ",",
RowBox[{"Graphics3D", "[",
RowBox[{"{",
RowBox[{
RowBox[{"Opacity", "[", ".5", "]"}], ",",
RowBox[{"Sphere", "[",
RowBox[{
RowBox[{"{",
RowBox[{"0", ",", "0", ",", "0"}], "}"}], ",", "1"}], "]"}]}],
"}"}], "]"}], ",",
RowBox[{"Lighting", "->", "\"\<Neutral\>\""}]}], "]"}], "&"}], "@",
"%"}]}], "Input",
CellChangeTimes->{{3.791021233624132*^9, 3.7910214074719*^9}, {
3.791021487891265*^9, 3.791022275716614*^9}, {3.7910223127548437`*^9,
3.791022364915609*^9}, {3.791022480482065*^9, 3.791022629104288*^9}, {
3.7910226604855547`*^9, 3.79102279306988*^9}, {3.791022834106715*^9,
3.791022905300314*^9}, {3.791022988030882*^9, 3.791022992865541*^9}, {
3.791023213051835*^9, 3.7910232316746683`*^9}, {3.7910233915869017`*^9,
3.791023478226008*^9}},
CellLabel->
"In[320]:=",ExpressionUUID->"18a3dbe2-13a2-49b3-a103-0fc45a0a6b98"]
},
WindowSize->{808, 675},
WindowMargins->{{4, Automatic}, {Automatic, 4}},
FrontEndVersion->"12.0 for Mac OS X x86 (64-bit) (2019\:5e745\:67083\:65e5)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)
(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 3273, 94, 241, "Input",ExpressionUUID->"18a3dbe2-13a2-49b3-a103-0fc45a0a6b98"]
}
]
*)