Converts an IGraph instance into a structure-only LayoutGraph instance that is created by createStructureGraph.
Remarks
This class creates a structural copy of a given IGraph and provides methods to convert items from one graph instance to their corresponding item in the other graph instance.
The main use case of this class is executing one of the analysis algorithms on an IGraph, for example shortestPath, findCycle, and graphCentrality. However, for most of the algorithms the analysis algorithms are preferred, as they can be used without any conversion directly on IGraph instances.
For executing a layout algorithm, LayoutExecutor would be preferred or one of the applyLayout and applyLayoutAnimated methods. LayoutGraphAdapter is the exact equivalent of this type for layout algorithms if low-level control over the conversion to LayoutGraph is needed.
Edge to edge connections are not supported. If the original IGraph contains such connections, an ArgumentError is thrown.
Type Details
- yFiles module
- view-layout-bridge
See Also
Constructors
StructureGraphAdapter
(originalGraph: IGraph, subgraphNodes?: IEnumerable<INode>, subgraphEdges?: IEnumerable<IEdge>)Initializes a new instance of the StructureGraphAdapter class.
Remarks
originalGraph
that has the same structure and makes it available via the structureGraph property.Parameters
A map of options to pass to the method.
- originalGraph - IGraph
- The original graph whose structure will be copied.
- subgraphNodes - IEnumerable<INode>
- The (sub) set of nodes to use to build the graph. If omitted, all nodes will be used. Providing nodes which are not part of the
originalGraph
will result in an exception. - subgraphEdges - IEnumerable<IEdge>
- The (sub) set of edges to use to build the graph. If omitted, all edges will be used. Providing edges which are not part of the
originalGraph
will result in an exception.
Throws
- Exception({ name: 'ArgumentError' })
- If
originalGraph
contains edge to edge connections, or ifsubgraphNodes
orsubgraphEdges
contain elements which are not contained in theoriginalGraph
.
Properties
Gets the original graph instance.
Property Value
Gets the graph instance that is created during the constructor call.
Property Value
Methods
Creates an IEnumerable<T> of copied LayoutEdge instances by mapping the provided original IEdge instances from the originalGraph to their corresponding originals in the structureGraph.
Remarks
Parameters
A map of options to pass to the method.
- edges - IEnumerable<IEdge>
- A collection of original IEdge instances for which the corresponding copied LayoutEdge instances will be returned.
Returns
- ↪IListEnumerable<LayoutEdge>
- An IListEnumerable<Edge> that contains the copied LayoutEdge instances corresponding to the provided
edges
; if an edge has no copied counterpart,null
is included in its place.
Throws
- Exception({ name: 'ArgumentError' })
- Thrown when the provided
edges
collection isnull
.
Creates an IEnumerable<T> of copied LayoutNode instances by mapping the provided original INode instances from the originalGraph to their corresponding originals in the structureGraph.
Remarks
Parameters
A map of options to pass to the method.
- nodes - IEnumerable<INode>
- A collection of original INode instances for which the corresponding copied LayoutNode instances will be returned.
Returns
- ↪IListEnumerable<LayoutNode>
- An IListEnumerable<Node> that contains the copied LayoutNode instances corresponding to the provided
nodes
; if a node has no copied counterpart,null
is included in its place.
Throws
- Exception({ name: 'ArgumentError' })
- Thrown when the provided
nodes
collection isnull
.
createCopiedToOriginalEdgeWrapper
<TValue>(mapper: IMapper<LayoutEdge,TValue>) : IMapper<IEdge,TValue>Creates an IMapper<K,V> that delegates its operations to the provided IMapper<K,V> for items within the context of the IGraph, but translates requests so they can be made using the corresponding original edges.
Remarks
Type Parameters
- TValue
- The type of the values associated with the edges in the mapper.
Parameters
A map of options to pass to the method.
- mapper - IMapper<LayoutEdge,TValue>
- The edge-to-value map that will be used for resolving values based on copied edges.
Returns
- ↪IMapper<IEdge,TValue>
- An IMapper<INode,T> that translates queries for original edges into queries for the corresponding copied edges in the provided
mapper
.
Throws
- Exception({ name: 'ArgumentError' })
- Thrown when the provided
mapper
isnull
.
createCopiedToOriginalNodeWrapper
<TValue>(mapper: IMapper<LayoutNode,TValue>) : IMapper<INode,TValue>Creates an IMapper<K,V> that delegates its operations to the provided IMapper<K,V> for items within the context of the IGraph, but translates requests so they can be made using the corresponding original nodes.
Remarks
Type Parameters
- TValue
- The type of the values associated with the nodes in the mapper.
Parameters
A map of options to pass to the method.
- mapper - IMapper<LayoutNode,TValue>
- The node-to-value map that will be used for resolving values based on copied nodes.
Returns
- ↪IMapper<INode,TValue>
- An IMapper<INode,T> that translates queries for original nodes into queries for the corresponding copied nodes in the provided
mapper
.
Throws
- Exception({ name: 'ArgumentError' })
- Thrown when the provided
mapper
isnull
.
Creates an IEnumerable<T> of original IEdge instances by mapping the provided copied LayoutEdge instances from the structureGraph to their corresponding originals in the originalGraph.
Remarks
Parameters
A map of options to pass to the method.
- edges - IEnumerable<LayoutEdge>
- A collection of copied LayoutEdge instances for which the corresponding original IEdge instances will be returned.
Returns
- ↪IListEnumerable<IEdge>
- An IListEnumerable<IEdge> that contains the original IEdge instances corresponding to the provided
edges
; if an edge has no original counterpart,null
is included in its place.
Throws
- Exception({ name: 'ArgumentError' })
- Thrown when the provided
edges
collection isnull
.
Creates an IEnumerable<T> of original INode instances by mapping the provided copied LayoutNode instances from the structureGraph to their corresponding originals in the originalGraph.
Remarks
Parameters
A map of options to pass to the method.
- nodes - IEnumerable<LayoutNode>
- A collection of copied LayoutNode instances for which the corresponding original INode instances will be returned.
Returns
- ↪IListEnumerable<INode>
- An IListEnumerable<INode> that contains the original INode instances corresponding to the provided
nodes
; if a node has no original counterpart,null
is included in its place.
Throws
- Exception({ name: 'ArgumentError' })
- Thrown when the provided
nodes
collection isnull
.
createOriginalToCopiedEdgeWrapper
<TValue>(mapper: IMapper<IEdge,TValue>) : IMapper<LayoutEdge,TValue>Creates an IMapper<K,V> that delegates its operations to the provided IMapper<K,V> for items within the context of the structureGraph, but translates requests so they can be made using the corresponding copied edges.
Remarks
Type Parameters
- TValue
- The type of the values associated with the edges in the mapper.
Parameters
A map of options to pass to the method.
- mapper - IMapper<IEdge,TValue>
- The edge-to-value map that will be used for resolving values based on original edges.
Returns
- ↪IMapper<LayoutEdge,TValue>
- An IMapper<INode,T> that translates queries for copied edges into queries for the corresponding original edges in the provided
mapper
.
Throws
- Exception({ name: 'ArgumentError' })
- Thrown when the provided
mapper
isnull
.
createOriginalToCopiedNodeWrapper
<TValue>(mapper: IMapper<INode,TValue>) : IMapper<LayoutNode,TValue>Creates an IMapper<K,V> that delegates its operations to the provided IMapper<K,V> for items within the context of the structureGraph, but translates requests so they can be made using the corresponding copied nodes.
Remarks
Type Parameters
- TValue
- The type of the values associated with the nodes in the mapper.
Parameters
A map of options to pass to the method.
- mapper - IMapper<INode,TValue>
- The node-to-value map that will be used for resolving values based on original nodes.
Returns
- ↪IMapper<LayoutNode,TValue>
- An IMapper<INode,T> that translates queries for copied nodes into queries for the corresponding original nodes in the provided
mapper
.
Throws
- Exception({ name: 'ArgumentError' })
- Thrown when the provided
mapper
isnull
.
Retrieves the copied edge from the structureGraph that corresponds to the specified original edge.
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge from the originalGraph for which the corresponding copied edge is to be retrieved.
Returns
- ↪LayoutEdge?
- The LayoutEdge instance that represents
edge
in the structureGraph, ornull
if no corresponding copied edge exists.
Retrieves the copied node from the structureGraph that corresponds to the specified original node.
Parameters
A map of options to pass to the method.
- node - INode
- The node from the originalGraph for which the corresponding copied node is to be retrieved.
Returns
- ↪LayoutNode?
- The LayoutNode instance that represents
node
in the structureGraph, ornull
if no corresponding copied node exists.
Retrieves the original edge from the originalGraph that corresponds to the specified copied edge.
Parameters
A map of options to pass to the method.
- edge - LayoutEdge
- The edge from the copied graph for which the corresponding original edge is to be retrieved.
Returns
Retrieves the original node from the originalGraph that corresponds to the specified copied node.
Parameters
A map of options to pass to the method.
- node - LayoutNode
- The node from the copied graph for which the corresponding original node is to be retrieved.