Returns the number of nodes connected to the current node (as opposed to which nodes this node points to).
Namespace: GGraph
Delphi
|
public
property InDegree: Integer read FInDegree;
|
Property Value
Type: Integer
The following code deletes all edges into the current node (ANode):
Delphi
|
{ Remove all predecessors (IN Nodes) to a node }
var
j: Integer;
n1: TGGraphNode;
begin
if not ANode.Graph.Directed then
ANode.Clear
else if ANode.InDegree > 0 then
begin
{ Find all nodes }
with ANode.Graph.GetNodes do
while HasMoreElements do
begin
n1 := TGGraphNode(NextElement);
{ Who have an edge TO Anode }
for j := n1.EdgeCount - 1 downto 0 do
if n1.Edge[j].ToNode = ANode then
begin
n1.RemoveEdge( j );
if ANode.InDegree = 0 then Exit;
end;
end;
end;
end;
|