Interface

Edge

GraphsBase.AbstractEdgeType
AbstractEdge{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)
source
Base.reverseFunction
reverse(e)

Return a new edge with the same data as edge e but inverted source and destination.

source

Graph (required)

GraphsBase.AbstractGraphType
AbstractGraph{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)
source
GraphsBase.in_edgesFunction
in_edges(g, v)

Return an iterable containing the edges of a graph g going into vertex v.

source

Graph (optional)

GraphsBase.has_edgeFunction
has_edge(g, e)

Return true if the graph g contains the edge e (not just an edge with the same source and destination).

source
has_edge(g, u, v)

Return true if the graph g contains an edge from vertex u to vertex v.

source
GraphsBase.edgesFunction
edges(g)

Return an iterable containing the edges of g.

source
edges(g, u, v)

Return an iterable containing the edges of a graph g going our of u and into v.

source
GraphsBase.in_neighborsFunction
in_neighbors(g, v)

Return an iterable containing all neighbors connected to vertex v by an incoming edge.

source

Graph (modification)

Element types

Base.eltypeFunction
eltype(e)
eltype(E)

Return the type of the vertices of an edge e / an edge type E.

source
eltype(g)
eltype(G)

Return the type of the vertices of a graph g / a graph type G.

source
GraphsBase.weighttypeFunction
weighttype(e)
weighttype(E)

Return the type of the weights of an edge e / an edge type E.

source
weighttype(g)
weighttype(G)

Return the type of the edge weights of a graph g / a graph type G.

source

Checks

GraphsBase.check_comparable_interfaceFunction
check_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)
source