Skip to content

Commit

Permalink
Fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Apr 15, 2024
1 parent 91ee79c commit c357246
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions examples/multidimgraph_1d.jl
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
9 changes: 5 additions & 4 deletions examples/multidimgraph_2d.jl
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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))
Expand Down
5 changes: 3 additions & 2 deletions examples/namedgraph.jl
Original file line number Diff line number Diff line change
@@ -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"])

Expand Down

0 comments on commit c357246

Please sign in to comment.