Graph traversal

Shortest path

MolecularGraph.Graph.distanceMethod
distance(graph::AbstractGraph, source::Int, target::Int) -> Int
reversedistance(graph::DirectedGraph, source::Int, target::Int) -> Int

Compute the distance (shortest path length) from source to target. If the nodes are not reachable each other, the value will be nothing.

source
MolecularGraph.Graph.distancematrixMethod
distancematrix(graph::OrderedGraph) -> Matrix{Float64}

Generate the distance matrix of the graph.

Note that the type of the generated matrix will be Float64. If the nodes are not reachable each other, the distance value will be Inf.

source
MolecularGraph.Graph.isreachableMethod
reachablenodes(graph::AbstractGraph, u::Int, v::Int) -> Bool
reversereachablenodes(graph::DirectedGraph, u::Int, v::Int) -> Bool

Return whether the node v is reachable from u.

source
MolecularGraph.Graph.longestshortestpathnodesMethod
longestshortestpathnodes(graph::UndirectedGraph) -> Vector{Int}

Compute the longest shortest path in the graph (a path between two arbitrary peripheral nodes) as a vector of nodes that starts with one of the peripheral node and ends with the other side.

source
MolecularGraph.Graph.reachablenodesMethod
reachablenodes(graph::AbstractGraph, node::Int) -> Set{Int}
reversereachablenodes(graph::DirectedGraph, node::Int) -> Set{Int}

Return the set of reachable nodes from node.

source
MolecularGraph.Graph.shortestpathedgesMethod
shortestpathedges(graph::UndirectedGraph, u::Int, v::Int) -> Vector{Int}

Compute the shortest path between u and v as a vector of the edges that forms the path. Return nothing if not reachable.

source
MolecularGraph.Graph.shortestpathnodesMethod
shortestpathnodes(graph::UndirectedGraph, u::Int, v::Int) -> Vector{Int}

Compute the shortest path between u and v as a vector of the nodes that forms the path. Return nothing if not reachable.

source