#include <graph.h>
A graph is a set of nodes connected to some other nodes. The two types of graph are supported: directed and undirected; the type must be specified with the constructor. A node is characterized by a value which determines if the node is active in the representation of the graph or not. A node can reference any of the Pandore object. It indexes an item in a separate array of items by a long value. It is equivalent to a pointer to an objet in an array except that not type is needed.
see The Graphs.
Public Types | |
typedef Double | ValueType |
Public Member Functions | |
Typobj | Type () const |
std::string | Name () const |
bool | isDirected () const |
Long | Width () const |
Long | Height () const |
Long | Size () const |
Dimension2d | ImageSize () const |
PobjectProps | Props () const |
Graph2d (bool directed=false) | |
Graph2d (Long s, bool directed=false) | |
Graph2d (Long s, Long h, Long w, bool directed=false) | |
Graph2d (Long s, const Dimension2d &d, bool directed=false) | |
Graph2d (const PobjectProps &p) | |
~Graph2d () | |
void | New (Long s, Long h, Long w) |
void | New (const PobjectProps &p) |
void | Delete () |
Graph2d & | operator= (const Graph2d &src) |
Errc | Init (const Reg2d &rgs, const Reg2d &seeds) |
Errc | Init (const Reg2d &rgs) |
Pobject * | Clone () const |
GNode< Point2d > * | operator[] (Long pos) |
const GNode< Point2d > * | operator[] (Long pos) const |
Errc | Add (Long node, Long item, const Point2d &pt) |
Errc | Add (Long node, Long item) |
Errc | Add (Long node, Long item, Long y, Long x) |
Errc | Del (Long s) |
Errc | Link (Long s1, Long s2, Double weight=1.0F, bool add=false) |
Errc | Link (Long s1, Long s2, Long i, Double weight=1.0F, bool add=false) |
Errc | Unlink (Long s1, Long s2) |
Errc | Unlink (Long s1, Long s2, Long i) |
Errc | Merge (Long s1, Long s2) |
Errc | Split (Long s1, Long s2) |
Errc | LoadAttributes (FILE *file) |
Errc | SaveAttributes (FILE *file) const |
Errc | LoadData (FILE *file) |
Errc | SaveData (FILE *file) const |
Pobject * | Mask (const Pobject *mask) |
Pobject * | UnMask (const Pobject *mask, const Pobject *reference) |
Graph2d (const Graph2d &grs) |
|
The type of the data (for instance Double). |
|
Creates a new graph with no data.
|
|
Creates a new graph with the specified number of nodes and the specified dimension of the related image. Allocates therefrom the related data.
|
|
Creates a new graph with the specified number of nodes and the specified dimension of the related image. Allocates therefrom the related data.
|
|
Creates a new graph with the specified number of nodes and the specified dimension of the related image. Allocates therefrom the related data.
|
|
Creates a new graph with the specified properties. Allocates therefrom the related data.
|
|
Deletes the graph. |
|
Creates a new graph by copy. Allocates the related data and sets the values with the grs values. If needed casts the values by using the C casting.
|
|
Adds the specified node that references the specified item. The coordinates of the node is set to the specificied cordinates.
|
|
Adds the specified node that references the specified item. The coordinate of the node is set to (0, 0).
|
|
Adds the specified node that references the specified item.
|
|
Creates and returns a distinct copy of this object.
|
|
Deletes the specified node from the graph. Unlinks it from connected nodes.
|
|
Deletes the graph data. |
|
Returns the number of rows of the related image.
|
|
Returns the dimension of the related image.
|
|
Initializes the graph with the given region map. Each region is represented as a node, and connected regions are represented as a link between the related nodes.
|
|
Initializes the graph with the given region map. Each region is represented as a node, and connected regions are represented as a link between the related nodes. The seed map is used to set the coordinates of each node.
|
|
|
|
Links the two specified nodes s1 and s2 by adding two identified edges one from s1 to s2 and one from s2 to s1 and sets the specified value for the link weight, either by adding it to the current weight if add = true or by setting it.
|
|
Links the two specified nodes s1 and s2 by adding two edges one from s1 to s2 and one from s2 to s1 and sets the specified value for each edge weight, either by adding it to the current weight if add = true or by setting it.
|
|
Loads attribute values from the specified file. Allocates therefrom the related data.
|
|
Loads data from the specified file.
|
|
Creates a new Graph of the same type but where the data are masked by the given mask. It means that value are set to 0 when the related label in the mask is 0.
|
|
Merges the two specified nodes.This means keeps only the first node and merges all neighbours of the second node. The result weight is the sum of the weight, but the seed is still the seed of the first node.
|
|
Returns the name of the graph type.
|
|
Allocates the image data from the specified vector of properties.
|
|
Allocates the data from the specified number of nodes, and the specified dimension of the related image.
|
|
Sets the values of the graph from the specified graph values. If needed, deletes the previous data and reallocs new data.
|
|
Returns the node at the specified coordinates.
|
|
Returns the node at the specified coordinates.
|
|
Returns the related vector of properties.
|
|
Saves the current attribute values.
|
|
Saves data in the specified file.
|
|
Returns the number of nodes.
|
|
Splits the first node to create the second node. The list of neighbours, the weight and the seeds are duplicated.
|
|
Returns the graph identifier.
|
|
Removes the link i between the two specified nodes s1 and s2. Other link between the two nodes s1 and s2 are not removed, therefore s1 can remain a neighbor of s2.
|
|
Unlinks the two specified nodes. s1 will no longer be a neighbour of s2 (and vice versa).
|
|
Creates a new graph where the data are ummasked by the given mask and the given reference image. It means that values are set to the value of the reference object when the related label in the mask is 0.
|
|
Returns the number of columns of the related image.
|