gz/math/graph/Graph.hh
Go to the documentation of this file.
T begin(T... args)
A directed edge represents a connection between two vertices. The connection is unidirectional,...
Definition: gz/math/graph/Edge.hh:268
A generic graph class. Both vertices and edges can store user information. A vertex could be created ...
Definition: gz/math/graph/Graph.hh:110
Vertex< V > & AddVertex(const std::string &_name, const V &_data, const VertexId &_id=kNullId)
Add a new vertex to the graph.
Definition: gz/math/graph/Graph.hh:144
bool RemoveVertex(Vertex< V > &_vertex)
Remove an existing vertex from the graph.
Definition: gz/math/graph/Graph.hh:536
size_t OutDegree(const Vertex< V > &_vertex) const
Get the number of edges incident from a vertex.
Definition: gz/math/graph/Graph.hh:420
VertexRef_M< V > AdjacentsFrom(const VertexId &_vertex) const
Get all vertices that are directly connected with one edge from a given vertex. In other words,...
Definition: gz/math/graph/Graph.hh:296
const EdgeType & EdgeFromVertices(const VertexId _sourceId, const VertexId _destId) const
Get a reference to an edge based on two vertices. A NullEdge object reference is returned if an edge ...
Definition: gz/math/graph/Graph.hh:635
const Vertex< V > & VertexFromId(const VertexId &_id) const
Get a reference to a vertex using its Id.
Definition: gz/math/graph/Graph.hh:605
size_t OutDegree(const VertexId &_vertex) const
Get the number of edges incident from a vertex.
Definition: gz/math/graph/Graph.hh:412
EdgeType & AddEdge(const VertexId_P &_vertices, const E &_data, const double _weight=1.0)
Add a new edge to the graph.
Definition: gz/math/graph/Graph.hh:215
const EdgeType & EdgeFromId(const EdgeId &_id) const
Get a reference to an edge using its Id.
Definition: gz/math/graph/Graph.hh:670
bool RemoveVertex(const VertexId &_vertex)
Remove an existing vertex from the graph.
Definition: gz/math/graph/Graph.hh:508
const VertexRef_M< V > Vertices(const std::string &_name) const
The collection of all vertices in the graph with name == _name.
Definition: gz/math/graph/Graph.hh:197
bool RemoveEdge(EdgeType &_edge)
Remove an existing edge from the graph. After the removal, it won't be possible to reach any of the v...
Definition: gz/math/graph/Graph.hh:596
size_t InDegree(const Vertex< V > &_vertex) const
Get the number of edges incident to a vertex.
Definition: gz/math/graph/Graph.hh:404
const EdgeRef_M< EdgeType > IncidentsFrom(const Vertex< V > &_vertex) const
Get the set of outgoing edges from a given vertex.
Definition: gz/math/graph/Graph.hh:455
const EdgeRef_M< EdgeType > IncidentsTo(const Vertex< V > &_vertex) const
Get the set of incoming edges to a given vertex.
Definition: gz/math/graph/Graph.hh:491
const EdgeRef_M< EdgeType > IncidentsFrom(const VertexId &_vertex) const
Get the set of outgoing edges from a given vertex.
Definition: gz/math/graph/Graph.hh:430
const EdgeRef_M< EdgeType > Edges() const
The collection of all edges in the graph.
Definition: gz/math/graph/Graph.hh:270
friend std::ostream & operator<<(std::ostream &_out, const Graph< VV, EE, EEdgeType > &_g)
Stream insertion operator. The output uses DOT graph description language.
const VertexRef_M< V > Vertices() const
The collection of all vertices in the graph.
Definition: gz/math/graph/Graph.hh:185
size_t RemoveVertices(const std::string &_name)
Remove all vertices with name == _name.
Definition: gz/math/graph/Graph.hh:544
bool Empty() const
Get whether the graph is empty.
Definition: gz/math/graph/Graph.hh:500
const EdgeRef_M< EdgeType > IncidentsTo(const VertexId &_vertex) const
Get the set of incoming edges to a given vertex.
Definition: gz/math/graph/Graph.hh:466
VertexRef_M< V > AdjacentsTo(const VertexId &_vertex) const
Get all vertices that are directly connected with one edge to a given vertex. In other words,...
Definition: gz/math/graph/Graph.hh:355
bool RemoveEdge(const EdgeId &_edge)
Remove an existing edge from the graph. After the removal, it won't be possible to reach any of the v...
Definition: gz/math/graph/Graph.hh:567
Vertex< V > & VertexFromId(const VertexId &_id)
Get a mutable reference to a vertex using its Id.
Definition: gz/math/graph/Graph.hh:618
size_t InDegree(const VertexId &_vertex) const
Get the number of edges incident to a vertex.
Definition: gz/math/graph/Graph.hh:396
EdgeType & LinkEdge(const EdgeType &_edge)
Links an edge to the graph. This function verifies that the edge's two vertices exist in the graph,...
Definition: gz/math/graph/Graph.hh:239
Graph(const std::vector< Vertex< V >> &_vertices, const std::vector< EdgeInitializer< E >> &_edges)
Constructor.
Definition: gz/math/graph/Graph.hh:117
VertexRef_M< V > AdjacentsTo(const Vertex< V > &_vertex) const
Get all vertices that are directly connected with one edge to a given vertex. In other words,...
Definition: gz/math/graph/Graph.hh:388
VertexRef_M< V > AdjacentsFrom(const Vertex< V > &_vertex) const
Get all vertices that are directly connected with one edge from a given vertex. In other words,...
Definition: gz/math/graph/Graph.hh:335
An undirected edge represents a connection between two vertices. The connection is bidirectional,...
Definition: gz/math/graph/Edge.hh:205
A vertex of a graph. It stores user information, an optional name, and keeps an internal unique Id....
Definition: gz/math/graph/Vertex.hh:55
VertexId Id() const
Get the vertex Id.
Definition: gz/math/graph/Vertex.hh:88
T emplace(T... args)
T end(T... args)
T endl(T... args)
T find(T... args)
T make_pair(T... args)
T move(T... args)
uint64_t EdgeId
The unique Id for an edge.
Definition: gz/math/graph/Edge.hh:40
uint64_t VertexId
The unique Id of each vertex.
Definition: gz/math/graph/Vertex.hh:41
std::ostream & operator<<(std::ostream &_out, const Graph< VV, EE, DirectedEdge< EE >> &_g)
Partial template specification for directed edges.
Definition: gz/math/graph/Graph.hh:769
static const VertexId kNullId
Represents an invalid Id.
Definition: gz/math/graph/Vertex.hh:48
static const uint64_t MAX_UI64
64bit unsigned integer maximum value
Definition: gz/math/Helpers.hh:339
Definition: gz/math/AdditivelySeparableScalarField3.hh:28
T push_back(T... args)
T cref(T... args)
Used in the Graph constructors for uniform initialization.
Definition: gz/math/graph/Edge.hh:45