documentationfor yFiles for HTML 2.6

StarSubstructures

Detects SubstructureItemss that represent isolated stars in the specified graph.

Inheritance Hierarchy
StarSubstructures

Remarks

A star consists of a root that is connected to multiple nodes with degree one.

Since a star only consists of elements with the same edgeDirectedness and nodeTypes, a root may be associated with different stars. In this case, the algorithm only returns the largest star.

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 stars in a graph
// prepare the star detection algorithm
const algorithm = new StarSubstructures()
// run the algorithm
const result = algorithm.run(graph)

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

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

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

Type Details

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

See Also

The smallest minimumSize value that could be considered is 2.
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