Interface
Edge
GraphsBase.AbstractEdge
— TypeAbstractEdge{V,W}
Abstract type for graph edges with vertices of type V
and a weight of type W
.
A subtype E
satisfies this interface if both V
and E
can be hashed and compared, and if the following methods are implemented:
src(e::E)
dst(e::E)
weight(e::E)
Base.reverse(e::E)
GraphsBase.src
— Functionsrc(e)
Return the source vertex of edge e
.
GraphsBase.dst
— Functiondst(e)
Return the destination vertex of edge e
.
GraphsBase.weight
— Functionweight(e)
Return the weight of edge e
.
Base.reverse
— Functionreverse(e)
Return a new edge with the same data as edge e
but inverted source and destination.
Graph (required)
GraphsBase.AbstractGraph
— TypeAbstractGraph{V,E}
An abstract type representing a graph with vertices of type V
and edges of type E
.
A subtype G <: AbstractGraph
satisfies this interface if E
satisfies the AbstractEdge
interface, and if the following methods are implemented:
is_directed(::Type{G})
vertices(g::G)
out_edges(g::G, v)
in_edges(g::G, v)
GraphsBase.is_directed
— Functionis_directed(g)
is_directed(G)
Return true
if the graph g
/ graph type G
is a directed graph.
GraphsBase.vertices
— Functionvertices(g)
Return an iterable containing the vertices of g
.
GraphsBase.out_edges
— Functionout_edges(g, u)
Return an iterable containing the edges of a graph g
going out of vertex u
.
GraphsBase.in_edges
— Functionin_edges(g, v)
Return an iterable containing the edges of a graph g
going into vertex v
.
Graph (optional)
GraphsBase.nv
— Functionnv(g)
Count the number of vertices in g
.
GraphsBase.ne
— Functionne(g)
Count the number of edges in g
.
GraphsBase.has_vertex
— Functionhas_vertex(g, v)
Return true
if the graph g
contains the vertex v
.
GraphsBase.has_edge
— Functionhas_edge(g, e)
Return true
if the graph g
contains the edge e
(not just an edge with the same source and destination).
has_edge(g, u, v)
Return true
if the graph g
contains an edge from vertex u
to vertex v
.
GraphsBase.has_self_loops
— Functionhas_self_loops(g)
Return true
if g
has any edge from a vertex to itself.
GraphsBase.edges
— Functionedges(g)
Return an iterable containing the edges of g
.
edges(g, u, v)
Return an iterable containing the edges of a graph g
going our of u
and into v
.
GraphsBase.out_neighbors
— Functionout_neighbors(g, u)
Return an iterable containing all neighbors connected to vertex u
by an outgoing edge.
GraphsBase.in_neighbors
— Functionin_neighbors(g, v)
Return an iterable containing all neighbors connected to vertex v
by an incoming edge.
GraphsBase.create_vertex_container
— Functioncreate_vertex_container(g, ::Type{K})
Return a new container with element type K
that can be indexed by the vertices of 'g'.
GraphsBase.create_edge_container
— Functioncreate_edge_container(g, ::Type{K})
Return a new container with element type K
that can be indexed by the edges of 'g'.
Graph (modification)
GraphsBase.add_vertex!
— Functionadd_vertex!(g, v)
Add the vertex v
to the graph g
.
GraphsBase.rm_vertex!
— Functionrm_vertex!(g, v)
Remove the vertex v
from the graph g
.
GraphsBase.add_edge!
— Functionadd_edge!(g, e)
Add the edge e
to the graph g
.
GraphsBase.rm_edge!
— Functionrm_edge!(g, e)
Remove the edge e
from the graph g
.
Element types
Base.eltype
— Functioneltype(e)
eltype(E)
Return the type of the vertices of an edge e
/ an edge type E
.
eltype(g)
eltype(G)
Return the type of the vertices of a graph g
/ a graph type G
.
GraphsBase.edgetype
— Functionedgetype(g)
edgetype(G)
Return the type of the edges of a graph g
/ a graph type G
.
GraphsBase.weighttype
— Functionweighttype(e)
weighttype(E)
Return the type of the weights of an edge e
/ an edge type E
.
weighttype(g)
weighttype(G)
Return the type of the edge weights of a graph g
/ a graph type G
.
Checks
GraphsBase.check_comparable_interface
— Functioncheck_comparable_interface(T)
Check that objects of type T
can be hashed and compared.
This is true if the following methods are implemented:
Base.hash(t::T, h::UInt)
Base.isless(t1::T, t2::T)
Base.:(==)(t1::T, t2::T)
GraphsBase.check_edge_interface
— Functioncheck_edge_interface(E)
Check that objects of type E
can be used as edges of a graph.
GraphsBase.check_graph_interface
— Functioncheck_graph_interface(G)
Check that objects of type G
can be used as graphs.