documentationfor yFiles for HTML 2.6

ChainSubstructures

Detects SubstructureItemss that represent isolated chains in the specified graph.

Inheritance Hierarchy
ChainSubstructures

Remarks

A chain only consists of elements with the same edgeDirectedness and nodeTypes. More precisely, the edgeDirectedness is considered as follows: A substructure is only identified as such if all edges are either undirected or consistently directed with respect to the specified directedness.
  • A directedness value of 1 indicates that the edge is considered to be directed from source to target.
  • A directedness value of -1 indicates that the edge is considered to be directed from target to source.
  • A directedness value of 0 indicates that the edge is considered to be undirected.

Examples

Finding the chains in a graph
// prepare the chain detection algorithm
const algorithm = new ChainSubstructures()
// run the algorithm
const result = algorithm.run(graph)

// highlight the chains
for (const chain of result.chains) {
  for (const node of chain.nodes) {
    graph.setStyle(node, highlightNodeStyle)
  }
  for (const edge of chain.edges) {
    graph.setStyle(edge, highlightEdgeStyle)
  }
}
Finding only the chains in a graph whose nodes are of the same type
// prepare the chain detection algorithm
const algorithm = new ChainSubstructures({
  // only nodes with the same tags can be a chain
  nodeTypes: (node) => node.tag
})
// run the algorithm
const result = algorithm.run(graph)

// highlight the chains
for (const chain of result.chains) {
  for (const node of chain.nodes) {
    graph.setStyle(node, highlightNodeStyle)
  }
  for (const edge of chain.edges) {
    graph.setStyle(edge, highlightEdgeStyle)
  }
}// prepare the chain detection algorithm
const algorithm = new ChainSubstructures({
  // only nodes with the same tags can be a chain
  nodeTypes: (node: INode): any => node.tag
})
// run the algorithm
const result = algorithm.run(graph)

// highlight the chains
for (const chain of result.chains) {
  for (const node of chain.nodes) {
    graph.setStyle(node, highlightNodeStyle)
  }
  for (const edge of chain.edges) {
    graph.setStyle(edge, highlightEdgeStyle)
  }
}

Type Details

yfiles module
view-layout-bridge
yfiles-umd modules
view-layout-bridge
Legacy UMD name
yfiles.analysis.ChainSubstructures

See Also

The smallest minimumSize value that could be considered is 3.
A chain or star structure is also considered to be a tree.
If no edgeDirectedness is specified, all edges are treated as undirected. Furthermore, if no nodeTypes are specified, all node are considered to be of the same type.

Constructors

Properties

Methods