Skip to content

Commit 863406f

Browse files
authored
Merge pull request #123 from serenity4/master
Improve performance of `get_prop`
2 parents f52cbe4 + a72e551 commit 863406f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/MetaGraphs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Return a dictionary of all metadata from graph `g`, vertex `v`, or edge `e`
237237
(optionally referenced by source vertex `s` and destination vertex `d`).
238238
"""
239239
props(g::AbstractMetaGraph) = g.gprops
240-
props(g::AbstractMetaGraph, v::Integer) = get(g.vprops, v, PropDict())
240+
props(g::AbstractMetaGraph, v::Integer) = get(PropDict, g.vprops, v)
241241
# props for edges is dependent on directedness.
242242
props(g::AbstractMetaGraph, u::Integer, v::Integer) = props(g, Edge(u, v))
243243

src/metadigraph.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ is_directed(g::MetaDiGraph) = true
5656

5757
weighttype(g::MetaDiGraph{T,U}) where T where U = U
5858

59-
props(g::MetaDiGraph, e::SimpleEdge) = get(g.eprops, e, PropDict())
59+
props(g::MetaDiGraph, e::SimpleEdge) = get(PropDict, g.eprops, e)
6060

6161
function set_props!(g::MetaDiGraph, e::SimpleEdge, d::Dict)
6262
if has_edge(g, e)

src/metagraph.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ is_directed(g::MetaGraph) = false
5656
weighttype(g::MetaGraph{T,U}) where T where U = U
5757
function props(g::MetaGraph, _e::SimpleEdge)
5858
e = LightGraphs.is_ordered(_e) ? _e : reverse(_e)
59-
get(g.eprops, e, PropDict())
59+
get(PropDict, g.eprops, e)
6060
end
6161

6262
function set_props!(g::MetaGraph, _e::SimpleEdge, d::Dict)

0 commit comments

Comments
 (0)