SubGraph Class

class SubGraph

Represents a SubGraph

__construct(?string $title = null, ?string $id = null)

Creates SubGraph

addEdge(Edge ...$edge)

Add edge(s)

Parameters:
  • ...$edge (Edge) – The edge(s)

Returns:

A new instance of SubGraph with the edge(s) added

Return type:

SubGraph

addNode(Node ...$node)

Add node(s)

Parameters:
  • ...$node (Node) – The node(s)

Returns:

A new instance of SubGraph with the node(s) added

Return type:

SubGraph

addSubGraph(SubGraph ...$subGraph)

Add subgraph(s)

Parameters:
  • ...$subGraph (SubGraph) – The subgraph(s)

Returns:

A new instance of SubGraph with the sub-graph(s) added

Return type:

SubGraph

withComment(string $comment)

Add a comment

Parameters:
  • $comment (string) – The comment

Returns:

A new instance of SubGraph with the comment

Return type:

SubGraph

withDirection(Direction $direction)

Set the subgraph direction

The default subgraph direction is Direction::TB

Note

If any of the subgraph’s nodes link outside of the subgraph, the subgraph direction is ignored and the subgraph inherits the direction of the parent graph.

Parameters:
  • $direction) (Direction) – The direction

Returns:

A new instance of SubGraph with the direction

Return type:

SubGraph

withEdge(Edge ...$edge)

Set edge(s)

Parameters:
  • ...$edge (Edge) – The edge(s)

Returns:

A new instance of SubGraph with the edge(s)

Return type:

SubGraph

withNode(Node ...$node)

Set node(s)

Parameters:
  • ...$node (Node) – The node(s)

Returns:

A new instance of SubGraph with the node(s)

Return type:

SubGraph

withSubGraph(SubGraph ...$subGraph)

Set sub-graph(s)

Parameters:
  • ...$subGraph (SubGraph) – The sub-graph(s)

Returns:

A new instance of SubGraph with the sub-graph(s)

Return type:

SubGraph