GEDLIB
1.0
|
The normalized input graphs used by GEDLIB. All labels are integers. More...
#include <ged_graph.hpp>
Public Types | |
typedef std::size_t | NodeID |
Internally used vertex ID type. | |
typedef detail::GedGraphAL::edge_descriptor | EdgeID |
Internally used edge ID type. | |
typedef std::vector< GEDGraph >::size_type | GraphID |
Type of internally used graph IDs. | |
typedef std::map< NodeID, NodeID > | NodeNodeMap |
Map that assigns node IDs to node IDs. | |
typedef std::map< NodeID, std::size_t > | NodeSizeTMap |
Map that assigns node IDs to integers. | |
typedef std::map< std::size_t, NodeID > | SizeTNodeMap |
Map that assigns node IDs to integers. | |
typedef detail::GedGraphAL::out_edge_iterator | incident_edge_iterator |
Iterator type for iterating over all the incident edges of a node in the graph. | |
typedef detail::GedGraphAL::edge_iterator | edge_iterator |
Iterator type for iterating over all edges of the graph. | |
typedef detail::GedGraphAL::vertex_iterator | node_iterator |
Iterator type for iterating over all nodes in the graph. | |
Public Member Functions | |
GEDGraph () | |
Constructs an empty graph without meaningful ID. | |
GEDGraph (GraphID id) | |
Constructs an empty graph. More... | |
GEDGraph (const GEDGraph &ged_graph) | |
Copy constructor. More... | |
GraphID | id () const |
Returns the ID of the graph. More... | |
void | clear () |
Clears the graph. | |
NodeID | add_node () |
Adds a new vertex to the graph. More... | |
EdgeID | add_edge (NodeID tail, NodeID head) |
Adds a new edge to the graph. More... | |
void | set_label (NodeID node, LabelID label) |
Sets a node's label. More... | |
void | set_label (EdgeID edge, LabelID label) |
Sets a edges's label. More... | |
LabelID | get_node_label (NodeID node) const |
Returns the label of a given node. More... | |
LabelID | get_edge_label (EdgeID edge) const |
Returns the label of a given edge. More... | |
LabelID | get_edge_label (NodeID node_1, NodeID node_2) const |
Retrieves the label of an edge between two nodes or the dummy label if no edge exists. More... | |
void | setup_adjacency_matrix () |
Prepares the adjacency matrix to allow quick retrieval of edges. More... | |
NodeID | tail (EdgeID edge) const |
Returns the tail of an edge. More... | |
NodeID | head (EdgeID edge) const |
Returns the head of an edge. More... | |
EdgeID | get_edge (NodeID tail, NodeID head) const |
Retrieves an edge from its incident nodes. More... | |
EdgeID | safe_get_edge (NodeID tail, NodeID head) const |
Retrieves an edge from its incident nodes. More... | |
bool | is_edge (NodeID tail, NodeID head) const |
Checks if an edge exists. More... | |
bool | safe_is_edge (NodeID tail, NodeID head) const |
Checks if an edge exists. More... | |
std::size_t | degree (NodeID node) const |
Returns node degree. More... | |
std::size_t | num_nodes () const |
Returns the number of nodes. More... | |
std::size_t | num_edges () const |
Returns the number of edges. More... | |
bool | initialized () const |
Checks if graph has already been initialized. More... | |
void | un_init () |
Declare graph as un-initialized. | |
std::size_t | maxdeg () const |
Returns the maximum degree of the graph. | |
std::pair< node_iterator, node_iterator > | nodes () const |
Provides access to all nodes in the graph. More... | |
std::pair< edge_iterator, edge_iterator > | edges () const |
Provides access to all edge in the graph. More... | |
std::pair< incident_edge_iterator, incident_edge_iterator > | incident_edges (NodeID node) const |
Provides access to all incident edges of a node. More... | |
const detail::GedGraphAL & | get_adjacency_list () const |
Returns the internal adjacency list representation. More... | |
Static Public Member Functions | |
static NodeID | dummy_node () |
Returns a dummy node. More... | |
static NodeID | undefined_node () |
Returns an undefined node. More... | |
static EdgeID | dummy_edge () |
Returns a dummy edge. More... | |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &os, const GEDGraph &graph) |
Streams a graph. More... | |
The normalized input graphs used by GEDLIB. All labels are integers.
Definition at line 104 of file ged_graph.hpp.
ged::GEDGraph::GEDGraph | ( | GEDGraph::GraphID | id | ) |
Constructs an empty graph.
[in] | id | The ID of the new graph. |
Definition at line 41 of file ged_graph.ipp.
ged::GEDGraph::GEDGraph | ( | const GEDGraph & | ged_graph | ) |
Copy constructor.
[in] | ged_graph | Graph that is to be copied. |
Definition at line 48 of file ged_graph.ipp.
GEDGraph::EdgeID ged::GEDGraph::add_edge | ( | NodeID | tail, |
NodeID | head | ||
) |
Adds a new edge to the graph.
[in] | tail | The tail of the newly added edge. |
[in] | head | The head of the newly added edge |
Definition at line 86 of file ged_graph.ipp.
GEDGraph::NodeID ged::GEDGraph::add_node | ( | ) |
Adds a new vertex to the graph.
Definition at line 74 of file ged_graph.ipp.
std::size_t ged::GEDGraph::degree | ( | NodeID | node | ) | const |
Returns node degree.
[in] | node | Input node. |
node
. Definition at line 162 of file ged_graph.ipp.
|
static |
|
static |
std::pair< GEDGraph::edge_iterator, GEDGraph::edge_iterator > ged::GEDGraph::edges | ( | ) | const |
Provides access to all edge in the graph.
Definition at line 217 of file ged_graph.ipp.
const detail::GedGraphAL & ged::GEDGraph::get_adjacency_list | ( | ) | const |
Returns the internal adjacency list representation.
Definition at line 156 of file ged_graph.ipp.
GEDGraph::EdgeID ged::GEDGraph::get_edge | ( | NodeID | tail, |
NodeID | head | ||
) | const |
Retrieves an edge from its incident nodes.
[in] | tail | First incident node of the edge. |
[in] | head | Second incident node of the edge. |
tail
with head
, if the edge exists. Otherwise, dummy_edge() is returned. Definition at line 241 of file ged_graph.ipp.
Returns the label of a given edge.
[in] | edge | The ID of the edge whose label is to be returned. |
edge
. Definition at line 135 of file ged_graph.ipp.
Retrieves the label of an edge between two nodes or the dummy label if no edge exists.
[in] | node_1 | ID of first node. |
[in] | node_2 | ID of second node. |
node_1
with node_2
or the dummy label if no edge exists. Definition at line 141 of file ged_graph.ipp.
Returns the label of a given node.
[in] | node | The ID of the node whose label is to be returned. |
node
. Definition at line 126 of file ged_graph.ipp.
GEDGraph::NodeID ged::GEDGraph::head | ( | EdgeID | edge | ) | const |
Returns the head of an edge.
[in] | edge | The ID of the edge whose head is to be returned. |
Definition at line 199 of file ged_graph.ipp.
GEDGraph::GraphID ged::GEDGraph::id | ( | ) | const |
std::pair< GEDGraph::incident_edge_iterator, GEDGraph::incident_edge_iterator > ged::GEDGraph::incident_edges | ( | NodeID | node | ) | const |
Provides access to all incident edges of a node.
[in] | node | ID of the node whose incident edges should be returned. |
node
and whose second member points past the last incident edge of the node node
. Definition at line 150 of file ged_graph.ipp.
bool ged::GEDGraph::initialized | ( | ) | const |
Checks if graph has already been initialized.
true
if the adjacency matrix is up to date, false
otherwise. Definition at line 229 of file ged_graph.ipp.
Checks if an edge exists.
[in] | tail | First node. |
[in] | head | Second node. |
true
if there is an edge that connects tail
with head
, and false
otherwise. Definition at line 262 of file ged_graph.ipp.
std::pair< GEDGraph::node_iterator, GEDGraph::node_iterator > ged::GEDGraph::nodes | ( | ) | const |
Provides access to all nodes in the graph.
Definition at line 205 of file ged_graph.ipp.
std::size_t ged::GEDGraph::num_edges | ( | ) | const |
Returns the number of edges.
Definition at line 223 of file ged_graph.ipp.
std::size_t ged::GEDGraph::num_nodes | ( | ) | const |
Returns the number of nodes.
Definition at line 211 of file ged_graph.ipp.
GEDGraph::EdgeID ged::GEDGraph::safe_get_edge | ( | NodeID | tail, |
NodeID | head | ||
) | const |
Retrieves an edge from its incident nodes.
[in] | tail | First incident node of the edge. |
[in] | head | Second incident node of the edge. |
tail
with head
, if the edge exists. Otherwise, dummy_edge() is returned. Definition at line 251 of file ged_graph.ipp.
Checks if an edge exists.
[in] | tail | First node. |
[in] | head | Second node. |
true
if there is an edge that connects tail
with head
, and false
otherwise. Definition at line 272 of file ged_graph.ipp.
Sets a node's label.
[in] | node | The ID of the node whose label should be set. |
[in] | label | The ID of the label that should be assigned to the node node . |
Definition at line 114 of file ged_graph.ipp.
Sets a edges's label.
[in] | edge | The ID of the edge whose label should be set. |
[in] | label | The ID of the label that should be assigned to the edge edge . |
Definition at line 120 of file ged_graph.ipp.
void ged::GEDGraph::setup_adjacency_matrix | ( | ) |
Prepares the adjacency matrix to allow quick retrieval of edges.
Definition at line 95 of file ged_graph.ipp.
GEDGraph::NodeID ged::GEDGraph::tail | ( | EdgeID | edge | ) | const |
Returns the tail of an edge.
[in] | edge | The ID of the edge whose tail is to be returned. |
Definition at line 178 of file ged_graph.ipp.
|
static |
Returns an undefined node.
Definition at line 62 of file ged_graph.ipp.
|
related |
Streams a graph.
[in,out] | os | Output stream. |
[in] | graph | The graph that should be streamed. |
os
. Definition at line 281 of file ged_graph.ipp.