Graph Class

Definition

Represents a directed graph, consisting of nodes and links.

public ref class Graph : Microsoft::VisualStudio::GraphModel::GraphObject, System::Runtime::Serialization::ISerializable
[System.Serializable]
public class Graph : Microsoft.VisualStudio.GraphModel.GraphObject, System.Runtime.Serialization.ISerializable
[<System.Serializable>]
type Graph = class
    inherit GraphObject
    interface ISerializable
Public Class Graph
Inherits GraphObject
Implements ISerializable
Inheritance
Attributes
Implements

Constructors

Graph()

Constructs a Graph object.

Graph(SerializationInfo, StreamingContext)

Special constructor that is used for deserialization only.

Properties

AllGroups

Every group in the graph regardless of visibility or nesting

AllSchemas

Return a list of all unique known schemas.

Categories

Return all categories. Never returns null.

(Inherited from GraphObject)
CategoryCount

Return number of categories in the object.

(Inherited from GraphObject)
CommonPaths

A dictionary of the common paths that are replaced during serialization.

DescriptiveCategoryLabel

Creates a delimited list of all category labels for this graph object.

(Inherited from GraphObject)
DocumentSchema

Get The document schema of the Graph which contains all properties and categories discovered by serializer that were not already defined in a schema registered via AddSchema. Does not return null.

Groups

Get the collection of all top level groups

IsGroup

Get whether this object is is a group. It looks for the GraphCommonSchema.Group property on the object.

(Inherited from GraphObject)
IsPseudo

Get whether this object is Pseudo. It looks for the GraphProperties.IsPseudo

(Inherited from GraphObject)
Item[GraphProperty]

Property that gets or sets a property value.

(Inherited from GraphObject)
Links

Get the collection of links

Nodes

Get the collection of all nodes in the graph, including nodes that are groups.

OrphanNodes

Get all nodes that are not children of any GraphGroup

Owner

Get the Graph object that this object belongs to.

(Inherited from GraphObject)
Paths

CommonPaths found by the serializer during load which we will also use during save.

Properties

Property that returns an enumeration of all annotations. The order of the enumeration is random.

(Inherited from GraphObject)
PropertyCount

Property that returns an number of of all annotations.

(Inherited from GraphObject)
PropertyKeys

Property that returns an enumeration of all annotation keys. The order of the enumeration is random.

(Inherited from GraphObject)
PropertyValues

Property that returns an enumeration of all annotation values. The order of the enumeration is random.

(Inherited from GraphObject)
Styles

Get the collection of styles

Visibility

Helper property to get/set visibility property of a GraphObject

(Inherited from GraphObject)
VisibleLinks

Return the visible links (link.IsVisible == true) and whose source and target nodes are also visible and not inside any collapsed groups

VisibleNodes

Return the visible nodes (node.IsVisible == true)

VisibleOrphanNodes

Get all visible nodes that are not children of any GraphGroup

VisibleTopLevelGroups

Return the visible top level groups (node.IsVisible == true).

Methods

AddCategory(GraphCategory)

Add a category to the object

(Inherited from GraphObject)
AddSchema(GraphSchema)

Add a new schema to the Graph - once it's added, it cannot be removed again as nodes or links might be using categories or properties from the schema.

AsNode()

Converts the GraphObject to a GraphNode. If this is a GraphGroup, the inner node is returned. For types other than GraphNode/Group, null is returned.

(Inherited from GraphObject)
BeginUpdate(Object, String, UndoOption, Boolean)

Start a batch mode update on the Graph (which is more efficient). You must call the Complete() method on the returned GraphTransactionScope otherwise your changes will be rolled back. The usual pattern is to use this in a using block so that if an exception is thrown the changes are automatically rolled back.

BeginUpdate(Object, String, UndoOption)

Start a batch mode update on the Graph (which is more efficient). You must call the Complete() method on the returned GraphTransactionScope otherwise your changes will be rolled back. The usual pattern is to use this in a using block so that if an exception is thrown the changes are automatically rolled back.

Clear()
ClearCategories()

Remove all categories from this object.

(Inherited from GraphObject)
ClearValue(GraphProperty)

Removes the value of the specified property

(Inherited from GraphObject)
ClearValue<T>(GraphProperty)

Clear the value of the specified property.

(Inherited from GraphObject)
Copy()

Create a copy of this graph.

CopyCategories(GraphObject)

Copy any new categories from the given object, keeping existing categories.

(Inherited from GraphObject)
CopyProperties(GraphObject)

Copy any new properties from the given object, keeping existing property values unchanged.

(Inherited from GraphObject)
CopySchemas(Graph)

Copy the schemas from the other graph

FindCommonAncestor(IEnumerable<GraphNode>)

This method finds the common ancestor of all the nodes in the given collection.

FindGroup(GraphNode)

Return the GraphGroup wrapper for the given "IsGroup" node.

