TheSwamp

Code Red => .NET => Topic started by: gswang on April 03, 2010, 07:31:13 PM

Title: What's the GraphNodeCollection?
Post by: gswang on April 03, 2010, 07:31:13 PM
GraphNodeCollection and GraphNode are what used...
Title: Re: What's the GraphNodeCollection?
Post by: Kerry on April 03, 2010, 08:45:48 PM
A GraphNode  is a disposable wrapper of the AcDbGraphNode ObjectARX class.

A Node is part of a structure based on a Directed acyclic graph http://en.wikipedia.org/wiki/Directed_acyclic_graph
which is used to record relationships between the nodes.

This is a fairly complicated system and I'm not familiar enough with computer science to explain it fully.
Thankfully the methods and properties don't require a full knowledge of the inner workings.

Graphs are used for Dynamic blocks and xrefs.

The XrefGraph is derived from the Graph Class.
From the ARX docs for XrefGraph Class:
Quote
This .NET class wraps the AcDbXrefGraph ObjectARX class.

XrefGraph is a derived class for representing xrefs, using the XrefGraphNode class to represent one xref database at each node.
An XrefGraph is a representation of the relationship between a host drawing, its xref'ed drawings, and any nested xref drawings. Each database or xref block table record is represented by an XrefGraphNode in the graph. The host drawing is always the rootNode. Each reference (between databases) is represented by an edge in the graph, and can be queried by calling GraphNode.in(idx) for what is referencing this node, and GraphNode.out(idx) for what this node references.

While there can be more than one BlockReference referencing an xref BlockTableRecord, only one corresponding edge is created between each XrefNode.

From the XrefGraphNode Class docs :
Quote
This .NET class wraps the AcDbXrefGraphNode ObjectARX class.

XrefGraph is a derived class for representing an xref. Each XrefGraphNode represents one xref database.

An XrefGraph is a representation of the relationship between a host drawing, its xref'd drawings, and any nested xref drawings. Each database or xref BlockTableRecord is represented by an XrefGraphNode in the graph. The host drawing is always the rootNode. Each reference (between databases) is represented by an edge in the graph, and can be queried by calling GraphNode.in(idx) for what is referencing this node, and GraphNode.out(idx) for what this node references.

While there can be more than one BlockReference referencing an xref BlockTableRecord, only one corresponding edge is created between each XrefNode.

From the GraphNode Class docs :
Unfortunatly this may not help much :(
Quote
This .NET class wraps the AcDbGraphNode ObjectARX class.

This class provides a generic graph node implementation. One other class is also involved in the graph mechanism: Graph.

Detection for circular references is done by internally creating a duplicate set of references in each node, then trimming away all leaf nodes which terminate without circularity. If any nodes remain in the duplicate graph, those nodes exist in a cycle. Graph.FindCycles() is used to set up the internal cycle information and enable several query methods to return information about any cycles found.

Sorry I can't be of more help.
Title: Re: What's the GraphNodeCollection?
Post by: Kerry on April 03, 2010, 08:55:42 PM

Have a look at these samples :

http://www.theswamp.org/index.php?topic=8299.msg106160#msg106160

http://www.theswamp.org/index.php?topic=22884.msg371249#msg371249

http://www.theswamp.org/index.php?topic=31863.msg373777#msg373777

http://www.theswamp.org/index.php?topic=24524.msg296051#msg296051

http://www.theswamp.org/index.php?topic=12272.msg152426#msg152426

If you search this NET section for GraphNode you will find more references.
Title: Re: What's the GraphNodeCollection?
Post by: gile on April 04, 2010, 03:20:30 AM
Hi,

This can be a graphical representation of the the difference between a graph and a tree of the same linked datas.

A has 3 nodes 'Out'
B has 1 node 'In' and 2 nodes 'Out'
C has 3 nodes 'In'
Title: Re: What's the GraphNodeCollection?
Post by: gswang on April 04, 2010, 05:07:53 AM
Thank you everyone! now i have a basic understanding of the Graph. :-P