Graph Library Elements

Graph library elements can be found in the Graph section of the library pad. These functions allow to DeleteHandle PropertiesLookup, Merge, and find Reachable elements of a certain type (like nodes and edges). The functions extend the original inbuilt functions of the GrGen language. If you cannot find the Graph library category add it to your project by right-clicking on the Libraries folder in the Solution Explorer –> Add library –> Foundation/Graph.

Delete

There are following graph library elements available for deleting nodes or edges:

NameDescription
Graph_deleteDuplicatedEdgeDeletes an edge if there is another one with the same source and target nodes.
Graph_deleteDuplicatedEdgeByClassDeletes an edge if there is another one with the same source and target nodes and it is of the specified class.
Graph_deleteNodeByClass/Graph_deleteEdgeByClassDeletes a node/edge if it is of the specified class.
Graph_deleteIsolatedNodeDeletes a node if it has no incident edges.
Graph_deleteIsolatedNodeByClassDeletes a node if it has no incident edges and is of the specified class.

Handle properties

The following graph library elements can be used to handle properties or property values of nodes and edges:

NameDescription
Graph_areNodeAttributesEqualReturns true if the specified attributes of two nodes are equal.
Graph_areEdgeAttributesEqualReturns true if the specified attributes of two edges are equal
Graph_getNodeAttributeReturns the node attribute's value as object in the output pad.
Graph_getEdgeAttribute Returns the edge attribute's value as object in the output pad
Graph_getNodeClassReturns a node's full class name as a string in the output window
Graph_getEdgeClassReturns a edge's full class name as a string in the output window.
Graph_isNodeofClassReturns true in the output pad if a node is of a specified class.
Graph_isEdgeofClass:Returns true in the output pad if a edge is of a specified class.
Graph_setNodeAttribute Assigns a value specified by a variable or directly to the attribute of the referenced node.
Graph_setEdgeAttribute Assigns a value specified by a variable or directly to the attribute of the referenced edge.

Lookup

These are methods for doing efficient lookups for graph elements based on some identifying attribute. Creating a node lookup map and then searching through this map can drastically increase the performance if matches have to be found within a high number of nodes.

NameDescription
Graph_createNodeLookupCreates a lookup object that can be used to do efficient lookups for a node with a certain attribute value.
Graph_getNodesFromLookupIntUses a lookup to efficiently search for a list of nodes that have a certain attribute value of type int.
Graph_getNodesFromLookupLongUses a lookup to efficiently search for a list of nodes that have a certain attribute value of type long.
Graph_getNodesFromLookupStringUses a lookup to efficiently search for a list of nodes that have a certain attribute value of type string.

Merge

Although there are other (inbuilt GrGen) functions for merging elements these functions allow for specific merge operations with less code:

NameDescription
Graph_mergeNodesOfClassByAttributeMerges two nodes if they are of the same class and if a specified attribute value is equal
Graph_mergeNodesDeprecated!

Reachable

These functions allow the creation of node sets of a certain class (hence, of type) that are reachable via a specific edge class from a specific starting node. They extend the inbuilt reachable functions of GrGen by a fourth parameter, the class of elements being looked for.

NameDescription
Graph_reachableIncomingOfTypeReturns a node set of a specified class containing only nodes of the target node type that can be reached from a start node following only incoming edges of a specified type and passing only nodes of a specified type.
Graph_reachableOfType
Returns a node set of a specified class containing only nodes of the target node type that can be reached from a start node following edges of a specified type and passing only nodes of a specified type.
Graph_reachableOutgoingOfTypeReturns a node set of a specified class containing only nodes of the target node type that can be reached from a start node following only outgoing edges of a specified type and passing only nodes of a specified type.

For more information on the global in-built reachable functions, i.e. not the extended procedures described above, see https://support.soley.io/knowledge-base/functions-reachable-graph-elements/

Further Information

If these functions do not fit your needs, you can have a look at the Global Function section of the Soley Help Center for a list of GrGen inbuilt functions.

Was this article helpful?

Related Articles