Graph views formats
Graphs.jl provides views around directed graphs. ReverseGraph is a graph view that wraps a directed graph and reverse the direction of every edge. UndirectedGraph is a graph view that wraps a directed graph and consider every edge as undirected.
Index
Full docs
Graphs.ReverseView — Type
ReverseView{T<:Integer,G<:AbstractGraph} <: AbstractGraph{T}A graph view that wraps a directed graph and reverse the direction of every edge.
Some properties of the view (e.g. the number of edges) are forwarded from the underlying graph and are not recomputed. Modifying the underlying graph after constructing the view may lead to incorrect results.
Examples
julia> using Graphs
julia> g = SimpleDiGraph(2);
julia> add_edge!(g, 1, 2);
julia> rg = ReverseView(g);
julia> neighbors(rg, 1)
Int64[]
julia> neighbors(rg, 2)
1-element Vector{Int64}:
1Graphs.UndirectedView — Type
UndirectedView{T<:Integer,G<:AbstractGraph} <: AbstractGraph{T}A graph view that wraps a directed graph and consider every edge as undirected.
Some properties of the view, such as the number of edges, are cached at construction time. Modifying the underlying graph after constructing the view will lead to incorrect results.
Examples
julia> using Graphs
julia> g = SimpleDiGraph(2);
julia> add_edge!(g, 1, 2);
julia> ug = UndirectedView(g);
julia> neighbors(ug, 1)
1-element Vector{Int64}:
2
julia> neighbors(ug, 2)
1-element Vector{Int64}:
1Graphs.wrapped_graph — Function
wrapped_graph(g)Return the graph wrapped by g