@@ -47,21 +47,7 @@ julia> using NamedGraphs
4747
4848julia> g = NamedGraph (grid ((4 ,)), [" A" , " B" , " C" , " D" ])
4949NamedGraph{String} with 4 vertices:
50- 4 - element Dictionaries. Indices{String}
51- " A"
52- " B"
53- " C"
54- " D"
55-
56- and 3 edge (s):
57- " A" => " B"
58- " B" => " C"
59- " C" => " D"
60-
61-
62- julia> g = NamedGraph (grid ((4 ,)); vertices= [" A" , " B" , " C" , " D" ]) # Same as above
63- NamedGraph{String} with 4 vertices:
64- 4 - element Dictionaries. Indices{String}
50+ 4 - element Indices{String}
6551 " A"
6652 " B"
6753 " C"
@@ -94,7 +80,7 @@ julia> neighbors(g, "B")
9480
9581julia> subgraph (g, [" A" , " B" ])
9682NamedGraph{String} with 2 vertices:
97- 2 - element Dictionaries . Indices{String}
83+ 2 - element Indices{String}
9884 " A"
9985 " B"
10086
@@ -116,9 +102,12 @@ It is natural to use tuples of integers as the names for the vertices of graphs
116102For example:
117103
118104``` julia
119- julia> g = NamedGraph (grid ((2 , 2 )); vertices= Tuple .(CartesianIndices ((2 , 2 ))))
105+ julia> dims = (2 , 2 )
106+ (2 , 2 )
107+
108+ julia> g = NamedGraph (grid (dims), Tuple .(CartesianIndices (dims)))
120109NamedGraph{Tuple{Int64, Int64}} with 4 vertices:
121- 4 - element Dictionaries . Indices{Tuple{Int64, Int64}}
110+ 4 - element Indices{Tuple{Int64, Int64}}
122111 (1 , 1 )
123112 (2 , 1 )
124113 (1 , 2 )
@@ -162,7 +151,7 @@ You can use vertex names to get [induced subgraphs](https://juliagraphs.org/Grap
162151``` julia
163152julia> subgraph (v -> v[1 ] == 1 , g)
164153NamedGraph{Tuple{Int64, Int64}} with 2 vertices:
165- 2 - element Dictionaries . Indices{Tuple{Int64, Int64}}
154+ 2 - element Indices{Tuple{Int64, Int64}}
166155 (1 , 1 )
167156 (1 , 2 )
168157
@@ -172,7 +161,7 @@ and 1 edge(s):
172161
173162julia> subgraph (v -> v[2 ] == 2 , g)
174163NamedGraph{Tuple{Int64, Int64}} with 2 vertices:
175- 2 - element Dictionaries . Indices{Tuple{Int64, Int64}}
164+ 2 - element Indices{Tuple{Int64, Int64}}
176165 (1 , 2 )
177166 (2 , 2 )
178167
@@ -182,7 +171,7 @@ and 1 edge(s):
182171
183172julia> subgraph (g, [(1 , 1 ), (2 , 2 )])
184173NamedGraph{Tuple{Int64, Int64}} with 2 vertices:
185- 2 - element Dictionaries . Indices{Tuple{Int64, Int64}}
174+ 2 - element Indices{Tuple{Int64, Int64}}
186175 (1 , 1 )
187176 (2 , 2 )
188177
@@ -196,7 +185,7 @@ You can also take [disjoint unions](https://en.wikipedia.org/wiki/Disjoint_union
196185``` julia
197186julia> g₁ = g
198187NamedGraph{Tuple{Int64, Int64}} with 4 vertices:
199- 4 - element Dictionaries . Indices{Tuple{Int64, Int64}}
188+ 4 - element Indices{Tuple{Int64, Int64}}
200189 (1 , 1 )
201190 (2 , 1 )
202191 (1 , 2 )
@@ -211,7 +200,7 @@ and 4 edge(s):
211200
212201julia> g₂ = g
213202NamedGraph{Tuple{Int64, Int64}} with 4 vertices:
214- 4 - element Dictionaries . Indices{Tuple{Int64, Int64}}
203+ 4 - element Indices{Tuple{Int64, Int64}}
215204 (1 , 1 )
216205 (2 , 1 )
217206 (1 , 2 )
@@ -226,7 +215,7 @@ and 4 edge(s):
226215
227216julia> disjoint_union (g₁, g₂)
228217NamedGraph{Tuple{Tuple{Int64, Int64}, Int64}} with 8 vertices:
229- 8 - element Dictionaries . Indices{Tuple{Tuple{Int64, Int64}, Int64}}
218+ 8 - element Indices{Tuple{Tuple{Int64, Int64}, Int64}}
230219 ((1 , 1 ), 1 )
231220 ((2 , 1 ), 1 )
232221 ((1 , 2 ), 1 )
@@ -249,7 +238,7 @@ and 8 edge(s):
249238
250239julia> g₁ ⊔ g₂ # Same as above
251240NamedGraph{Tuple{Tuple{Int64, Int64}, Int64}} with 8 vertices:
252- 8 - element Dictionaries . Indices{Tuple{Tuple{Int64, Int64}, Int64}}
241+ 8 - element Indices{Tuple{Tuple{Int64, Int64}, Int64}}
253242 ((1 , 1 ), 1 )
254243 ((2 , 1 ), 1 )
255244 ((1 , 2 ), 1 )
@@ -287,9 +276,9 @@ be added manually.
287276The original graphs can be obtained from subgraphs:
288277
289278``` julia
290- julia> rename_vertices (v -> v[ 1 ] , subgraph (v -> v[2 ] == 1 , g₁ ⊔ g₂))
279+ julia> rename_vertices (first , subgraph (v -> v[2 ] == 1 , g₁ ⊔ g₂))
291280NamedGraph{Tuple{Int64, Int64}} with 4 vertices:
292- 4 - element Dictionaries . Indices{Tuple{Int64, Int64}}
281+ 4 - element Indices{Tuple{Int64, Int64}}
293282 (1 , 1 )
294283 (2 , 1 )
295284 (1 , 2 )
@@ -302,9 +291,9 @@ and 4 edge(s):
302291(1 , 2 ) => (2 , 2 )
303292
304293
305- julia> rename_vertices (v -> v[ 1 ] , subgraph (v -> v[2 ] == 2 , g₁ ⊔ g₂))
294+ julia> rename_vertices (first , subgraph (v -> v[2 ] == 2 , g₁ ⊔ g₂))
306295NamedGraph{Tuple{Int64, Int64}} with 4 vertices:
307- 4 - element Dictionaries . Indices{Tuple{Int64, Int64}}
296+ 4 - element Indices{Tuple{Int64, Int64}}
308297 (1 , 1 )
309298 (2 , 1 )
310299 (1 , 2 )
0 commit comments