Skip to content

Commit 6cd667d

Browse files
committed
Add missing similar_graph type domain method for DataGraph.
1 parent db42ca3 commit 6cd667d

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/datagraph.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,22 @@ function NamedGraphs.similar_graph(
6868
return DataGraph(new_underlying_graph; vertex_data_type, edge_data_type)
6969
end
7070

71+
function NamedGraphs.similar_graph(
72+
G::Type{<:DataGraph},
73+
vertices
74+
)
75+
new_underlying_graph = similar_graph(
76+
underlying_graph_type(G),
77+
vertices
78+
)
79+
80+
VD = vertex_data_type(G)
81+
ED = edge_data_type(G)
82+
83+
V = vertextype(G)
84+
85+
return DataGraph{V}(new_underlying_graph; vertex_data_type = VD, edge_data_type = ED)
86+
end
7187
function Base.copy(graph::DataGraph)
7288
# Need to manually copy the keys of Dictionaries, see:
7389
# https://github.com/andyferris/Dictionaries.jl/issues/98

0 commit comments

Comments
 (0)