Skip to content

Commit d59401c

Browse files
authored
Update tutorial on adding edges (#79)
1 parent d2062f3 commit d59401c

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "MetaGraphsNext"
22
uuid = "fa8bd995-216d-47f1-8a91-f3b68fbeb377"
3-
version = "0.7.0"
3+
version = "0.7.1"
44

55
[deps]
66
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"

src/graphs.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ Add an edge `(label_1, label_2)` to MetaGraph `meta_graph` with metadata `data`.
189189
If the `EdgeData` type of `meta_graph` is `Nothing`, `data` can be omitted.
190190
191191
Return `true` if the edge has been added, `false` otherwise.
192-
If `(label_1, label_2)` already existed, its data is updated to `data` and `false` is returned nonetheless.
192+
If one of the labels does not exist, nothing happens and `false` is returned (the label is not inserted).
193+
If `(label_1, label_2)` already exists, its data is updated to `data` and `false` is returned nonetheless.
193194
"""
194195
function Graphs.add_edge!(meta_graph::MetaGraph, label_1, label_2, data)
195196
if !haskey(meta_graph, label_1) || !haskey(meta_graph, label_2)

test/tutorial/1_basics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ colors[:blue] = (0, 0, 255);
3939

4040
# ### Edges
4141

42-
# Use `setindex!` with two keys to add a new edge between the given labels and containing the given metadata. Beware that this time, nonexistent labels will throw an error.
42+
# Use `setindex!` with two keys to add a new edge between the given labels and containing the given metadata. Beware that this time, an edge will only be added when both node labels already exist in the graph.
4343

4444
colors[:red, :green] = :yellow;
4545
colors[:red, :blue] = :magenta;

0 commit comments

Comments
 (0)