Connectivity

References
public sealed class Connectivity
A readonly snapshot of the object connectivity within a document.

Constructors

Connectivity

#
public Connectivity(Document doc)
Construct a new document connectivity. This is not a threadsafe constructor, if the document is modified during the construction of this connectivity, things may go terribly wrong.
doc (Document)

Connectivity

#
public Connectivity(IEnumerable<IDocumentObject> objects)
Create a connectivity set from a collection of objects.
objects (IEnumerable<IDocumentObject>)

Properties

AllNodes

#
public IEnumerable<ConnectiveObject> AllNodes { get; }
Iterate over all object and group nodes.

GroupNodes

#
public IEnumerable<ConnectiveGroup> GroupNodes { get; }
Iterate over all group nodes.

ObjectNodes

#
public IEnumerable<ConnectiveObject> ObjectNodes { get; }
Iterate over all object nodes.

Methods

Find

#
public bool Find(Guid id, out ConnectiveObject node)
Low level GUID -> ConnectiveObject resolver. This will search both the object and the group lists.
id (Guid)
node (out ConnectiveObject)

FindAllInputs

#
public IEnumerable<ConnectiveObject> FindAllInputs(ConnectiveObject obj)
Recursively find all input objects.
obj (ConnectiveObject)

FindAllInputs

#
public IEnumerable<ConnectiveObject> FindAllInputs(Guid id)
Recursively find all input objects.
id (Guid)

FindAllOutputs

#
public IEnumerable<ConnectiveObject> FindAllOutputs(ConnectiveObject obj)
Recursively find all output objects.
obj (ConnectiveObject)

FindAllOutputs

#
public IEnumerable<ConnectiveObject> FindAllOutputs(Guid id)
Recursively find all output objects.
id (Guid)

FindConnections

#
public IEnumerable<ConnectiveObject[]> FindConnections(ConnectiveObject upstream, ConnectiveObject downstream)
Find all connective paths between two objects.
upstream (ConnectiveObject)Upstream object.
downstream (ConnectiveObject)Downstream object.

FindConnections

#
public IEnumerable<ConnectiveObject[]> FindConnections(Guid upstream, Guid downstream)
Find all connective paths between two objects.
upstream (Guid)Upstream object.
downstream (Guid)Downstream object.

FindImmediateInputs

#
public IEnumerable<ConnectiveObject> FindImmediateInputs(ConnectiveObject obj)
Iterate over all the immediate inputs for an object. This includes inputs of any attached pins.
obj (ConnectiveObject)

FindImmediateInputs

#
public IEnumerable<ConnectiveObject> FindImmediateInputs(Guid id)
Iterate over all the immediate inputs for an object. This includes inputs of any attached pins.
id (Guid)

FindImmediateOutputs

#
public IEnumerable<ConnectiveObject> FindImmediateOutputs(ConnectiveObject obj)
Iterate over all the immediate outputs for an object. This includes outputs of any attached pins.
obj (ConnectiveObject)

FindImmediateOutputs

#
public IEnumerable<ConnectiveObject> FindImmediateOutputs(Guid id)
Iterate over all the immediate outputs for an object. This includes outputs of any attached pins.
id (Guid)

FindNodes

#
public IEnumerable<ConnectiveObject> FindNodes(IEnumerable<Guid> ids, List<Guid> failures = null)
Enumerate over all nodes that match the given IDs. Ids which cannot be found will be ignored.
ids (IEnumerable<Guid>)Ids to find.
failures (List<Guid> = null)If not null, will be populated with IDs which failed to resolve.

GetConnectiveId

#
public static Guid GetConnectiveId(Document doc, Guid id)
Find the topological ID of an object.
doc (Document)Document containing the object.
id (Guid)Id of object whose topological id to resolve.

GetConnectiveId

#
public static Guid GetConnectiveId(IDocumentObject obj)
Gets the Id under which an object is represented in a Connectivity graph. This will either be the IDocumentObject.InstanceId of the founding object, or, if the object is an attached pin, the IDocumentObject.InstanceId of the cushion.
obj (IDocumentObject)

IsLinear

#
public bool IsLinear(IEnumerable<ConnectiveObject> objects, out ConnectiveObject leading, out ConnectiveObject trailing)
Determine whether a set of objects acts as a linear sequence. That is there is a first object which is allowed to have inputs not in the set, a last object which is allowed to have outputs not in the set, and zero or more objects in between which only connect to their immediate neighbours on either side. Furthermore groups are allowed to exist, but only if all their contained objects are present within the sequence.
objects (IEnumerable<ConnectiveObject>)Objects to test.
leading (out ConnectiveObject)First object in linear sequence, if found.
trailing (out ConnectiveObject)Last object in linear sequence, if found.

IsLinear

#
public bool IsLinear(IEnumerable<Guid> ids, out ConnectiveObject first, out ConnectiveObject last)
Determine whether a set of objects acts as a linear sequence. That is there is a first object which is allowed to have inputs not in the set, a last object which is allowed to have outputs not in the set, and zero or more objects in between which only connect to their immediate neighbours on either side. Furthermore groups are allowed to exist, but only if all their contained objects are present within the sequence.
ids (IEnumerable<Guid>)Ids to test.
first (out ConnectiveObject)First object in linear sequence, if found.
last (out ConnectiveObject)Last object in linear sequence, if found.

SortCausally

#
public ConnectiveObject[] SortCausally(ConnectiveObject[] objects)
Sort a set of objects using their causal connections.
objects (ConnectiveObject[])

SubsetTopology

#
public GraphTopology SubsetTopology(IEnumerable<Guid> ids)
Measure the topology class for the subset of objects represented by the ids.
ids (IEnumerable<Guid>)

SubsetTopology

#
public GraphTopology SubsetTopology(IEnumerable<IDocumentObject> objects)
Measure the topology class for the set of objects. This method assumes that all the objects in the provided subset are part of the same document from which this connectivity was created. No input validation takes place.
objects (IEnumerable<IDocumentObject>)

WithoutRelays

#
public Connectivity WithoutRelays(bool dangling, bool simple, bool complex)
Create a new connectivity not containing (certain) relay objects.
dangling (bool)If true, relays with either no inputs or no outputs are removed.
simple (bool)If true, relays with single inputs and single outputs are removed.
complex (bool)If true, relays with at least two inputs or two outputs are removed.