From c357246084f012a7ba785f591646f0b3d99aab34 Mon Sep 17 00:00:00 2001 From: mtfishman Date: Mon, 15 Apr 2024 17:54:14 -0400 Subject: [PATCH] Fix examples --- examples/multidimgraph_1d.jl | 5 +++-- examples/multidimgraph_2d.jl | 9 +++++---- examples/namedgraph.jl | 5 +++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/multidimgraph_1d.jl b/examples/multidimgraph_1d.jl index 3d0f94a..b015bdb 100644 --- a/examples/multidimgraph_1d.jl +++ b/examples/multidimgraph_1d.jl @@ -1,5 +1,6 @@ -using Graphs -using NamedGraphs +using Graphs: grid, has_edge, has_vertex, ne, nv +using NamedGraphs: NamedGraph +using NamedGraphs.GraphsExtensions: ⊔, subgraph parent_graph = grid((4,)) vs = ["A", "B", "C", "D"] diff --git a/examples/multidimgraph_2d.jl b/examples/multidimgraph_2d.jl index 20923c1..3cd95d5 100644 --- a/examples/multidimgraph_2d.jl +++ b/examples/multidimgraph_2d.jl @@ -1,5 +1,6 @@ -using Graphs -using NamedGraphs +using Graphs: grid, has_edge, has_vertex, nv +using NamedGraphs: NamedGraph +using NamedGraphs.GraphsExtensions: ⊔, subgraph parent_graph = grid((2, 2)) vs = [("X", 1), ("X", 2), ("Y", 1), ("Y", 2)] @@ -11,14 +12,14 @@ g = NamedGraph(parent_graph, vs) @show !has_edge(g, ("X", 2) => ("Y", 1)) @show has_edge(g, ("X", 2) => ("Y", 2)) -g_sub = g[[("X", 1)]] +g_sub = subgraph(g, [("X", 1)]) @show has_vertex(g_sub, ("X", 1)) @show !has_vertex(g_sub, ("X", 2)) @show !has_vertex(g_sub, ("Y", 1)) @show !has_vertex(g_sub, ("Y", 2)) -g_sub = g[[("X", 1), ("X", 2)]] +g_sub = subgraph(g, [("X", 1), ("X", 2)]) @show has_vertex(g_sub, ("X", 1)) @show has_vertex(g_sub, ("X", 2)) diff --git a/examples/namedgraph.jl b/examples/namedgraph.jl index 3296d41..80e9eca 100644 --- a/examples/namedgraph.jl +++ b/examples/namedgraph.jl @@ -1,5 +1,6 @@ -using Graphs -using NamedGraphs +using Graphs: add_edge!, grid, has_edge, has_vertex, neighbors +using NamedGraphs: NamedGraph +using NamedGraphs.GraphsExtensions: subgraph g = NamedGraph(grid((4,)), ["A", "B", "C", "D"])