Base
The abstract type AbstractMetricGraph comprises the following two types representing non-equilateral and equilateral metric graphs.
MeGraPDE.MetricGraphs.MetricGraph
— TypeA type representing a Metric Graph (non-equilateral)
G
Simple combinatorial graph
ℓ_vec
Vector containing the edge lengths
coords
Array containing the coordinates of the vertices; specify 'nothing' if no coordinates available
MeGraPDE.MetricGraphs.EquilateralMetricGraph
— TypeA type representing a Metric Graph with equilateral edge lengths
G
Simple combinatorial graph
ℓ
Equilateral edge length
coords
Array containing the coordinates of the vertices; specify 'nothing' if no coordinates available
In the field 'coords', coordinates can be specified that allow plotting the graph in a 3d grid.
The function metric_graph assembles a metric graph by specifying a combinatorial graph G
and edge lengths. Coordinates can be set optionally, but are false per default.
MeGraPDE.MetricGraphs.metric_graph
— Functionmetric_graph(G::SimpleGraph, ℓ_vec::Vector; coord=nothing)
Create metric graph from simple graph 'G' with edge lengths 'ℓ_vec' and optionally assign a coordinate specified in 'coord' to the vertices.
metric_graph(G::SimpleGraph, ℓ::Number; coord=nothing)
Equilateral version with one uniform edge length 'ℓ' assigned to each edge.
It is possible to extended every possible graph to a metric graph by assigning edge length.
Consider for example the Barabasi-Albert graph constructed with [Graphs.jl](https://github.com/JuliaGraphs/Graphs.
using Graphs
G = barabasi_albert(100,3)
{100, 291} undirected simple Int64 graph
You can now either assign an equilateral edge length represented by one number or a vector l_vec with edge lengths to create a metric graph
ℓ = 1
Γ = metric_graph(G, ℓ)
{n=100,m=291,ℓ=1} equilateral metric graph
ℓ_vec = rand(1:5,ne(G))
Γ = metric_graph(G, ℓ_vec)
{n=100, m=291} metric graph
Some minor functions are implemented to quickly access properties of Γ. This list is by far not complete and will be expanded by other frequently used functions.
MeGraPDE.MetricGraphs.edge_length
— Functionedge_length(Γ::MetricGraph, j::Int)
Return edge length of edge 'j.'
edge_length(Γ::EquilateralMetricGraph)
Equilateral version.
MeGraPDE.MetricGraphs.vol
— Functionvol(Γ::MetricGraph)
Return volume $vol_{\Gamma} = \sum_{e \in \mathcal{E}} \ell_e$.
vol(Γ::EquilateralMetricGraph)
Equilateral version, $vol = m \cdot \ell$.