35
35
DOTFormat,
36
36
reverse
37
37
38
-
39
- abstract type AbstractMetaGraph{Vertex, InnerGraph, AtVertex, AtEdge, GraphMeta, WeightFunction, Weight} <: AbstractGraph{Vertex} end
38
+ abstract type AbstractMetaGraph{Vertex <: Integer , InnerGraph <: AbstractGraph , AtVertex, AtEdge, GraphMeta, WeightFunction, Weight <: Real } <: AbstractGraph{Vertex} end
40
39
41
40
function show (io:: IO , meta:: AbstractMetaGraph{<: Any, <: Any, AtVertex, AtEdge, GraphMeta, <: Any, Weight} ) where {AtVertex, AtEdge, GraphMeta, Weight}
42
41
print (io, " Meta graph based on a $(meta. inner_graph) with $AtVertex (s) at vertices, $AtEdge (s) at edges, $GraphMeta metadata, $Weight weights, and default weight $(meta. default_weight) " )
83
82
84
83
add_vertex! (meta:: AbstractMetaGraph ) = add_vertex! (meta. inner_graph)
85
84
function push! (meta:: AbstractMetaGraph , value)
86
- add_vertex! (meta) || return false
85
+ add_vertex! (meta)
87
86
last_vertex = nv (meta)
88
87
meta[last_vertex] = value
89
88
return last_vertex
@@ -130,7 +129,6 @@ function delete!(meta::AbstractMetaGraph, deleted_vertex::Integer)
130
129
rem_vertex! (meta. inner_graph, deleted_vertex)
131
130
return result
132
131
end
133
-
134
132
rem_vertex! (meta:: AbstractMetaGraph , vertex) = delete! (meta, vertex)
135
133
136
134
struct MetaWeights{Weight <: Real , InnerAbstractMetaGraph} <: AbstractMatrix{Weight}
140
138
show (io:: IO , weights:: MetaWeights ) = print (io, " metaweights" )
141
139
show (io:: IO , :: MIME"text/plain" , weights:: MetaWeights ) = show (io, weights)
142
140
143
- MetaWeights (meta:: AbstractMetaGraph ) = MetaWeights {weight_type(meta), typeof(meta)} (meta)
141
+ MetaWeights (meta:: AbstractMetaGraph ) =
142
+ MetaWeights {weight_type(meta), typeof(meta)} (meta)
144
143
145
144
function getindex (weights:: MetaWeights{Weight} , in_vertex:: Integer , out_vertex:: Integer ):: Weight where {Weight}
146
145
edge = Edge (in_vertex, out_vertex)
@@ -165,8 +164,10 @@ weight_type(meta::AbstractMetaGraph{<: Any, <: Any, <: Any, <: Any, <: Any, <: A
165
164
getindex (meta:: AbstractMetaGraph , vertex:: Integer ) = meta. vertex_meta[vertex]
166
165
getindex (meta:: AbstractMetaGraph , edge:: AbstractEdge ) = meta. edge_meta[edge]
167
166
168
- haskey (meta:: AbstractMetaGraph , vertex:: Integer ) = haskey (meta. vertex_meta, vertex)
169
- haskey (meta:: AbstractMetaGraph , edge:: AbstractEdge ) = haskey (meta. edge_meta, edge)
167
+ haskey (meta:: AbstractMetaGraph , vertex:: Integer ) =
168
+ haskey (meta. vertex_meta, vertex)
169
+ haskey (meta:: AbstractMetaGraph , edge:: AbstractEdge ) =
170
+ haskey (meta. edge_meta, edge)
170
171
171
172
function setindex! (meta:: AbstractMetaGraph , value, vertex:: Integer )
172
173
meta. vertex_meta[vertex] = value
176
177
"""
177
178
weight_function(meta)
178
179
179
- Return the weight function for meta graph `meta`.
180
+ Return the weight function for metagraph `meta`.
180
181
181
182
```jldoctest
182
183
julia> using MetaGraphs
@@ -192,7 +193,7 @@ weight_function(meta::AbstractMetaGraph) = meta.weight_function
192
193
"""
193
194
default_weight(meta)
194
195
195
- Return the default weight for meta graph `meta`.
196
+ Return the default weight for metagraph `meta`.
196
197
197
198
```jldoctest
198
199
julia> using MetaGraphs
0 commit comments