#include <graphbase.h>
Basic undirected graph template.
NODE | The node type in the graph. |
EDGE | The edge type in the graph. |
Public Types | |
typedef GraphBase< NODE, EDGE > | Super |
typedef NODE | NodeType |
typedef EDGE | EdgeType |
Public Member Functions | |
GraphBase () | |
~GraphBase () | |
GraphBase (GraphBase &&src) | |
Result< void > | CopyFrom (const GraphBase &src) |
Result< void > | AppendGraph (const GraphBase &src) |
GRAPH_TYPE | GetType () const |
void | SetType (GRAPH_TYPE type) |
Int | GetNodesCount (Bool subPoint=false) const |
Int | GetEdgesCount () const |
NODE * | GetFirstNode () |
NODE * | GetLastNode () |
NODE * | FindNodeByPosition (const Vector &position, Float tolerance=0.0) |
const NODE * | FindNodeByPosition (const Vector &position, Float tolerance=0.0) const |
Result< NODE * > | GetNode (Int idx) |
Result< const NODE * > | GetNode (Int idx) const |
Result< NODE * > | GetSuccessor (NODE *node) |
Result< NODE * > | GetPredecessor (NODE *node) |
Result< EDGE * > | GetSuccessorEdge (NODE *node) |
Result< EDGE * > | GetPredecessorEdge (NODE *node) |
Int | FindNode (NODE *node) |
Result< EDGE * > | GetEdge (Int idx) |
Result< const EDGE * > | GetEdge (Int idx) const |
Int | FindEdge (EDGE *edge) |
Result< EDGE * > | GetEdgeByPoints (NodeType *p1, NodeType *p2) const |
Result< NODE * > | AddNode (const NodeType &node, Int pos=NOTOK) |
Result< EDGE * > | AddEdge (NodeType *p1, NodeType *p2, Int pos=NOTOK) |
Result< NODE * > | SplitEdge (const NODE &node, EdgeType *edge) |
Result< EDGE * > | SplitEdge (NodeType *node, EdgeType *edge) |
Result< void > | DeleteNode (NodeType *node, Bool replaceEdge=true) |
Result< void > | DeleteNode (Int pos, Bool replaceEdge=true) |
Result< void > | DeleteEdge (EdgeType *edge, Bool nodes=false) |
Result< void > | DeleteEdge (Int pos, Bool nodes=false) |
Result< void > | WeldNodes (NodeType *p1, NodeType *p2) |
Result< void > | MeltEdge (EdgeType *edge) |
Result< void > | MeltEdge (Int pos) |
void | Reset () |
Protected Attributes | |
GRAPH_TYPE | _type |
PointerArray< NODE > | _nodes |
PointerArray< EDGE > | _edges |
typedef NODE NodeType |
typedef EDGE EdgeType |
|
explicit |
~GraphBase | ( | ) |
Append src graph t this graph, the existing graph is mantained.
[in] | src | The graph to append. |
GRAPH_TYPE GetType | ( | void | ) | const |
Get The graph type.
void SetType | ( | GRAPH_TYPE | type | ) |
Set The graph type.
[in] | type | The new graph type. |
Get All nodes count in the graph.
Int GetEdgesCount | ( | ) | const |
Get All edge count in the graph.
NODE* GetFirstNode | ( | ) |
Get a pointer to the first node.
NODE* GetLastNode | ( | ) |
Get a pointer to the last node.
Serch a node with at passed position.
[in] | position | The 3d position where search the node. |
[in] | tolerance | Search can be tolerat if passed value is != 0. |
Serch a node with at passed position.
[in] | position | The 3d position where search the node. |
[in] | tolerance | Search can be tolerat if passed value is != 0. |
Get a node in the list.
[in] | idx | The node index in the list. |
Get a node in the list.
[in] | idx | The node index in the list. |
Result<NODE*> GetSuccessor | ( | NODE * | node | ) |
Get the successor node, valid only in continuos graph case.
[in] | node | The node. |
Result<NODE*> GetPredecessor | ( | NODE * | node | ) |
Get the predecessor node, valid only in continuos graph case.
[in] | node | The node. |
Result<EDGE*> GetSuccessorEdge | ( | NODE * | node | ) |
Get the successor edge, valid only in continuos graph case.
[in] | node | The node. |
Result<EDGE*> GetPredecessorEdge | ( | NODE * | node | ) |
Get the predecessor edge, valid only in continuos graph case.
[in] | node | The node. |
Int FindNode | ( | NODE * | node | ) |
Check if node exist in the node list and return the index.
[in] | node | The node to check for. |
Get a edge at idx in the list.
[in] | idx | The edge index in the list. |
Get a edge at idx in the list.
[in] | idx | The edge index in the list. |
Int FindEdge | ( | EDGE * | edge | ) |
Check if edge exist in the edge list and return the index.
[in] | edge | The edge to check for. |
Check if exist a edge in between p1 and p2, if yes return the pointer.
[in] | p1 | First edge point. |
[in] | p2 | Second edge point. |
Add a new node to the list.
[in] | node | The new pen node to add. |
[in] | pos | Optional position in to the array if NOTOK or not passed the point is added at the end of the list. |
Add a new edge in between p1 and p2 with type and initialize it. Automatically map the stoke to the points list.
[in] | p1 | First edge node. |
[in] | p2 | Second edge node. |
[in] | pos | If not NOTOK new stroke will be inserted at pos in the list. |
Split edge in 2 parts by adding the new node.
[in] | node | The new node to insert in to the list. |
[in] | edge | The edge to split. |
Split edge in 2 parts by attaching it to an existing node.
[in] | node | The node to attach the strokes. |
[in] | edge | The edge to split. |
Remove node and the connected edges.
[in] | node | The node to be removed. |
[in] | replaceEdge | If true a new edge will be added to fill the gap, just if the graph is not sparse (max 2 edges per node). |
Remove node at pos and the connected edges.
[in] | pos | The index position of node to be removed. |
[in] | replaceEdge | If true a new edge will be added to fill the gap, just if the graph is not sparse (max 2 edges per node). |
Remove the edge and adjust the nodes<->edges mapping.
[in] | edge | The edge to be removed. |
[in] | nodes | If True also node will be deleted if any other edge use it. |
Remove the edge and adjust the nodes<->edges mapping.
[in] | pos | The position in to edge list. |
[in] | nodes | If True also nodes will be deleted if any other edge use it. |
Weld disconnected nodes.
[in] | p1 | First node, this node will be stay alive. |
[in] | p2 | Second node. |
Shrink edge to a single node and refresh the graph.
[in] | edge | The edge to be removed. |
Shrink edge at pos to a single node and refresh the graph.
[in] | pos | The position in to edge list. |
void Reset | ( | void | ) |
Free memory and reset all values.
|
protected |
|
protected |
|
protected |