Searches the graph for a node that has its Caption property equal to the specified parameter. It returns the first node with this caption. If no node is found, the function returns nil.
Namespace: GGraph
Delphi
|
public
function FindNode( const Caption: String ): TGGraphNode; virtual; abstract;
|
Parameters
Caption
Type: String
Return Value
Type: TGGraphNode
The following code extracts two nodes from the graph, copies one node's Caption to the other and then reinserts the node back into the graph:
Delphi
|
var
Node1, Node2: TGGraphNode;
begin
// extract the first node
Node1 := Graph.Extract( 'Node1' );
// find the second node and extract it
Node2 := Graph.FindNode( 'Node2' );
Graph.Extract( Node2 );
// copy node2 caption to node 1
Node1.Caption := Node2.Caption;
// reinsert node1 into the graph, note that the edges are gone for node 1
Node1.Graph := Graph;
// free node 2
Node2.Free;
end;
|