Converts an IGraph instance into a Graph instance.
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 ShortestPathAlgorithm, CycleAlgorithm, and CentralityAlgorithm. However, for most use cases the algorithms that work directly on the IGraph instance are preferred.
For executing a layout algorithm, LayoutExecutor would be preferred or one of the applyLayout and morphLayout 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 InvalidGraphStructureError is thrown.
Type Details
- yfiles module
- view-layout-bridge
- yfiles-umd modules
- view-layout-bridge
- Legacy UMD name
- yfiles.layout.YGraphAdapter
See Also
Constructors
YGraphAdapter
(originalGraph: IGraph, subgraphNodes?: IEnumerable<INode>, subgraphEdges?: IEnumerable<IEdge>)Initializes a new instance of the YGraphAdapter class.
Remarks
originalGraph
that has the same structure and makes it available via the yGraph 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
Properties
Gets the original graph instance.
Gets the graph instance that is created during the constructor call.
Methods
Creates an IDataMap that delegates to the provided IMapper<K,V> when queried for items in the yGraph.
Remarks
Type Parameters
- K
- The type of the keys in the mapper.
- V
- The type of the values in the mapper.
Parameters
A map of options to pass to the method.
- keyType - Class
- The type of the keys in the mapper.
- valueType - Class
- The type of the values in the mapper.
- mapper - IMapper<K,V>
- The mapper to direct requests to.
Returns
See Also
Creates an IDataProvider that delegates to the provided IMapper<K,V> when queried for items in the yGraph.
Remarks
Type Parameters
- K
- The type of the keys in the mapper.
- V
- The type of the values in the mapper.
Parameters
A map of options to pass to the method.
- keyType - Class
- The type of the keys in the mapper.
- valueType - Class
- The type of the values in the mapper.
- mapper - IMapper<K,V>
- The mapper to direct requests to.
Returns
- ↪IDataProvider
- A DataProvider that will delegate requests to the
mapper
.
Creates an IDataProvider that delegates to the provided delegate when queried for items in the yGraph.
Remarks
Type Parameters
- K
- The type of the keys in the mapper.
- V
- The type of the values in the mapper.
Parameters
A map of options to pass to the method.
- keyType - Class
- The type of the keys in the mapper.
- valueType - Class
- The type of the values in the mapper.
- getter - function(K):V
- The mapper delegate to direct requests to.
Signature Details
function(key: K) : V
A delegate that mimics the get access.Parameters
- key - K
- The key of the mapping.
Returns
- V
- The value or a suitable default that is associated with
key
.
Returns
- ↪IDataProvider
- A DataProvider that will delegate requests to the
getter
.
Creates an enumerable of edges that maps the edges from the EdgeList to their original ones.
Remarks
Parameters
A map of options to pass to the method.
- edges - EdgeList
- The edge list.
Returns
- ↪IListEnumerable<IEdge>
- An enumerable that contains the original edges for the ones in the list.
Creates an EdgeList that maps the edges from the IEnumerable<T> to their copied ones.
Remarks
Parameters
A map of options to pass to the method.
- edges - IEnumerable<IEdge>
- The edges from the originalGraph.
Returns
Creates an IEdgeMap that delegates to the provided IMapper<K,V> when queried for Edges in the yGraph.
Remarks
Type Parameters
- V
- The type of the values in the mapper.
Parameters
A map of options to pass to the method.
- mapper - IMapper<IEdge,V>
- The mapper to direct requests to.
Returns
Creates an IEdgeMap that delegates to the provided delegate when queried for Edges in the yGraph.
Remarks
Type Parameters
- V
- The type of the values in the mapper.
Parameters
A map of options to pass to the method.
- getter - function(IEdge):V
- The mapper delegate to direct read requests to.
Returns
Creates an IMapper<K,V> that delegates to the provided IEdgeMap when queried for items in the IGraph.
Remarks
Type Parameters
- T
- The type of the values in the mapper.
Parameters
A map of options to pass to the method.
- edgeMap - IEdgeMap
- The map to direct requests to.
Returns
- ↪IMapper<IEdge,T>
- A mapper that will delegate requests to the
edgeMap
.
createEdgeMap
, and to create a mapper for edges call createNodeMap
. This will be corrected in the next major release.Creates an IMapper<K,V> that delegates to the provided IDataProvider when queried for items in the IGraph.
Remarks
Type Parameters
- T
- The type of the values in the mapper.
Parameters
A map of options to pass to the method.
- dataProvider - IDataProvider
- The provider to direct requests to.
Returns
- ↪IMapper<IModelItem,T>
- A mapper that will delegate requests to the
dataProvider
.
Creates an enumerable of nodes that maps the nodes from the YNodeList to their original ones.
Remarks
Parameters
A map of options to pass to the method.
- nodes - YNodeList
- The node list.
Returns
- ↪IListEnumerable<INode>
- An enumerable that contains the original nodes for the ones in the list.
Creates a YNodeList that maps the nodes from the IEnumerable<T> to their copied ones.
Remarks
Parameters
A map of options to pass to the method.
- nodes - IEnumerable<INode>
- The nodes from the originalGraph.
Returns
Creates an INodeMap that delegates to the provided IMapper<K,V> when queried for YNodes in the yGraph.
Remarks
Type Parameters
- V
- The type of the values in the mapper.
Parameters
A map of options to pass to the method.
- mapper - IMapper<INode,V>
- The mapper to direct requests to.
Returns
Creates an INodeMap that delegates to the provided delegate when queried for YNodes in the yGraph.
Remarks
Type Parameters
- V
- The type of the values in the mapper.
Parameters
A map of options to pass to the method.
- getter - function(INode):V
- The mapper delegate to direct read requests to.
Returns
Creates an IMapper<K,V> that delegates to the provided INodeMap when queried for items in the IGraph.
Remarks
Type Parameters
- T
- The type of the values in the mapper.
Parameters
A map of options to pass to the method.
- nodeMap - INodeMap
- The map to direct requests to.
Returns
- ↪IMapper<INode,T>
- A mapper that will delegate requests to the
nodeMap
.
createEdgeMap
, and to create a mapper for edges call createNodeMap
. This will be corrected in the next major release.Yields the original edge from the original IGraph that the given edge has been created for.
Yields the original node from the original IGraph that the given node has been created for.