A directed or undirected graph More...
#include <GTL/graph.h>
A graph G=(V,E) consists of a set of nodes V and a set of edges E, where every edge can be viewed as a (ordered) pair of nodes (u,v) connecting source u with target v. Obviously this implies a direction on the edges, which is why we call these graphs directed (this is the default). A graph can be made undirected by just ignoring the (implicit) direction.
[public]
Generates an empty graph, i.e. without any nodes and any edges.
[public]
Copy constructor. Please note: This will generate an
isomorpic copy of G
. Although this graph will look
like G
it is not physically the same.
Especially it consists of nodes and edges, which of course have
counterparts in G
, but are different. This means
that the nodes (edges) in the copy have undefined behaviour if
used within a node_map (edge_map ) of the original graph.
G | graph |
[public]
Makes new graph isomorphic to the subgraph induced by nodes
.
The same restriction as for the ordinary copy constructor applies to
this one.
G | graph |
nodes |
nodes of G , which form the induced subgraph this graph will be isomorphic to.
|
[public]
Makes new graph isomorphic to the subgraph induced by the nodes
in the range from it
to end
The same restriction as for the ordinary copy constructor applies to
this one.
end | end of nodes |
G | graph |
it | beginning of nodes |
[public virtual]
Destructor. Deletes all nodes and edges.
[public]
Makes graph directed.
[public]
Makes graph undirected.
[public]
Test whether the graph is directed.
[public]
Test whether the graph is undirected.
[public]
Checks if for all edges (v, w) the reverse edge
(w,v) is present, too. Additionally the reverse of some
edge e
will be stored as rev[e]
. If there
is no reverse edge of e
rev[e]
will be the
invalid edge edge()
.
rev | map associating every edge with its reverse edge. |
[public]
Test whether the graph is connected
[public]
Test whether the graph is acyclic
[public]
Returns the number of nodes in the graph.
[public]
Returns the number of (visible) edges in the graph
[public]
Returns a center of the graph which is defined as a node with maximum excentricity.
[public virtual]
Adds a new node.
[public virtual]
Adds new edge from s
to
t
.
Precondition: s,t
are valid nodes in this graph.
s | source of new edge |
t | target of new edge |
[public]
Deletes node n
, and thus all edges incident with
n
.
Precondition: n
is a valid visible node
in this graph
n | visible node to be deleted |
[public]
Deletes edge e
.
Precondition: e
is a valid visible edge
in this graph.
e | edge to be deleted |
[public]
Deletes all nodes and edges, even the hidden ones
[public]
Iterate through all nodes in the graph.
[public]
Iterate through all nodes in the graph.
[public]
Iterate through all edges in the graph.
[public]
Iterate through all edges in the graph.
[public]
Hides an edge.
Precondition: e
is a valid edge in this graph
e | edge to be hidden |
[public]
Restores a hidden edge
Precondition: e
is a valid edge in this graph
e | hidden edge |
[public]
Hides a node. Please note: all the edges incident with
n
will be hidden, too. All these edges are returned
in a list.
Precondition: n
is a valid node in this graph
e | node to be hidden |
[public]
Restores a hidden node. This only restores the node itself. It doesn't restore the incident edges, i.e. you will have to restore all the edges you get returned when calling graph::hide_node yourself.
Precondition: n
is a valid node in this graph
n | hidden node |
[public]
Hides all nodes not contained in subgraph_nodes
, i.e.
(the visible part of) the graph is the induced subgraph with
respect to the nodes in subgraph_nodes
. It is allowed
to apply this function recursively, i.e. one may call
induced_subgraph
on a graph that is already a induced
subgraph.
subgraph_nodes | nodes of subgraph. |
[public]
Restores all hidden nodes and edges This means that, although the nodes and edges got hidden at different times, they will be restored all together.
[public]
Load graph from a file in GML-format.
filename | file in GML-format. |
[public]
Load graph from a file in GML-format.
filename | file in GML-format. |
[public]
Save graph to file filename
in GML-format, i.e.
graph [ node [ id # ] ... edge [ source # target #] ... ]
filename |
[public]
Saves graph to stream file
in GML-format.
file | output stream defaults to cout. |
[public virtual]
Virtual function called before a new node is created; can be redefined in a derived class for customization
[public virtual]
Virtual function called after a new node was created; can be redefined in a derived class for customization
n | created node |
[public virtual]
Virtual function called before a node is deleted; can be redefined in a derived class for customization
n | node deleted afterwards |
[public virtual]
Virtual function called after a node was deleted; can be redefined in a derived class for customization
[public virtual]
Virtual function called before a node gets hidden; can be redefined in a derived class for customization
n | node to be hidden |
[public virtual]
Virtual function called after a node got hidden; can be redefined in a derived class for customization
n | hidden node |
[public virtual]
Virtual function called before a node is restored; can be redefined in a derived class for customization
n | node to be restored |
[public virtual]
Virtual function called after a node was restored; can be redefined in a derived class for customization
n | restored node |
[public virtual]
Virtual function called before a new edge is inserted; can be redefined in a derived class for customization
s | source of edge created afterwards |
t | target of edge created afterwards |
[public virtual]
Virtual function called after a new edge was inserted; can be redefined in a derived class for customization
e | created edge |
[public virtual]
Virtual function called before a edge is deleted; can be redefined in a derived class for customization
e | edge to be deleted |
[public virtual]
Virtual function called after a edge was deleted; can be redefined in a derived class for customization
s | source of edge deleted |
t | target of edge deleted |
[public virtual]
Virtual function called before a edge gets hidden; can be redefined in a derived class for customization
e | edge to be hidden |
[public virtual]
Virtual function called after a edge got hidden; can be redefined in a derived class for customization
e | hidden edge |
[public virtual]
Virtual function called before a edge is restored; can be redefined in a derived class for customization
e | edge to be restored |
[public virtual]
Virtual function called after a edge was restored; can be redefined in a derived class for customization
e | restored edge |
[public virtual]
Virtual function called before performing clear; can be redefined in a derived class for customization. Please note: Although nodes and edges are deleted during graph::clear this is not achieved by calling graph::del_node and graph::del_edge which is why the correspondig handler will not be called.
[public virtual]
Virtual function called after the graph was cleared; can be redefined in a derived class for customization Please note: Although nodes and edges are deleted during graph::clear this is not achieved by calling graph::del_node and graph::del_edge which is why the correspondig handler will not be called.
[public virtual]
Virtual function called before performing make_directed (only if graph was undirected) can be redefined in a derived class for customization
[public virtual]
Virtual function called after performing make_directed; (only if graph was undirected) can be redefined in a derived class for customization
[public virtual]
Virtual function called before performing make_undirected; (only if graph was directed) can be redefined in a derived class for customization
[public virtual]
Virtual function called after performing make_undirected; (only if graph was directed) can be redefined in a derived class for customization
[public virtual]
Called before writing the graph key to os
. This can be
used to write top-level keys that should appear before the graph in
the file.
os | output stream. |
[public virtual]
Called before the closing bracket of the list belonging to the graph key is written. This can be used to write information that belong to the graph, and thus should appear within the list associated with the graph key.
os | output stream. |
[public virtual]
Called before the closing bracket of the list belonging to the key
of node n
is written. This can be used to write
information belonging to the node n
and thus should
appear within the list associated with this node.
os | output stream. |
[public virtual]
Called before the closing bracket of the list belonging to the key
of edge e
is written. This can be used to write
information belonging to the edge e
and thus should
appear within the list associated with this edge.
os | output stream. |
[public virtual]
Called after writing the graph key to os
. This can be
used to write top-level keys that should appear after the graph in
the file.
os | output stream. |
[public virtual]
Called when all information belonging to the first key "graph" is parsed, i.e. all the key-value-pairs, which are at the topmost level - except the graph key will be passed to this handler.
list | pointer to the list of key-value pairs at top level |
[public virtual]
Called when all the essential information belonging to a node is parsed. All the key-value-pairs which were not used by GTL will be passed to this handler.
list | pointer to the list of key-value-pairs of this node. |
n | node parsed |
[public virtual]
Called when all the essential information belonging to an edge is parsed. All the key-value-pairs which were not used by GTL will be passed to this handler.
list | pointer to the list of key-value-pairs of this edge. |
e | edge parsed |
[public virtual]
Called when all the essential information belonging to a graph is parsed. All the key-value-pairs which were not used by GTL will be passed to this handler.
list | pointer to the list of key-value-pairs of the graph. |
Kdoc |