GetDerivedCategory(GraphCategory)

Return first matching leaf category that has the given category in its heirarchy.

(Inherited from GraphObject)
GetDerivedCategory(String)

Return first matching leaf category that has the given category in its heirarchy.

(Inherited from GraphObject)
GetGroupDescendants(IEnumerable<GraphObject>, Predicate<GraphGroup>, Predicate<GraphNode>)

Get a flat list of all the descendant nodes of the given list of graph objects where some of those objects could be groups, filtered to include only the nodes and groups that match the given predicates.

GetGroupDescendants(IEnumerable<GraphObject>)

Get a flat list of all the descendant nodes of the given list of graph objects where some of those objects could be groups.

GetMetaObject(Expression) (Inherited from GraphObject)
GetObjectData(SerializationInfo, StreamingContext)

ISerializable implementation - Gets the data for the object. Serialize the graph into DGML

GetSchemaValue(GraphProperty)

Gets the schema specific value of the property if one exists.

(Inherited from GraphObject)
GetSearchableObjects(Graph)

Get a flat list of all the nodes in the graph that are visible, in top down DFS group hierarchy order.

GetValue(GraphProperty)

Gets the value of the specified annotation.

(Inherited from GraphObject)
GetValue(String)

Gets the value of the specified property.

(Inherited from GraphObject)
GetValue<T>(GraphProperty, Graph, GraphCategory)

Gets the value of the specified property, and also return the category that this property value was inherited from if any.

(Inherited from GraphObject)
GetValue<T>(GraphProperty, Graph)

Gets the value of the specified property.

(Inherited from GraphObject)
GetValue<T>(GraphProperty, T)

Gets the value of the specified annotation. if property is not set we reutnr the default value that the caller pass to this method

(Inherited from GraphObject)
GetValue<T>(GraphProperty)

Gets the value of the specified property.

(Inherited from GraphObject)
GetValue<T>(String)

Gets the value of the specified property.

(Inherited from GraphObject)
GetValueAsString(GraphProperty, CultureInfo)

Returns the given property as a string using the given culture.

(Inherited from GraphObject)
HasCategory(GraphCategory)

Return true if the object has the given category.

(Inherited from GraphObject)
HasCategory(IEnumerable<GraphCategory>)

Return true if the object has any of the given categories.

(Inherited from GraphObject)
HasCategory(String)

Return true if the object has the given category.

(Inherited from GraphObject)
HasCategoryInSet(HashSet<GraphCategory>, GraphCategoryMatchOption)

Determines if the given set of categories applies to this object.

(Inherited from GraphObject)
HasLocalValue(GraphProperty)

Return true if the specified property exists on this object with no cateogry inheritance check.

(Inherited from GraphObject)
HasValue(GraphProperty)

Return true if the specified annotation exists.

(Inherited from GraphObject)
HasValue(String)

Find out if the object has a value for the specified property.

(Inherited from GraphObject)
HideOrphans()

Hides orphan nodes. An orphan is a node that is not contained by a group.

ImportLink(GraphLink)

Imports a Link along with its source and target nodes so they belong to the graph also. Merges any node or link properties and categories necessary.

ImportNode(GraphNode)

Imports a node into a graph. Merging any categories and properties necessary.

ImportStyle(GraphConditionalStyle)

Create a copy of the given style that belongs to this graph.

ImportSubset(GraphNode, Boolean, Int32)

Clone the given node and it's properties and the given number of levels of links and all the nodes those links point to and import all these new nodes and links into this graph. If levels is zero then no links are copied. If levels is 1 then it copies one level of links and all the nodes they point to.

ImportSubset(IEnumerable<GraphNode>, Boolean, Int32)

Clone all the nodes and the given number of levels of links away from those nodes.

Load(Stream, EventHandler<GraphDeserializationProgressEventArgs>, GraphSchema[])

Loads the graph object model from the given stream.

Load(Stream, GraphSchema[])

Loads the graph object model from the given stream.

Load(String, EventHandler<GraphDeserializationProgressEventArgs>, GraphSchema[])

Load a new Graph object from the given file.

Load(String, GraphSchema[])

Load a new Graph object from the given file.

Load(TextReader, EventHandler<GraphDeserializationProgressEventArgs>, GraphSchema[])

Loads the graph object model from the given TextReader.

Load(TextReader, GraphSchema[])

Loads the graph object model from the given TextReader.

Load(XDocument, EventHandler<GraphDeserializationProgressEventArgs>, GraphSchema[])

Loads the graph object model from the given XDocument.

Load(XDocument, GraphSchema[])

Loads the graph object model from the given XDocument.

Load(XmlReader, EventHandler<GraphDeserializationProgressEventArgs>, GraphSchema[])
Obsolete.

Loads the graph object model from the given XmlReader.

Load(XmlReader, GraphSchema[])

