@@ -4,9 +4,9 @@ using Dictionaries: Dictionaries, AbstractDictionary, AbstractIndices, Dictionar
44 IndexError, Indices, dictionary, unset!
55using Graphs: SimpleDiGraph, a_star, add_edge!, bfs_tree, connected_components, degree,
66 dfs_tree, dijkstra_shortest_paths, dst, edges, edgetype, grid, has_edge, has_vertex,
7- indegree, ne, nv, outdegree, path_graph, src, steiner_tree, vertices
7+ indegree, is_directed, ne, nv, outdegree, path_graph, src, steiner_tree, vertices
88using GraphsFlows: GraphsFlows
9- using NamedGraphs. GraphsExtensions: rename_vertices, subgraph, vertextype, ⊔
9+ using NamedGraphs. GraphsExtensions: directed_graph, rename_vertices, subgraph, vertextype, ⊔
1010using NamedGraphs. NamedGraphGenerators: named_grid, named_path_graph
1111using NamedGraphs. OrdinalIndexing: nd, rd, st, th
1212using NamedGraphs: NamedDiGraph, NamedEdge, NamedGraph, empty_graph, similar_graph
@@ -153,6 +153,32 @@ using Test: @test, @test_broken, @testset
153153 @test dg[2 => " Y" ] == " edge_Y2"
154154 @test dg[" Y" => 2 ] == " edge_Y2"
155155 end
156+ @testset " (un)directed graph" begin
157+ dg = DataGraph (named_path_graph (3 ))
158+ dg[1 => 2 ] = " edge_12"
159+ @test dg[1 => 2 ] == " edge_12"
160+ @test dg[2 => 1 ] == " edge_12"
161+ dg[2 => 1 ] = " edge_21"
162+ @test dg[1 => 2 ] == " edge_21"
163+ @test dg[2 => 1 ] == " edge_21"
164+
165+ dg = DataGraph (named_path_graph (3 ))
166+
167+ dg[1 => 2 ] = " edge_12"
168+
169+ ddg = directed_graph (dg)
170+ @test ! is_directed (dg)
171+ @test is_directed (ddg)
172+ @test isassigned (ddg, 1 => 2 )
173+ @test isassigned (ddg, 2 => 1 )
174+ @test ddg[1 => 2 ] == ddg[2 => 1 ]
175+
176+ ddg[1 => 2 ] = " edge_12"
177+ ddg[2 => 1 ] = " edge_21"
178+
179+ @test ddg[1 => 2 ] == " edge_12"
180+ @test ddg[2 => 1 ] == " edge_21"
181+ end
156182
157183 @testset " get and get! functions" begin
158184 g = named_grid (4 )
0 commit comments