Loads the graph object model from the given XmlReader. Consider not using this API since it might be removed in the future. Do not use this API unless you configured the reader with appropriate settings: DtdProcessing (Ignore) and CheckCharacters (false)

LoadAndMerge(Stream, EventHandler<GraphDeserializationProgressEventArgs>, GraphSchema[])

Loads the graph object model from the given stream and merges it in to the graph.

LoadAndMerge(Stream, GraphSchema[])

Loads the graph object model from the given stream and merges it in to the graph.

LoadAndMerge(String, EventHandler<GraphDeserializationProgressEventArgs>, GraphSchema[])

Loads the graph object model from the given file and merges it in to the graph.

LoadAndMerge(String, GraphSchema[])

Loads the graph object model from the given file and merges it in to the graph.

LoadAndMerge(XDocument, EventHandler<GraphDeserializationProgressEventArgs>, GraphSchema[])

Loads the graph object model from the given XDocument and merges it in to the graph.

LoadAndMerge(XDocument, GraphSchema[])

Loads the graph object model from the given XDocument and merges it in to the graph.

Merge(Graph)

Merge all new nodes and links from the given graph into this graph

Merge(IEnumerable<GraphConditionalStyle>)

Merge all the styles from the given list.

Merge(IEnumerable<GraphLink>)

Merge all of the links from the given link list into this graph

Merge(IEnumerable<GraphNode>)

Merge all of the nodes from the given node list into this graph

Merge(IEnumerable<GraphObject>)

Merge all new nodes and links from the given list of graph objects into this graph

OnCategoryChanged(GraphCategory, GraphCategoryChangeType) (Inherited from GraphObject)
OnPropertyChanged(GraphProperty)

Raise a PropertyChangd event for the given GraphProperty

(Inherited from GraphObject)
OnPropertyChanged(String)

Raise a PropertyChangd event for the named property

(Inherited from GraphObject)
Parse(String, EventHandler<GraphDeserializationProgressEventArgs>, GraphSchema[])

Load a new Graph object from the given in-memory string containing DGML markup.

Parse(String, GraphSchema[])

Load a new Graph object from the given in-memory string containing DGML markup.

ParseSerializedNodeId(String)

Parses a serialized node ID into a fully expanded GraphNodeId.

RemoveCategory(GraphCategory)

Remove the category of this object

(Inherited from GraphObject)
RenameNode(GraphNode, GraphNodeId)

Renames a Node in the Graph (clones to new Node and removed original)

RenameNode(GraphNodeId, GraphNodeId)

Renames a Node in the Graph (clones to new Node and removed original)

RenameNode(String, String)

Renames a Node in the Graph (clones to new Node and removed original)

Save(Stream, GraphSerializationSettings)

Save the graph to the output stream with the given settings.

Save(Stream, XmlWriterSettings, GraphSerializationSettings)

Save the graph to the output stream with the given settings.

Save(String, GraphSerializationSettings)

Save the Graph the a file.

Save(String, XmlWriterSettings, GraphSerializationSettings)

Save the Graph the a file.

Save(XmlWriter, GraphSerializationSettings)
Obsolete.

Save the graph to the XmlWriter with the given settings.

SetValue(String, Object)

Add an annotation using the given key, type and value

(Inherited from GraphObject)
SetValue<T>(GraphProperty, T)

Sets the value of the given property. If the proeprty already exists, its value is overwritten unless the annotation flags prevent otherwise.

(Inherited from GraphObject)
ToXml()

Convert the graph to XML using the GraphSerializer.

ToXml(Int32)

Convert the graph to XML using the GraphSerializer.

WrapGraphObject(GraphObject)

Modifies the current graph object to share the same property and categories as the given graph object. The wrapper and wrappee graph objects will always have identical sets of properties and categories.

(Inherited from GraphObject)

Events

BeginUndoableTransactionScope

will be notified when an UndoableGraphTransactionScope is opened by the Graph.BeginUpdate method.

CategoryChanged (Inherited from GraphObject)
EndUndoableTransactionScope

will be notified when the UndoableGraphTransactionScope opened by Graph.BeginUpdate is disposed.

PropertyChanged (Inherited from GraphObject)
Updated

Event implementation for GraphUpdated. We don't use an implicit C# event here because we want to only listen on the TransactedDictionaryChanges if there are clients listening on us. (For perf reasons).

Updating

Event implementation for BeforeUpdate. This is an event that can be listened on and cancel the changes to a graph. We don't use an implicit C# event here because we want to only listen on the TransactedDictionaryChanges if there are clients listening on us. (For perf reasons).

Extension Methods

DEBUG_GetLabelOrId(GraphObject)

Returns the label of an object or the id if the label is null. Should be used for tracing Microsoft.VisualStudio.Diagnostics.PerformanceProvider.DebugTrace.IDebugTracer

Applies to